FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
Public Member Functions | Protected Attributes | List of all members
CConfigurableObject Class Referenceabstract

#include <CConfigurableObject.h>

Collaboration diagram for CConfigurableObject:
Collaboration graph
[legend]

Public Member Functions

 CConfigurableObject (const CConfigurableObject &rhs)
 
CConfigurableObjectoperator= (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

CItemConfigurationm_pConfiguration
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CConfigurableObject()

CConfigurableObject::CConfigurableObject ( const CConfigurableObject rhs)

Copy construction.

Member Function Documentation

◆ Attach()

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.

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.
Note
- no assumption is made about only attaching once.

◆ cget() [1/2]

std::string CConfigurableObject::cget ( std::string  name)
Parameters
name- Name of a configuration parameteter.
Returns
string
Return values
Valueof that parameter.
Exceptions
CInvalidArgumentException
string- message if the parameter name does not exist.

◆ cget() [2/2]

CItemConfiguration::ConfigurationArray CConfigurableObject::cget ( )
Returns
CItemConfiguration::ConfigurationArray
Return values
theentire configuration for this module.
Exceptions
CInvalidArgumentExceptionif no configuration.

◆ configure()

void CConfigurableObject::configure ( std::string  name,
std::string  value 
)

Configure the value of the defined parameter. This can throw for the following reasons;

  • The delegated function throws,
  • m_pConfiguration is null.

◆ getName()

std::string CConfigurableObject::getName ( ) const

Get the name of the configuration item which is usually the name of the object.

Returns
std::string
Return values
Nameof the configuration.

◆ operator!=()

int CConfigurableObject::operator!= ( const CConfigurableObject rhs) const

Inequality is simpler.. just negate equality compare:

◆ operator=()

CConfigurableObject & CConfigurableObject::operator= ( const CConfigurableObject rhs)

Objects assign much like a copy construction, however the old configuration may need to be deleted.

◆ operator==()

int CConfigurableObject::operator== ( const CConfigurableObject rhs) const

Equality means the configuration is identical:


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