PARTONS  
PARtonic Tomography Of Nucleon Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PARTONS::PhysicalType< T > Class Template Reference

Value with unit. More...

Inheritance diagram for PARTONS::PhysicalType< T >:
PARTONS::BaseObject

Public Member Functions

 PhysicalType ()
 Default constructor. More...
 
 PhysicalType (PhysicalUnit::Type unit)
 Assignment constructor. More...
 
 PhysicalType (T value, PhysicalUnit::Type unit)
 Assignment constructor. More...
 
 PhysicalType (const std::string &stringValue, PhysicalUnit::Type unit)
 Assignment constructor. More...
 
 PhysicalType (const ElemUtils::GenericType &value, PhysicalUnit::Type unit)
 Assignment constructor. More...
 
 PhysicalType (const PhysicalType &other)
 Copy constructor. More...
 
std::string toString () const
 Return string representing the whole object. More...
 
void serialize (ElemUtils::Packet &packet) const
 Serialize into given Packet. More...
 
void unserialize (ElemUtils::Packet &packet)
 Retrieve data from given Packet. More...
 
void serializeIntoStdVector (std::vector< double > &vec) const
 Serialize into std::vector<double> More...
 
void unserializeFromStdVector (std::vector< double >::const_iterator &it, const std::vector< double >::const_iterator &end)
 Uneserialize from std::vector<double> More...
 
std::string toStdString () const
 Return string representing value and unit. More...
 
PhysicalType< T > & operator= (PhysicalType< T > const &rhs)
 Assignment operator. More...
 
operator() ()
 Operator to return value. More...
 
getValue () const
 Get value. More...
 
void setValue (T value)
 Set value. More...
 
PhysicalUnit::Type getUnit () const
 Get unit. More...
 
void setUnit (PhysicalUnit::Type unit)
 Set unit. More...
 
bool isInitialized () const
 Check if initialized. More...
 
void setInitialized (bool initialized)
 Set as initialized. More...
 
PhysicalType< T > makeSameUnitAs (PhysicalUnit::Type other) const
 Check if the same unit category. More...
 
PhysicalType< T > makeSameUnitAs (const PhysicalType< T > &other) const
 Check if the same unit category. More...
 
void checkIfSameUnitAs (PhysicalUnit::Type other) const
 Check if the same unit. More...
 
void checkIfSameUnitAs (const PhysicalType< T > &other) const
 Check if the same unit. More...
 
void checkIfSameUnitCategoryAs (PhysicalUnit::Type other) const
 Check if the same unit category. More...
 
void checkIfSameUnitCategoryAs (const PhysicalType< T > &other) const
 Check if the same unit category. More...
 
- Public Member Functions inherited from PARTONS::BaseObject
 BaseObject (const std::string &className)
 Constructor. More...
 
virtual ~BaseObject ()
 Default destructor. More...
 
virtual BaseObjectclone () const
 Virtual clone function to allow the factory to clone all derived members object stored in the BaseObjectRegistry. More...
 
virtual void resolveObjectDependencies ()
 Because of the initialization step order of the program, objects are registered in a total random order and some objects depend on others. More...
 
void serialize (ElemUtils::Packet &packet) const
 Used to split a complex C++ object into a concatenation of simple types. More...
 
void unserialize (ElemUtils::Packet &packet)
 Used to rebuild a complex C++ object from a concatenation of simple type. More...
 
bool operator< (const BaseObject &other) const
 Overload of < operator to sort BaseObject object by its indexId value. More...
 
const std::string & getClassName () const
 
unsigned int getObjectId () const
 
int getIndexId () const
 
void setIndexId (int indexId)
 

Private Member Functions

void valueFromStdString (const std::string &stringValue)
 Set value from std::string. More...
 

Private Attributes

bool m_initialized
 True if value initialized. More...
 
m_value
 Value. More...
 
PhysicalUnit::Type m_unit
 Unit. More...
 

Additional Inherited Members

- Protected Member Functions inherited from PARTONS::BaseObject
 BaseObject (const BaseObject &other)
 Copy constructor. More...
 
void info (const std::string &functionName, const std::string &message) const
 Print info message into logger. More...
 
void debug (const std::string &functionName, const std::string &message) const
 Print debug message into logger. More...
 
void warn (const std::string &functionName, const std::string &message) const
 Print warning message into logger. More...
 
void errorMissingParameter (const std::string &parameterName) const
 Use in automation process to throw exception when a parameter is missing from the XML scenario file. More...
 

Detailed Description

template<class T>
class PARTONS::PhysicalType< T >

Value with unit.

This class is a container for a value, unit and switch to mark if the value is initialized or not. Setting a value (either via setter or one of constructors) make the object "initialized".

Constructor & Destructor Documentation

◆ PhysicalType() [1/6]

template<class T >
PARTONS::PhysicalType< T >::PhysicalType ( )
inline

Default constructor.

◆ PhysicalType() [2/6]

template<class T >
PARTONS::PhysicalType< T >::PhysicalType ( PhysicalUnit::Type  unit)
inline

Assignment constructor.

◆ PhysicalType() [3/6]

template<class T >
PARTONS::PhysicalType< T >::PhysicalType ( value,
PhysicalUnit::Type  unit 
)
inline

