Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::UnitConversionServerEx Class Reference

Extended UnitConversionServer with master and slaved variables. More...

#include <UnitConversionServerEx.h>

Inheritance diagram for sf::UnitConversionServerEx:
Collaboration diagram for sf::UnitConversionServerEx:

Public Member Functions

 UnitConversionServerEx ()
 Default constructor.
 
 ~UnitConversionServerEx () override
 Destructor.
 
void flush ()
 Flushes all conversion lists from this container.
 
void setUnitSystem (int us) override
 Overridden from base class to intercept a change.
 
bool load (std::istream &is) override
 Load the conversion configuration.
 
bool save (std::ostream &os) override
 Load the conversion configuration.
 
void setEnable (bool enable)
 Enables or disables the conversion on Variables that are following the master.
 
id_type getEnableId () const
 Gets the enabled variable ID.
 
void setEnableId (id_type)
 Sets the enabled variable ID.
 
void convertVariable (Variable &var, bool regular=false)
 Converts this variable when a slave using the masters value.
 
void reinitialize ()
 Generates a lookup table and resets the existing conversion values.
 
void setAskHandler (const UnitConversionServerClosure &closure=UnitConversionServerClosure())
 Assigns a handler for when a conversion is not provided. Calling this method with default arguments disables the handler.
 
const char * getFollowersSectionName () const
 Gets the name of the followers section.
 
- Public Member Functions inherited from sf::UnitConversionServer
 UnitConversionServer ()
 Default constructor.
 
 UnitConversionServer (const UnitConversionServer &)=delete
 Copying this class is not possible.
 
bool isDirty () const
 Gets the dirty status of the configuration.
 
void setConversion (UnitConversionEvent &ev)
 Writes or over writes a conversion entry in the profile.
 
void removeConversion (const std::string &key)
 Removes a conversion entry in the profile.
 
 ~UnitConversionServer ()
 Destructor.
 
EUnitSystem getUnitSystem () const
 Gets the unit system being applied.
 
IniProfilegetProfile ()
 Gets the internal storage profile.
 

Protected Member Functions

bool Handler (UnitConversionEvent &ev) override
 Overridden from base class to intercept conversion failure.
 

Additional Inherited Members

- Public Types inherited from sf::UnitConversionServer
enum  EUnitSystem : int { usPassThrough , usMetric , usImperial }
 Different unit conversion systems. More...
 
typedef std::pair< UnitConversionServer::EUnitSystem, const char * > UnitSystemPair
 Type to combine a system enumerate and name.
 
- Static Public Member Functions inherited from sf::UnitConversionServer
static const char * getUnitSystemName (int us)
 Gets the section name of the passed enumerate.
 
static const std::vector< UnitSystemPair > & getUnitSystemNames ()
 
- Protected Attributes inherited from sf::UnitConversionServer
IniProfile _profile
 

Detailed Description

Extended UnitConversionServer with master and slaved variables.

Constructor & Destructor Documentation

◆ UnitConversionServerEx()

sf::UnitConversionServerEx::UnitConversionServerEx ( )

Default constructor.

◆ ~UnitConversionServerEx()

sf::UnitConversionServerEx::~UnitConversionServerEx ( )
override

Destructor.

Member Function Documentation

◆ convertVariable()

void sf::UnitConversionServerEx::convertVariable ( Variable var,
bool  regular = false 
)

Converts this variable when a slave using the masters value.

Parameters
varVariable ofg which the owner is taken.
regularWhen True the variable is not checked against the mapped entries.

◆ flush()

void sf::UnitConversionServerEx::flush ( )

Flushes all conversion lists from this container.

◆ getEnableId()

id_type sf::UnitConversionServerEx::getEnableId ( ) const

Gets the enabled variable ID.

◆ getFollowersSectionName()

const char * sf::UnitConversionServerEx::getFollowersSectionName ( ) const

Gets the name of the followers section.

◆ Handler()

bool sf::UnitConversionServerEx::Handler ( UnitConversionEvent ev)
overrideprotectedvirtual

Overridden from base class to intercept conversion failure.

Reimplemented from sf::UnitConversionServer.

◆ load()

bool sf::UnitConversionServerEx::load ( std::istream &  is)
overridevirtual

Load the conversion configuration.

Parameters
isInput stream.
Returns
True on success.

Reimplemented from sf::UnitConversionServer.

◆ reinitialize()

void sf::UnitConversionServerEx::reinitialize ( )

Generates a lookup table and resets the existing conversion values.

◆ save()

bool sf::UnitConversionServerEx::save ( std::ostream &  os)
overridevirtual

Load the conversion configuration.

Parameters
osOutput stream.
Returns
True on success.

Reimplemented from sf::UnitConversionServer.

◆ setAskHandler()

void sf::UnitConversionServerEx::setAskHandler ( const UnitConversionServerClosure closure = UnitConversionServerClosure())

Assigns a handler for when a conversion is not provided. Calling this method with default arguments disables the handler.

◆ setEnable()

void sf::UnitConversionServerEx::setEnable ( bool  enable)

Enables or disables the conversion on Variables that are following the master.

This is normally controlled by the Enable variable when linked.

Parameters
enableTrue to enable False to disable.

◆ setEnableId()

void sf::UnitConversionServerEx::setEnableId ( id_type  )

Sets the enabled variable ID.

◆ setUnitSystem()

void sf::UnitConversionServerEx::setUnitSystem ( int  us)
overridevirtual

Overridden from base class to intercept a change.

Reimplemented from sf::UnitConversionServer.


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