FRIBParallelanalysis
1.0
FrameworkforMPIParalleldataanalysisatFRIB
|
#include <CConfigurableObject.h>
Public Member Functions | |
CConfigurableObject (const CConfigurableObject &rhs) | |
CConfigurableObject & | operator= (const CConfigurableObject &rsh) |
int | operator== (const CConfigurableObject &rhs) const |
int | operator!= (const CConfigurableObject &rhs) const |
void | Attach (CItemConfiguration *pConfiguration, bool dynamic=true) |
void | configure (std::string name, std::string value) |
std::string | getName () const |
std::string | cget (std::string name) |
CItemConfiguration::ConfigurationArray | cget () |
virtual void | onAttach ()=0 |
Protected Attributes | |
CItemConfiguration * | m_pConfiguration |
This is the base class for an item that has a configuration. Normally this has to be extended tremendously to be usable as e.g. a readout module.
The class contains as a protected member, an object of type CItemConfiguration* At construction time, this is NULL. It is attached via the Attach member function, whic is virtual, and invokes the pure virtual onAttach member function to allow concrete classes to setup the configuration keywords supported.
Copy construction is supported and results in a copy of the item configuration itself.
The CItemConfiguration member functions:
are facaded through this base class so that configurable objects can be configured and inquired by script level beasts that only need to manipulate configurations.
CConfigurableObject::CConfigurableObject | ( | const CConfigurableObject & | rhs | ) |
Copy construction.
void CConfigurableObject::Attach | ( | CItemConfiguration * | pConfiguration, |
bool | dynamic = true |
||
) |
Once constructed, at some point the oustide world attaches a configuration to the object. This does that and then invokes the onAttach member function which provides concrete subclasses the chance to create the configuration parameters.
pConfiguration | - Pointer to the configuration to attach. |
dynamic | - If true, pConfiguration point to a dynamcially allocated object that should be deleted in our destructors. |
std::string CConfigurableObject::cget | ( | std::string | name | ) |
name | - Name of a configuration parameteter. |
Value | of that parameter. |
CInvalidArgumentException | |
string | - message if the parameter name does not exist. |
CItemConfiguration::ConfigurationArray CConfigurableObject::cget | ( | ) |
the | entire configuration for this module. |
CInvalidArgumentException | if no configuration. |
void CConfigurableObject::configure | ( | std::string | name, |
std::string | value | ||
) |
Configure the value of the defined parameter. This can throw for the following reasons;
std::string CConfigurableObject::getName | ( | ) | const |
Get the name of the configuration item which is usually the name of the object.
Name | of the configuration. |
int CConfigurableObject::operator!= | ( | const CConfigurableObject & | rhs | ) | const |
Inequality is simpler.. just negate equality compare:
CConfigurableObject & CConfigurableObject::operator= | ( | const CConfigurableObject & | rhs | ) |
Objects assign much like a copy construction, however the old configuration may need to be deleted.
int CConfigurableObject::operator== | ( | const CConfigurableObject & | rhs | ) | const |
Equality means the configuration is identical: