ifw-fcf
5.0.0-pre2
|
Device Configuration class. More...
#include <deviceConfig.hpp>
Public Member Functions | |
DeviceConfig (const std::string &filename, const std::string &name) | |
DeviceConfig constructor. More... | |
DeviceConfig (const std::string &name) | |
DeviceConfig constructor. More... | |
virtual | ~DeviceConfig () |
DeviceConfig destructor. More... | |
bool | Init () |
Initialises a device. More... | |
void | InitFromString (std::string config) |
Init the internal configuration from a string. More... | |
void | InitFromFile (const std::string &filename) |
Init the internal configuration from a given file. More... | |
virtual void | GetConfig (protocol::base::VectorVariant ¶ms) const |
Obtain the list of configuration parameters. More... | |
std::string | GetIdentifier () const |
std::string | GetPrefix () const |
std::string | GetAddress () const |
std::string | GetSimAddress () const |
std::string | GetFitsPrefix () const |
Get Fits Prefix. More... | |
std::string | GetType () const |
int | GetNamespace () const |
std::string | GetAlias () const |
std::string | GetId () const |
std::string | GetOverview () const |
std::string | GetDescription () const |
std::string | GetName () const noexcept |
std::string | GetLogName () const noexcept |
std::string | GetNodeId (const std::string &attrib) const |
Get node id. More... | |
std::string | GetProcId (const std::string &attrib) const |
Get procedure id. More... | |
std::string | GetObjId () const |
Get object id. More... | |
virtual void | GetConfigList (utils::bat::DbVector &cfg_list, std::string prefix) const |
Get configuration list. More... | |
std::string | GetCfgFile () const |
GetCfgFile. More... | |
std::string | GetCfgAsString () const |
GetCfgAsString. More... | |
virtual void | SetSimulateFlag (const bool flag) |
Set simulation flag. More... | |
virtual void | SetIgnoreFlag (const bool flag) |
Set ignore flag. More... | |
virtual bool | GetIgnored () const |
Get ignored flag. More... | |
virtual bool | GetSimulated () const |
Get simulated flag. More... | |
virtual std::string | GetMapFile () const |
Get name of the device mapping file. More... | |
void | CheckConfig () const |
Validates the document configuration. More... | |
Protected Member Functions | |
void | MergeConfig (const elt::configng::CiiConfigDocument &doc, bool check=true) |
Merges a configuration file. More... | |
bool | GetVariantValue (const elt::configng::CiiConfigInstanceNode node, protocol::base::Variant &value) const |
Obtain the variant value with the correct type. More... | |
Protected Attributes | |
std::string | m_filename |
filename of device configuration file More... | |
std::string | m_name |
device identifier More... | |
std::string | m_identifier |
Address space identifier. More... | |
std::string | m_type |
Device type. More... | |
std::string | m_fits_prefix |
bool | m_simulated |
bool | m_ignored |
std::string | m_lcs_prefix |
std::string | m_address |
std::string | m_sim_address |
std::string | m_map_file |
std::string | m_alias |
int | m_lcs_namespace |
std::unique_ptr< elt::configng::CiiConfigDocument > | m_config_doc |
Internal configuration document object. More... | |
Device Configuration class.
This class manages the configuration of a device. It reads the configuration file and provides the methods to obtain the parameters used by the various classes.
fcf::devmgr::common::DeviceConfig::DeviceConfig | ( | const std::string & | filename, |
const std::string & | name | ||
) |
DeviceConfig constructor.
[in] | filename | filename of the device configuration file. |
[in] | name | Device identifier. |
fcf::devmgr::common::DeviceConfig::DeviceConfig | ( | const std::string & | name | ) |
DeviceConfig constructor.
Special constructor to be used for special cases, e.g. in GUIs.
|
virtual |
DeviceConfig destructor.
void fcf::devmgr::common::DeviceConfig::CheckConfig | ( | ) | const |
Validates the document configuration.
std::runtime_error | in case check reported issues. |
|
virtual |
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
std::string fcf::devmgr::common::DeviceConfig::GetCfgFile | ( | ) | const |
GetCfgFile.
|
virtual |
Obtain the list of configuration parameters.
[in,out] | params | output vector with the list of config parameters |
This methods prepare a vector with all the configuration parameters of a device with the purpose to write it into the controller. Only attributes that are scalars are considered here.
runtime | error in case of bad casting. |
Implements fcf::devmgr::common::IDeviceConfig.
Reimplemented in fcf::devmgr::motor::MotorConfig, fcf::devmgr::iodev::IODevConfig, and fcf::devmgr::adc::AdcConfig.
|
virtual |
Get configuration list.
cfg_list | List of all configuration parameters. |
prefix | Prefix to be added to the attributes names. |
This method returs the complete of configuration parameters handled by this class. This method is used to dump the list into the DB.
Reimplemented in fcf::devmgr::motor::MotorConfig, fcf::devmgr::motor::MotorBaseConfig, fcf::devmgr::iodev::IODevConfig, and fcf::devmgr::adc::AdcConfig.
std::string fcf::devmgr::common::DeviceConfig::GetDescription | ( | ) | const |
std::string fcf::devmgr::common::DeviceConfig::GetFitsPrefix | ( | ) | const |
Get Fits Prefix.
std::string fcf::devmgr::common::DeviceConfig::GetId | ( | ) | const |
|
virtual |
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Get ignored flag.
Implements fcf::devmgr::common::IDeviceConfig.
|
inlinenoexcept |
|
virtual |
Get name of the device mapping file.
Implements fcf::devmgr::common::IDeviceConfig.
Reimplemented in testShutterLcsIf::TestShutterConfig, testShutterConfig::MyDeviceConfig, testMotorLcsIf::TestMotorConfig, testMotorConfig::MyDeviceConfig, testLampLcsIf::TestLampConfig, and testLampConfig::MyDeviceConfig.
|
inlinevirtualnoexcept |
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Get node id.
[in] | attrib | attribute to build the node id |
The NodeId is composed by the following: <namespace>,<prefix>.<attribute>
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Get object id.
This method returns the address space prefix for executing RPC calls.
<namespace>,<prefix>
Implements fcf::devmgr::common::IDeviceConfig.
std::string fcf::devmgr::common::DeviceConfig::GetOverview | ( | ) | const |
|
virtual |
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Get procedure id.
[in] | attrib | attribute to build the node id |
The procedure id is the NodeId for RPC calls and it is composed by the following:
<namespace>,<prefix>#<attribute>
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Get simulated flag.
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Implements fcf::devmgr::common::IDeviceConfig.
|
protected |
Obtain the variant value with the correct type.
[in] | node | Configuration node |
[in] | value | Variant value to be filled up |
This methods fill the variant with the value obtained from the node according to the respective type.
runtime | error in case of bad casting. |
bool fcf::devmgr::common::DeviceConfig::Init | ( | ) |
Initialises a device.
void fcf::devmgr::common::DeviceConfig::InitFromFile | ( | const std::string & | filename | ) |
Init the internal configuration from a given file.
filename | This method is to be used in special cases only. The standard way is to use the proper constructor that will initialize automaticaly the internal configuration with the configuration file using method Init. |
void fcf::devmgr::common::DeviceConfig::InitFromString | ( | std::string | config | ) |
Init the internal configuration from a string.
config | This method is to be used in special cases, for instance by GUIs where the configuration can be obtained from the server as a string. With this method you can avoid accessing directly to the filesystem which might be hidden by Nomad. |
|
protected |
Merges a configuration file.
doc | Config document object to be validated. |
check | Flag to verify after the merge. |
std::runtime_error | in case check reported issues. |
|
virtual |
Set ignore flag.
Implements fcf::devmgr::common::IDeviceConfig.
|
virtual |
Set simulation flag.
Implements fcf::devmgr::common::IDeviceConfig.
|
protected |
|
protected |
|
protected |
Internal configuration document object.
|
protected |
filename of device configuration file
|
protected |
|
protected |
Address space identifier.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
device identifier
|
protected |
|
protected |
|
protected |
Device type.