Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dbutils::daqconfig::BNEVBRunConfig Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-01/DatabaseUtils/cxx/include/DAQConfig/BNEVBRunConfig.h"

Public Member Functions

 BNEVBRunConfig (const std::vector< int64_t > &subsystemConfigIdList)
 
 BNEVBRunConfig (const SubsystemNameSpec &nameSpec)
 
 BNEVBRunConfig (const GlobalNameSpec &nameSpec)
 
 BNEVBRunConfig (const int64_t &globalConfigId)
 
virtual ~BNEVBRunConfig ()
 
virtual bool hasValidData () const
 
int64_t getPrimarySubsystemConfigId () const
 
double getPoolSizeSeconds ()
 

Protected Member Functions

bool _fetchAllData (const std::vector< int64_t > &subsystemConfigIdList)
 
bool _fetchSystemData (const std::string &tableDefinitionFileName, const int64_t &subsystemConfigId)
 

Protected Attributes

bool _hasValidData
 
int64_t _primarySubsystemConfigId
 
double _poolSizeSeconds
 

Detailed Description

Worker class to handle fetching of BufferNodeEVB run configuration data.

Author
Kurt Biery
Version
Revision
1.1.14.1
Date
2019/09/27 00:07:03

Definition at line 22 of file BNEVBRunConfig.h.

Constructor & Destructor Documentation

dbutils::daqconfig::BNEVBRunConfig::BNEVBRunConfig ( const std::vector< int64_t > &  subsystemConfigIdList)

Creates a BufferNodeEVB run configuration object from the specified list of subsystem configuration IDs.

Parameters
subsystemConfigIdListThe list of subsystem configuration IDs.
dcmNameThe name of the DCM of interest.

Definition at line 23 of file BNEVBRunConfig.cpp.

References _fetchAllData(), _hasValidData, and _primarySubsystemConfigId.

24 {
26  if (subsystemConfigIdList.size() > 0) {
27  _primarySubsystemConfigId = subsystemConfigIdList[0];
28  _hasValidData = _fetchAllData(subsystemConfigIdList);
29  }
30  else {
31  _hasValidData = false;
32  }
33 }
bool _fetchAllData(const std::vector< int64_t > &subsystemConfigIdList)
dbutils::daqconfig::BNEVBRunConfig::BNEVBRunConfig ( const SubsystemNameSpec nameSpec)

Creates a BufferNodeEVB run configuration object from the specified subsystem configuration specification.

Parameters
nameSpecThe named configuration of interest.

Definition at line 41 of file BNEVBRunConfig.cpp.

References _fetchAllData(), _hasValidData, and _primarySubsystemConfigId.

42 {
44  std::vector<int64_t> subsystemConfigIdList;
45  if (NamedConfigUtils::
46  getSubsystemConfigIdAncestry(nameSpec, subsystemConfigIdList)) {
47  _primarySubsystemConfigId = subsystemConfigIdList[0];
48  _hasValidData = _fetchAllData(subsystemConfigIdList);
49  }
50  else {
51  _hasValidData = false;
52  }
53 }
bool _fetchAllData(const std::vector< int64_t > &subsystemConfigIdList)
dbutils::daqconfig::BNEVBRunConfig::BNEVBRunConfig ( const GlobalNameSpec nameSpec)

Creates a BufferNodeEVB run configuration object from the specified global configuration specification.

Parameters
nameSpecThe named configuration of interest.

Definition at line 61 of file BNEVBRunConfig.cpp.

References _fetchAllData(), _hasValidData, _primarySubsystemConfigId, dbutils::daqconfig::IDSpec::DAQ, dbutils::daqconfig::NamedConfigUtils::getConfigIdAncestry(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdFromGlobalName(), fabricate::status, and dbutils::daqconfig::IDSpec::SUBSYSTEM.

62 {
64  int64_t subsystemConfigId;
67  SubsystemNameSpec::
68  BNEVB_SUBSYSTEM_NAME,
69  SubsystemNameSpec::
70  RUN_CONFIG_TYPE,
71  subsystemConfigId);
72 
73  std::vector<int64_t> subsystemConfigIdList;
74  if (status) {
75  IDSpec idSpec(subsystemConfigId, IDSpec::SUBSYSTEM, IDSpec::DAQ);
76  status = NamedConfigUtils::
77  getConfigIdAncestry(idSpec, subsystemConfigIdList);
78  }
79 
80  if (status) {
81  _primarySubsystemConfigId = subsystemConfigIdList[0];
82  _hasValidData = _fetchAllData(subsystemConfigIdList);
83  }
84  else {
85  _hasValidData = false;
86  }
87 }
int status
Definition: fabricate.py:1613
static bool getConfigIdAncestry(const IDSpec &idSpec, std::vector< int64_t > &idList, const std::string &tableFile=DEFAULT_GLOBAL_NAMES_TABLE_FILE)
static bool getSubsystemConfigIdFromGlobalName(const GlobalNameSpec &globalNameSpec, const std::string &subsystemName, const std::string &subsystemConfigType, int64_t &subsystemConfigId, const std::string &globalNamesTableFile=DEFAULT_GLOBAL_NAMES_TABLE_FILE, const std::string &subsystemNamesTableFile=DEFAULT_SUBSYSTEM_NAMES_TABLE_FILE)
bool _fetchAllData(const std::vector< int64_t > &subsystemConfigIdList)
dbutils::daqconfig::BNEVBRunConfig::BNEVBRunConfig ( const int64_t &  globalConfigId)

Creates a BufferNodeEVB run configuration object from the specified global configuration ID.

Parameters
globalConfigIdThe ID of the global configuration of interest.

Definition at line 95 of file BNEVBRunConfig.cpp.

References _fetchAllData(), _hasValidData, _primarySubsystemConfigId, dbutils::daqconfig::IDSpec::DAQ, and dbutils::daqconfig::IDSpec::GLOBAL.

96 {
97  IDSpec idSpec(globalConfigId, IDSpec::GLOBAL, IDSpec::DAQ);
99  std::vector<int64_t> subsystemConfigIdList;
100  if (NamedConfigUtils::
101  getSubsystemConfigIdAncestryFromGlobalId(idSpec,
102  SubsystemNameSpec::
103  BNEVB_SUBSYSTEM_NAME,
104  SubsystemNameSpec::
105  RUN_CONFIG_TYPE,
106  subsystemConfigIdList)) {
107  _primarySubsystemConfigId = subsystemConfigIdList[0];
108  _hasValidData = _fetchAllData(subsystemConfigIdList);
109  }
110  else {
111  _hasValidData = false;
112  }
113 }
bool _fetchAllData(const std::vector< int64_t > &subsystemConfigIdList)
virtual dbutils::daqconfig::BNEVBRunConfig::~BNEVBRunConfig ( )
inlinevirtual

Definition at line 38 of file BNEVBRunConfig.h.

38 {};

Member Function Documentation

bool dbutils::daqconfig::BNEVBRunConfig::_fetchAllData ( const std::vector< int64_t > &  subsystemConfigIdList)
protected

Definition at line 116 of file BNEVBRunConfig.cpp.

References _fetchSystemData(), plot_validation_datamc::fname, fabricate::status, and string.

Referenced by BNEVBRunConfig(), and getPoolSizeSeconds().

117 {
118  bool status = true;
120 
121  // for the BNEVB configuration, inheritance is not used,
122  // so only the first subsystem ID is relevant
123  int64_t subsystemConfigId = subsystemConfigIdList[0];
124 
125  if (status) {
126  fname = "NovaDatabase/tables/DAQConfig/BNEVBRunParameters.xml";
127  status = _fetchSystemData(fname, subsystemConfigId);
128  }
129 
130  return status;
131 }
bool _fetchSystemData(const std::string &tableDefinitionFileName, const int64_t &subsystemConfigId)
int status
Definition: fabricate.py:1613
enum BeamMode string
bool dbutils::daqconfig::BNEVBRunConfig::_fetchSystemData ( const std::string tableDefinitionFileName,
const int64_t &  subsystemConfigId 
)
protected

Definition at line 134 of file BNEVBRunConfig.cpp.

References _poolSizeSeconds, nova::database::Row::Col(), mkDefs::detName, nova::database::Column::Get(), novadaq::EnvVarCache::getEnvVar(), novadaq::EnvVarCache::getInstance(), string, and dbutils::daqconfig::NamedConfigUtils::SUBSYSCFGID_COLUMN_NAME.

Referenced by _fetchAllData(), and getPoolSizeSeconds().

136 {
137  boost::shared_ptr<NOVADB::Table> dbt;
138  dbt.reset(new NOVADB::Table(tableDefinitionFileName));
140  novadaq::EnvVarCache::getInstance().getEnvVar("NOVADAQ_ENVIRONMENT");
141  dbt->SetDetector(detName);
142  std::string dbUser =
143  novadaq::EnvVarCache::getInstance().getEnvVar("CFGMGR_DB_USER");
144  if (dbUser.length() > 0) {dbt->SetUser(dbUser);}
145  if (! dbt->GetConnection()) {return false;}
146  if (! dbt->ExistsInDB()) {return false;}
147 
148  dbt->Clear();
149  dbt->SetValidityRange(NamedConfigUtils::SUBSYSCFGID_COLUMN_NAME,
150  subsystemConfigId);
151  if (! dbt->LoadFromDB()) {return false;}
152 
153  if (dbt->NRow() != 1) {return false;}
154 
155  NOVADB::Row* rowPtr = dbt->GetRow(0);
156  NOVADB::Column* colPtr = rowPtr->Col("poolSizeSeconds");
157  if (! colPtr->Get(_poolSizeSeconds)) {
158  return false;
159  }
160 
161  return true;
162 }
static EnvVarCache & getInstance()
Definition: EnvVarCache.cpp:12
bool Get(T &val) const
Definition: Column.h:53
std::string getEnvVar(std::string name)
Definition: EnvVarCache.cpp:33
static const std::string SUBSYSCFGID_COLUMN_NAME
detName
Definition: mkDefs.py:106
Column & Col(int i)
Definition: Row.h:51
enum BeamMode string
double dbutils::daqconfig::BNEVBRunConfig::getPoolSizeSeconds ( )
inline
int64_t dbutils::daqconfig::BNEVBRunConfig::getPrimarySubsystemConfigId ( ) const
inline

Definition at line 45 of file BNEVBRunConfig.h.

References _primarySubsystemConfigId.

virtual bool dbutils::daqconfig::BNEVBRunConfig::hasValidData ( ) const
inlinevirtual

Definition at line 44 of file BNEVBRunConfig.h.

References _hasValidData.

Member Data Documentation

bool dbutils::daqconfig::BNEVBRunConfig::_hasValidData
protected

Definition at line 56 of file BNEVBRunConfig.h.

Referenced by BNEVBRunConfig(), and hasValidData().

double dbutils::daqconfig::BNEVBRunConfig::_poolSizeSeconds
protected

Definition at line 59 of file BNEVBRunConfig.h.

Referenced by _fetchSystemData(), and getPoolSizeSeconds().

int64_t dbutils::daqconfig::BNEVBRunConfig::_primarySubsystemConfigId
protected

Definition at line 57 of file BNEVBRunConfig.h.

Referenced by BNEVBRunConfig(), and getPrimarySubsystemConfigId().


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