Scanframe Modular Application 0.1.0
|
Extended UnitConversionServer with master and slaved variables. More...
#include <UnitConversionServerEx.h>
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. | |
IniProfile & | getProfile () |
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 |
Extended UnitConversionServer with master and slaved variables.
sf::UnitConversionServerEx::UnitConversionServerEx | ( | ) |
Default constructor.
|
override |
Destructor.
void sf::UnitConversionServerEx::convertVariable | ( | Variable & | var, |
bool | regular = false |
||
) |
Converts this variable when a slave using the masters value.
var | Variable ofg which the owner is taken. |
regular | When True the variable is not checked against the mapped entries. |
void sf::UnitConversionServerEx::flush | ( | ) |
Flushes all conversion lists from this container.
id_type sf::UnitConversionServerEx::getEnableId | ( | ) | const |
Gets the enabled variable ID.
const char * sf::UnitConversionServerEx::getFollowersSectionName | ( | ) | const |
Gets the name of the followers section.
|
overrideprotectedvirtual |
Overridden from base class to intercept conversion failure.
Reimplemented from sf::UnitConversionServer.
|
overridevirtual |
Load the conversion configuration.
is | Input stream. |
Reimplemented from sf::UnitConversionServer.
void sf::UnitConversionServerEx::reinitialize | ( | ) |
Generates a lookup table and resets the existing conversion values.
|
overridevirtual |
Load the conversion configuration.
os | Output stream. |
Reimplemented from sf::UnitConversionServer.
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.
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.
enable | True to enable False to disable. |
void sf::UnitConversionServerEx::setEnableId | ( | id_type | ) |
Sets the enabled variable ID.
|
overridevirtual |
Overridden from base class to intercept a change.
Reimplemented from sf::UnitConversionServer.