List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
det::ManagerRegister Class Referenceabstract

Register for detector description managers. More...

#include "det/ManagerRegister.h"

Inheritance diagram for det::ManagerRegister:
Inheritance graph
[legend]

Public Types

typedef std::map< std::string,
std::string > 
IndexMap
 
typedef
boost::indirect_iterator
< InternalManagerIterator,
VManager & > 
ManagerIterator
 Iterator over configured managers. More...
 
enum  Status { eFound, eNotFound }
 Specifies success or (eventually) various possible failure modes. More...
 

Public Member Functions

void Configure (const utl::Branch branch)
 Configure the ManagerRegister from a Branch. More...
 
void Configure (const std::ostringstream &configInstructions)
 Configure the ManagerRegister from a string. More...
 
Status GetData (double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (int &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::string &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::vector< double > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::vector< int > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::vector< std::string > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::vector< bool > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::list< double > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::list< int > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::list< std::string > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (utl::TabulatedFunction &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (utl::TabulatedFunctionComplexLgAmpPhase &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::list< std::pair< int, int > > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::map< int, utl::TabulatedFunction > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::vector< std::vector< int > > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
Status GetData (std::map< std::string, double > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
template<typename T >
Status GetData (T &returnData, const std::string &component, const std::string &property, const IndexMap &componentIndex=IndexMap()) const
 
virtual Status GetData (bool &, const std::string &componentProperty, const std::string &componentName, const VManager::IndexMap &) const
 
virtual Status GetData (std::list< std::pair< int, int >> &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::vector< std::vector< int >> &, const std::string &componentProperty, const std::string &componentName, const VManager::IndexMap &) const
 
virtual Status GetData (std::map< unsigned int, int > &, const std::string &componentProperty, const std::string &componentName, const VManager::IndexMap &) const
 
Status GetData (Handle &returnData, const std::string &component, const std::string &property, const IndexMap &index=IndexMap()) const
 new data accessor More...
 
template<typename T >
Status GetDataOrThrow (T &returnData, const std::string &component, const std::string &property, const IndexMap &index=IndexMap()) const
 
const VManagerGetManager (const std::string &managerName) const
 Get a specific manager by name. More...
 
VManagerGetManager (const std::string &managerName)
 Get a specific (modifiable) manager by name. More...
 
const std::string & GetName () const
 
virtual void Init (const std::string &)
 Manager Initialization. configLink is the CentralConfig hook for the configuration file. More...
 
bool IsInitialized () const
 
 ManagerRegister (const std::string &name)
 
ManagerIterator ManagersBegin () const
 Iterator pointing to first available manager. More...
 
ManagerIterator ManagersEnd () const
 Iterator pointing one past the last available manager. More...
 
void SetName (const std::string &name)
 
void SetReportingErrors (const bool flag=true)
 Generic data accessors. More...
 
virtual ~ManagerRegister ()
 

Static Public Member Functions

template<typename T >
static T FindComponent (const std::string &componentName, const IndexMap &componentIndex)
 
template<typename T , typename U >
static T FindComponent (const std::string &componentName, const U &defaultValue, const IndexMap &componentIndex)
 
static std::string QueryInfoMessage (const Handle &returnData, const std::string &component)
 
static std::string QueryInfoMessage (const Handle &returnData, const std::string &component, const std::string &property, const IndexMap &index)
 
static std::string QueryInfoMessage (const std::string &componentProperty, const std::string &componentName)
 
static std::string QueryInfoMessage (const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex)
 

Protected Member Functions

template<typename T >
void AddAvailability (const std::string &component)
 
void FindConfig (const std::string &configLink)
 Locate the configuration file in CentralConfig and make a Reader for it. More...
 
bool IsReportingErrors () const
 
std::string NotImplementedMessage (const std::string &type, const std::string &componentProperty, const std::string &componentName) const
 

Protected Attributes

std::set< std::string > fAvailableComponents
 
utl::Branch fBranch
 
bool fIsInitialized = false
 
bool fReportingErrors = false
 

Private Types

typedef
ManagerCollection::const_iterator 
InternalManagerIterator
 
typedef std::map< std::string,
VManagerBuilder * > 
ManagerBuilderMap
 
typedef std::vector< VManager * > ManagerCollection
 

Private Member Functions

virtual Status GenericGetData (Handle &returnData, const std::string &component, const std::string &property, const IndexMap &componentIndex) const
 
std::string GetConfiguredManagerListString () const
 
template<typename T >
Status GetManagerData (T &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
 
void InterpretXML (const utl::Branch &topBranch)
 
void RegisterBuilder (const std::string &name, VManagerBuilder &builder)
 

Static Private Member Functions

static void NotFoundAndThrow (const Handle &handle, const std::string &component, const std::string &property, const IndexMap &index)
 

Private Attributes

ManagerCollection fConfiguredManagerList
 
ManagerBuilderMap fManagerBuilderRegister
 

Friends

class ManagerBuilderRegisterEntry
 

Detailed Description

Register for detector description managers.

This class provides a container (a "register") for detector managers. The register may be queried for information, generally by the detector interface. When queried, the register iterates over the managers it contains and requests the information from each. When one manager returns the information, the register stops iterating. The flag VManager::Status is returned to indicate success or failure in fulfilling the request.

Author
T. Paul
D. Veberic
Date
12 Feb 2003
12 Jan 2007 DV update

Definition at line 43 of file ManagerRegister.h.

Member Typedef Documentation

typedef std::map<std::string, std::string> det::VManager::IndexMap
inherited

Definition at line 133 of file VManager.h.

typedef ManagerCollection::const_iterator det::ManagerRegister::InternalManagerIterator
private

Definition at line 47 of file ManagerRegister.h.

typedef std::map<std::string, VManagerBuilder*> det::ManagerRegister::ManagerBuilderMap
private

Definition at line 194 of file ManagerRegister.h.

typedef std::vector<VManager*> det::ManagerRegister::ManagerCollection
private

Definition at line 46 of file ManagerRegister.h.

Iterator over configured managers.

Definition at line 94 of file ManagerRegister.h.

Member Enumeration Documentation

enum det::VManager::Status
inherited

Specifies success or (eventually) various possible failure modes.

Various failure modes to be specified (for example, failure to connect to db, faiure to find db record, failure to find table name, etc

Enumerator
eFound 
eNotFound 

Definition at line 127 of file VManager.h.

Constructor & Destructor Documentation

det::ManagerRegister::ManagerRegister ( const std::string &  name)
inline

Definition at line 50 of file ManagerRegister.h.

virtual det::ManagerRegister::~ManagerRegister ( )
inlinevirtual

Definition at line 53 of file ManagerRegister.h.

Member Function Documentation

template<typename T >
void det::VManager::AddAvailability ( const std::string &  component)
inlineprotectedinherited

Definition at line 347 of file VManager.h.

void det::ManagerRegister::Configure ( const utl::Branch  branch)

Configure the ManagerRegister from a Branch.

From the Branch provided as an argument, this method steps through the DOM tree and attempts to configure the ManagerRegister according to the instructions therein. The idea is that this method can be used during initialization of the Detector, where the Branch passed to this method is the one created by the CentralConfig for the ManagerRegister configuration. According to instructions in the DOM tree, this method looks up the pointers to the requested managers and places them in the requested order in an internal list. The ManagerIterator then iterates over this list of manager pointers.

Definition at line 15 of file ManagerRegister.cc.

Referenced by DBSelectionTestSuccess::testSelectDB(), and DBSelectionTestFail::testSelectDB().

void det::ManagerRegister::Configure ( const std::ostringstream &  configInstructions)

Configure the ManagerRegister from a string.

This method parses the string provided in the method argument, which must be in XML format. According to the XML instructions, the method looks up the pointers to the requested managers and places them in the requested order in an internal list. The ManagerIterator then iterates over this list of manager pointers.

template<typename T >
static T det::VManager::FindComponent ( const std::string &  componentName,
const IndexMap componentIndex 
)
inlinestaticinherited

Definition at line 307 of file VManager.h.

References ERROR.

template<typename T , typename U >
static T det::VManager::FindComponent ( const std::string &  componentName,
const U defaultValue,
const IndexMap componentIndex 
)
inlinestaticinherited

Definition at line 322 of file VManager.h.

void det::VManager::FindConfig ( const std::string &  configLink)
protectedinherited

Locate the configuration file in CentralConfig and make a Reader for it.

Definition at line 25 of file VManager.cc.

References ERROR, and WARNING.

virtual Status det::ManagerRegister::GenericGetData ( Handle returnData,
const std::string &  component,
const std::string &  property,
const IndexMap index 
) const
inlineprivatevirtual

In the new interface, every manager has to implement only this method Since the reference to the return data is passed around with a void pointer, for easier identification of the wanted object typeIdName string is also passed around. In the manager code you can easily identifiy with what object the public templated GetData (above) was called with e.g.

if (returnData.Is<TPCInfo>()) {
TPCInfo& tpcInfo = returnData.Get<TPCInfo>();
... fill tpcInfo ...
return eFound;
} else
return eNotFound;

Implements det::VManager.

Definition at line 243 of file ManagerRegister.h.

References det::VManager::eFound, det::VManager::eNotFound, GetConfiguredManagerListString(), det::VManager::GetName(), ManagersBegin(), ManagersEnd(), det::VManager::QueryInfoMessage(), and WARNING.

Referenced by GetData(), and GetDataOrThrow().

string det::ManagerRegister::GetConfiguredManagerListString ( ) const
private

Definition at line 130 of file ManagerRegister.cc.

Referenced by GenericGetData(), and GetManagerData().

Status det::ManagerRegister::GetData ( double &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual
Status det::ManagerRegister::GetData ( int &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 146 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::string &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 148 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::vector< double > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 149 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::vector< int > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 150 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::vector< std::string > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 151 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::vector< bool > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 152 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::list< double > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 153 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::list< int > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 154 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::list< std::string > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 155 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( utl::TabulatedFunction returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 156 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( utl::TabulatedFunctionComplexLgAmpPhase returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 157 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::list< std::pair< int, int > > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inline

Definition at line 158 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::map< int, utl::TabulatedFunction > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 159 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::vector< std::vector< int > > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inline

Definition at line 160 of file ManagerRegister.h.

Status det::ManagerRegister::GetData ( std::map< std::string, double > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlinevirtual

Implements det::VManager.

Definition at line 161 of file ManagerRegister.h.

template<typename T >
Status det::ManagerRegister::GetData ( T &  returnData,
const std::string &  component,
const std::string &  property,
const IndexMap componentIndex = IndexMap() 
) const
inline

Definition at line 166 of file ManagerRegister.h.

References GenericGetData().

virtual Status det::VManager::GetData ( bool &  ,
const std::string &  componentProperty,
const std::string &  componentName,
const VManager::IndexMap  
) const
inlinevirtualinherited

Definition at line 241 of file VManager.h.

virtual Status det::VManager::GetData ( std::list< std::pair< int, int >> &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::vector< std::vector< int >> &  ,
const std::string &  componentProperty,
const std::string &  componentName,
const VManager::IndexMap  
) const
inlinevirtualinherited

Definition at line 255 of file VManager.h.

virtual Status det::VManager::GetData ( std::map< unsigned int, int > &  ,
const std::string &  componentProperty,
const std::string &  componentName,
const VManager::IndexMap  
) const
inlinevirtualinherited

Definition at line 256 of file VManager.h.

Status det::VManager::GetData ( Handle returnData,
const std::string &  component,
const std::string &  property,
const IndexMap index = IndexMap() 
) const
inlineinherited

new data accessor

Any property of the detector is supposed to be accessible through this interface. Interface specifies the name of the property and the component to which it belongs, together with a map of (index name, index value) identifying the specific instance of the component. For example, to request the quantum efficiency of PMT 3 in station 57, one would have

  • component = "PMT"
  • property = "quantumEfficiency"
  • index["stationId"] = "57"
  • index["PMT"] = "3"

Definition at line 275 of file VManager.h.

References det::VManager::CheckedGetData().

template<typename T >
Status det::ManagerRegister::GetDataOrThrow ( T &  returnData,
const std::string &  component,
const std::string &  property,
const IndexMap index = IndexMap() 
) const
inline
const VManager & det::ManagerRegister::GetManager ( const std::string &  managerName) const
VManager & det::ManagerRegister::GetManager ( const std::string &  managerName)

Get a specific (modifiable) manager by name.

Definition at line 85 of file ManagerRegister.cc.

References GetManager().

template<typename T >
Status det::ManagerRegister::GetManagerData ( T &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
inlineprivate
const std::string& det::VManager::GetName ( ) const
inlineinherited
virtual void det::ManagerRegister::Init ( const std::string &  configLink)
inlinevirtual

Manager Initialization. configLink is the CentralConfig hook for the configuration file.

This method instructs the manager to initialize itself. In the case of a manager which fetches data from an XML file, configuration involves getting the link to the appropriate configuration file from the CentralConfig and parsing the file to create a DOM or some other representation of the data in memory. For a manager which uses a MySQL database, configuration involves getting the link to the appropriate configuration file from the CentralConfig, then using the instructions in that file to establish a connection to the relevant database.

Note that one might initially think it makes more sense to just initialize managers automatically in their constructors so that developers don't need to remember to explicitly invoke the Init() method. (In fact it worked like this in an earlier version.) The rationale for not having automatic configuration via the constructors is that the configuration can now be delayed until the time that the user specifically requests a particular manager, rather than doing it at the time that the Detector object constructs the Managers. For example, when the user declares his set of desired managers in the ManagerRegister configuration, only those particular Managers will get initialized (though all available Managers will be constructed!). Consider someone who wants to test only the Fluorescence portion of the detector. By requiring explicit invocation of Init() one avoids providing hooks to all the SD related configuration files and databases which aren't even going to be used. Though the SD Managers will be constructed, no attempt will be made to Initialize them until the user specifically requests them by, for example, specifying them in the configuration file for the appropriate ManagerRegister.

Reimplemented from det::VManager.

Definition at line 56 of file ManagerRegister.h.

void det::ManagerRegister::InterpretXML ( const utl::Branch topBranch)
private
bool det::VManager::IsInitialized ( ) const
inlineinherited

Definition at line 214 of file VManager.h.

References det::VManager::fIsInitialized.

Referenced by InterpretXML().

bool det::VManager::IsReportingErrors ( ) const
inlineprotectedinherited
ManagerIterator det::ManagerRegister::ManagersBegin ( ) const
inline

Iterator pointing to first available manager.

Definition at line 97 of file ManagerRegister.h.

References fConfiguredManagerList.

Referenced by rdet::RDetector::AddStationListFromSManager(), GenericGetData(), and GetManagerData().

ManagerIterator det::ManagerRegister::ManagersEnd ( ) const
inline

Iterator pointing one past the last available manager.

Definition at line 101 of file ManagerRegister.h.

References fConfiguredManagerList.

Referenced by rdet::RDetector::AddStationListFromSManager(), GenericGetData(), and GetManagerData().

void det::ManagerRegister::NotFoundAndThrow ( const Handle handle,
const std::string &  component,
const std::string &  property,
const IndexMap index 
)
staticprivate

Definition at line 148 of file ManagerRegister.cc.

References ERROR.

Referenced by GetDataOrThrow().

string det::VManager::NotImplementedMessage ( const std::string &  type,
const std::string &  componentProperty,
const std::string &  componentName 
) const
protectedinherited

Definition at line 47 of file VManager.cc.

string det::VManager::QueryInfoMessage ( const Handle returnData,
const std::string &  component 
)
staticinherited
string det::VManager::QueryInfoMessage ( const Handle returnData,
const std::string &  component,
const std::string &  property,
const IndexMap index 
)
staticinherited

Definition at line 119 of file VManager.cc.

static std::string det::VManager::QueryInfoMessage ( const std::string &  componentProperty,
const std::string &  componentName 
)
inlinestaticinherited

Definition at line 294 of file VManager.h.

string det::VManager::QueryInfoMessage ( const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
)
staticinherited

Definition at line 58 of file VManager.cc.

void det::ManagerRegister::RegisterBuilder ( const std::string &  name,
VManagerBuilder builder 
)
private
void det::VManager::SetName ( const std::string &  name)
inlineinherited

Definition at line 332 of file VManager.h.

References det::VManager::fName.

Referenced by InterpretXML().

void det::VManager::SetReportingErrors ( const bool  flag = true)
inlineinherited

Generic data accessors.

Any property of the detector is supposed to be accessible through this interface. Interface specifies the name of the property and the component to which it belongs, together with a map of (index name, index value) identifying the specific instance of the component. For example, to request the quantum efficiency of PMT 3 in station 57, one would have

  • componentProperty = "quantumEfficiency"
  • componentName = "PMT"
  • componentIndex["stationId"] = "57"
  • componentIndex["PMT"] = "3"

Definition at line 231 of file VManager.h.

References det::VManager::fReportingErrors.

Friends And Related Function Documentation

friend class ManagerBuilderRegisterEntry
friend

Definition at line 284 of file ManagerRegister.h.

Member Data Documentation

std::set<std::string> det::VManager::fAvailableComponents
protectedinherited
utl::Branch det::VManager::fBranch
protectedinherited
ManagerCollection det::ManagerRegister::fConfiguredManagerList
private

Definition at line 197 of file ManagerRegister.h.

Referenced by ManagersBegin(), and ManagersEnd().

bool det::VManager::fIsInitialized = false
mutableprotectedinherited

Definition at line 354 of file VManager.h.

Referenced by det::VManager::IsInitialized().

ManagerBuilderMap det::ManagerRegister::fManagerBuilderRegister
private

Definition at line 195 of file ManagerRegister.h.

bool det::VManager::fReportingErrors = false
protectedinherited

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

, generated on Tue Sep 26 2023.