Assignment constructor.

◆ PhysicalType() [4/6]

template<class T >
PARTONS::PhysicalType< T >::PhysicalType ( const std::string &  stringValue,
PhysicalUnit::Type  unit 
)
inline

Assignment constructor.

◆ PhysicalType() [5/6]

template<class T >
PARTONS::PhysicalType< T >::PhysicalType ( const ElemUtils::GenericType &  value,
PhysicalUnit::Type  unit 
)
inline

Assignment constructor.

◆ PhysicalType() [6/6]

template<class T >
PARTONS::PhysicalType< T >::PhysicalType ( const PhysicalType< T > &  other)
inline

Copy constructor.

Member Function Documentation

◆ checkIfSameUnitAs() [1/2]

template<class T >
void PARTONS::PhysicalType< T >::checkIfSameUnitAs ( const PhysicalType< T > &  other) const
inline

Check if the same unit.

If units are different throw exception.

◆ checkIfSameUnitAs() [2/2]

template<class T >
void PARTONS::PhysicalType< T >::checkIfSameUnitAs ( PhysicalUnit::Type  other) const
inline

Check if the same unit.

If units are different throw exception.

◆ checkIfSameUnitCategoryAs() [1/2]

template<class T >
void PARTONS::PhysicalType< T >::checkIfSameUnitCategoryAs ( const PhysicalType< T > &  other) const
inline

Check if the same unit category.

If units are different throw exception.

◆ checkIfSameUnitCategoryAs() [2/2]

template<class T >
void PARTONS::PhysicalType< T >::checkIfSameUnitCategoryAs ( PhysicalUnit::Type  other) const
inline

Check if the same unit category.

If units are different throw exception.

◆ getUnit()

template<class T >
PhysicalUnit::Type PARTONS::PhysicalType< T >::getUnit ( ) const
inline

Get unit.

◆ getValue()

template<class T >
T PARTONS::PhysicalType< T >::getValue ( ) const
inline

Get value.

◆ isInitialized()

template<class T >
bool PARTONS::PhysicalType< T >::isInitialized ( ) const
inline

Check if initialized.

◆ makeSameUnitAs() [1/2]

template<class T >
PhysicalType<T> PARTONS::PhysicalType< T >::makeSameUnitAs ( const PhysicalType< T > &  other) const
inline

Check if the same unit category.

If units are different make the conversion.

◆ makeSameUnitAs() [2/2]

template<class T >
PhysicalType<T> PARTONS::PhysicalType< T >::makeSameUnitAs ( PhysicalUnit::Type  other) const
inline

Check if the same unit category.

If units are different make the conversion.

◆ operator()()

template<class T >
T PARTONS::PhysicalType< T >::operator() ( )
inline

Operator to return value.

◆ operator=()

template<class T >
PhysicalType<T>& PARTONS::PhysicalType< T >::operator= ( PhysicalType< T > const &  rhs)
inline

Assignment operator.

◆ serialize()

template<class T >
void PARTONS::PhysicalType< T >::serialize ( ElemUtils::Packet &  packet) const
inline

Serialize into given Packet.

Parameters
packetTarget Packet.

◆ serializeIntoStdVector()

template<class T >
void PARTONS::PhysicalType< T >::serializeIntoStdVector ( std::vector< double > &  vec) const
inline

Serialize into std::vector<double>

◆ setInitialized()

template<class T >
void PARTONS::PhysicalType< T >::setInitialized ( bool  initialized)
inline

Set as initialized.

◆ setUnit()

template<class T >
void PARTONS::PhysicalType< T >::setUnit ( PhysicalUnit::Type  unit)
inline

Set unit.

◆ setValue()

template<class T >
void PARTONS::PhysicalType< T >::setValue ( value)
inline

Set value.

This function makes the object marked as initialized.

◆ toStdString()

template<class T >
std::string PARTONS::PhysicalType< T >::toStdString ( ) const
inline

Return string representing value and unit.

To be used mainly in the generation of hash sums.

◆ toString()

template<class T >
std::string PARTONS::PhysicalType< T >::toString ( ) const
inlinevirtual

Return string representing the whole object.

Reimplemented from PARTONS::BaseObject.

◆ unserialize()

template<class T >
void PARTONS::PhysicalType< T >::unserialize ( ElemUtils::Packet &  packet)
inline

Retrieve data from given Packet.

Parameters
packetInput Packet.

◆ unserializeFromStdVector()

template<class T >
void PARTONS::PhysicalType< T >::unserializeFromStdVector ( std::vector< double >::const_iterator &  it,
const std::vector< double >::const_iterator &  end 
)
inline

Uneserialize from std::vector<double>

◆ valueFromStdString()

template<class T >
void PARTONS::PhysicalType< T >::valueFromStdString ( const std::string &  stringValue)
inlineprivate

Set value from std::string.

Member Data Documentation

◆ m_initialized

template<class T >
bool PARTONS::PhysicalType< T >::m_initialized
private

True if value initialized.

◆ m_unit

template<class T >
PhysicalUnit::Type PARTONS::PhysicalType< T >::m_unit
private

Unit.

◆ m_value

template<class T >
T PARTONS::PhysicalType< T >::m_value
private

Value.


The documentation for this class was generated from the following file: