00001 #include "otsdaq-core/Configurable/Configurable.h"
00002
00003 #include "otsdaq-core/ConfigurationPluginDataFormats/XDAQContextConfiguration.h"
00004
00005
00006 using namespace ots;
00007
00008 #undef __COUT_HDR__
00009 #define __COUT_HDR__ "Configurable"
00010
00011
00012
00013 Configurable::Configurable(const ConfigurationTree& theXDAQContextConfigTree, const std::string& theConfigurationPath)
00014 : theXDAQContextConfigTree_ (theXDAQContextConfigTree)
00015 , theConfigurationPath_ (theConfigurationPath)
00016 , theConfigurationRecordName_ (theXDAQContextConfigTree_.getNode(theConfigurationPath_).getValueAsString())
00017 {
00018 __CFG_COUT__ << __E__;
00019 }
00020
00021
00022 Configurable::~Configurable(void)
00023 {}
00024
00025
00026 ConfigurationTree Configurable::getSelfNode() const
00027 {
00028 return theXDAQContextConfigTree_.getNode(theConfigurationPath_);
00029 }
00030
00031
00032 const ConfigurationManager* Configurable::getConfigurationManager() const
00033 {
00034 return theXDAQContextConfigTree_.getConfigurationManager();
00035 }
00036
00037
00038 const std::string& Configurable::getContextUID() const
00039 {
00040 return theXDAQContextConfigTree_.getForwardNode(
00041 theConfigurationPath_,1 ).getValueAsString();
00042 }
00043
00044
00045 const std::string& Configurable::getApplicationUID() const
00046 {
00047 return theXDAQContextConfigTree_.getForwardNode(
00048 theConfigurationPath_,3 ).getValueAsString();
00049 }
00050
00051
00052 unsigned int Configurable::getApplicationLID() const
00053 {
00054 const XDAQContextConfiguration* contextConfig =
00055 getConfigurationManager()->__GET_CONFIG__(XDAQContextConfiguration);
00056
00057 return contextConfig->getApplicationNode(
00058 getConfigurationManager(),
00059 getContextUID(),
00060 getApplicationUID()).getNode(
00061 contextConfig->colApplication_.colId_).getValue<unsigned int>();
00062 }
00063
00064
00065 std::string Configurable::getContextAddress() const
00066 {
00067 const XDAQContextConfiguration* contextConfig =
00068 getConfigurationManager()->__GET_CONFIG__(XDAQContextConfiguration);
00069
00070 return contextConfig->getContextNode(
00071 getConfigurationManager(),
00072 getContextUID()).getNode(
00073 contextConfig->colContext_.colAddress_).getValue<std::string>();
00074 }
00075
00076
00077 unsigned int Configurable::getContextPort() const
00078 {
00079 const XDAQContextConfiguration* contextConfig =
00080 getConfigurationManager()->__GET_CONFIG__(XDAQContextConfiguration);
00081
00082 return contextConfig->getContextNode(
00083 getConfigurationManager(),
00084 getContextUID()).getNode(
00085 contextConfig->colContext_.colPort_).getValue<unsigned int>();
00086 }