ADTF  3.18.2
Unit

BaseUnit. More...

Inheritance diagram for Unit:
[legend]

Classes

class  RefUnit
 datamodel for the refUnit More...
 

Public Types

using RefUnits = std::vector< RefUnit >
 definiton of the container for the RefUnits
 
- Public Types inherited from ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
typedef EVENT_CODE_T event_code_type
 local definition of the event code type
 
typedef MODEL_SUBJECT_T subject_type
 local definition of the subject type
 
typedef ModelObserverUtility< MODEL_SUBJECT_T, EVENT_CODE_T > observer_type
 local definition of the observer type to notify
 

Public Member Functions

 Unit ()
 CTOR.
 
 Unit (const Unit &)=default
 copy CTOR
 
Unitoperator= (const Unit &)=default
 copy assignment operator More...
 
 Unit (Unit &&)=default
 move CTOR
 
Unitoperator= (Unit &&)=default
 move assignment operator More...
 
virtual ~Unit ()=default
 DTOR.
 
 Unit (const std::string &name, const std::string &numerator, const std::string &denominator, const std::string &offset, const std::vector< RefUnit > &ref_units={})
 CTOR. More...
 
bool operator== (const Unit &other) const
 equality operator. More...
 
bool operator!= (const Unit &other) const
 non equality operator. More...
 
TypeOfUnit getTypeOfUnit () const override
 Get the Type Of Unit. More...
 
void setName (const std::string &name) override
 Set the Name. More...
 
const std::string & getNumerator () const
 Get the Numerator. More...
 
void setNumerator (const std::string &numerator)
 Set the Numerator object. More...
 
const std::string & getDenominator () const
 Get the Denominator. More...
 
void setDenominator (const std::string &denominator)
 Set the Denominator. More...
 
const std::string & getOffset () const
 Get the Offset. More...
 
void setOffset (const std::string &offset)
 Set the Offset. More...
 
const RefUnitsgetRefUnits () const
 return the refUnits container More...
 
void addRefUnit (const RefUnit &ref_unit)
 adding a refunit More...
 
void removeRefUnit (const RefUnit &ref_unit)
 remove the refunit More...
 
- Public Member Functions inherited from UnitBase
 UnitBase ()=default
 default CTOR
 
 UnitBase (const UnitBase &)=default
 copy CTOR
 
 UnitBase (UnitBase &&)=default
 move CTOR
 
UnitBaseoperator= (const UnitBase &)=default
 copy assignment operator More...
 
UnitBaseoperator= (UnitBase &&)=default
 move assignment operator More...
 
 UnitBase (const std::string &name)
 CTOR. More...
 
virtual ~UnitBase ()=default
 DTOR.
 
const std::string & getName () const
 Get the Name. More...
 
- Public Member Functions inherited from ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
 ModelSubjectUtility ()=default
 CTOR.
 
 ModelSubjectUtility (const ModelSubjectUtility &)
 copy CTOR which removes the observers in case of!
 
ModelSubjectUtilityoperator= (const ModelSubjectUtility &)
 copy assignment operator which removes the observers in case of! More...
 
virtual ~ModelSubjectUtility ()=default
 DTOR.
 
void attachObserver (observer_type *observer)
 adda a observer to notify. More...
 
void detachObserver (observer_type *observer)
 remove a observer if in list. More...
 
- Public Member Functions inherited from InfoMap
 InfoMap ()=default
 CTOR.
 
 InfoMap (const InfoMap &)
 copy CTOR More...
 
 InfoMap (InfoMap &&)
 move CTOR More...
 
InfoMapoperator= (const InfoMap &)
 copy assignment operator More...
 
InfoMapoperator= (InfoMap &&)
 move assignment operator More...
 
template<typename INFO_T >
const INFO_T * getInfo () const
 Get the Info Pointer. More...
 
template<typename INFO_T >
INFO_T * getInfo ()
 Get the Info Pointer. More...
 
template<typename INFO_T >
void setInfo (const std::shared_ptr< INFO_T > &info)
 Set the Info object as shared pointer. More...
 

Private Member Functions

void notify (ModelEventCode code, utility::TypeAccessMapEventCode map_code, const std::string &additional_info)
 

Private Attributes

std::string _numerator = {}
 
std::string _denominator = {}
 
std::string _offset = {}
 
RefUnits _ref_units
 

Additional Inherited Members

- Protected Member Functions inherited from ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
void notifyChanged (event_code_type event_code, subject_type &changed_subject, const std::string &additional_info)
 helper utility function to notify the current observers More...
 
- Protected Attributes inherited from UnitBase
std::string _name
 the name
 

Detailed Description

BaseUnit.

Definition at line 335 of file datamodel_units.h.

Constructor & Destructor Documentation

◆ Unit()

Unit ( const std::string &  name,
const std::string &  numerator,
const std::string &  denominator,
const std::string &  offset,
const std::vector< RefUnit > &  ref_units = {} 
)

CTOR.

Parameters
namethe name of the unit
numeratorthe numerator for the unit
denominatorthe denominator for the unit
offsetthe offset for the unit
ref_unitsvector of refunits
Exceptions
dd::Errorthis will throw if this list contains a base_unit/prefix pair twice

Member Function Documentation

◆ addRefUnit()

void addRefUnit ( const RefUnit ref_unit)

adding a refunit

Parameters
ref_unitthe refunit to add
Exceptions
dd::Errorthis will throw if this refUnits already contains a base_unit/prefix pair

◆ getDenominator()

const std::string& getDenominator ( ) const

Get the Denominator.

Returns
const std::string&

◆ getNumerator()

const std::string& getNumerator ( ) const

Get the Numerator.

Returns
const std::string&

◆ getOffset()

const std::string& getOffset ( ) const

Get the Offset.

Returns
const std::string&

◆ getRefUnits()

const RefUnits& getRefUnits ( ) const

return the refUnits container

Returns
const RefUnits&

◆ getTypeOfUnit()

TypeOfUnit getTypeOfUnit ( ) const
overridevirtual

Get the Type Of Unit.

Returns
TypeOfUnit

Implements UnitBase.

◆ operator!=()

bool operator!= ( const Unit other) const

non equality operator.

Parameters
otherthe other unit to compare this unit to.
Returns
false the unit are equal (and all its refunits)
true the unit are not equal.

◆ operator=() [1/2]

Unit& operator= ( const Unit )
default

copy assignment operator

Returns
Unit&

◆ operator=() [2/2]

Unit& operator= ( Unit &&  )
default

move assignment operator

Returns
Unit&

◆ operator==()

bool operator== ( const Unit other) const

equality operator.

Parameters
otherthe other unit to compare this unit to.
Returns
true the unit are equal (and all its refunits)
false the unit are not equal.

◆ removeRefUnit()

void removeRefUnit ( const RefUnit ref_unit)

remove the refunit

Parameters
ref_unitthe refunit to remove

◆ setDenominator()

void setDenominator ( const std::string &  denominator)

Set the Denominator.

Parameters
denominatorthe denominator to set
Remarks
This will notify the change.

◆ setName()

void setName ( const std::string &  name)
overridevirtual

Set the Name.

Parameters
namethe name to set
Remarks
This will notify the change.
Exceptions
dd::ErrorIf the name already exists in the container this unit is part of it will throw.

Reimplemented from UnitBase.

◆ setNumerator()

void setNumerator ( const std::string &  numerator)

Set the Numerator object.

Parameters
numeratorthe numerator to set
Remarks
This will notify the change.

◆ setOffset()

void setOffset ( const std::string &  offset)

Set the Offset.

Parameters
offsetthe offset to set
Remarks
This will notify the change.