Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
dbutils::daqconfig::GeneralDataReader Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-25/DatabaseUtils/cxx/include/DAQConfig/GeneralDataReader.h"

Public Member Functions

 GeneralDataReader (const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename=0)
 
 GeneralDataReader (const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string &primarySelectionColumnName, const std::string *namesTableDefinitionFilename=0)
 
 GeneralDataReader (const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string &primarySelectionColumnName, const std::string &secondarySelectionColumnName, const std::string *namesTableDefinitionFilename=0)
 
 GeneralDataReader (const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string &primarySelectionColumnName, const std::string &secondarySelectionColumnName, const std::string &tertiarySelectionColumnName, const std::string *namesTableDefinitionFilename=0)
 
 GeneralDataReader (const std::string &tableDefinitionFilename, const std::vector< int64_t > &subsystemConfigIdList, const std::string *namesTableDefinitionFilename=0)
 
 GeneralDataReader (const std::string &tableDefinitionFilename, const std::vector< int64_t > &subsystemConfigIdList, const std::string &primarySelectionColumnName, const std::string *namesTableDefinitionFilename=0)
 
 GeneralDataReader (const std::string &tableDefinitionFilename, const std::vector< int64_t > &subsystemConfigIdList, const std::string &primarySelectionColumnName, const std::string &secondarySelectionColumnName, const std::string *namesTableDefinitionFilename=0)
 
 GeneralDataReader (const std::string &tableDefinitionFilename, const std::vector< int64_t > &subsystemConfigIdList, const std::string &primarySelectionColumnName, const std::string &secondarySelectionColumnName, const std::string &tertiarySelectionColumnName, const std::string *namesTableDefinitionFilename=0)
 
template<class T >
bool getValue (const std::string &columnName, T &resultValue)
 
template<class T , class U >
bool getValueFor1Key (const std::string &columnName, T &resultValue, const U &primarySelectionValue)
 
template<class T , class U , class V >
bool getValueFor2Keys (const std::string &columnName, T &resultValue, const U &primarySelectionValue, const V &secondarySelectionValue)
 
template<class T , class U , class V , class W >
bool getValueFor3Keys (const std::string &columnName, T &resultValue, const U &primarySelectionValue, const V &secondarySelectionValue, const W &tertiarySelectionValue)
 
template<class T , class U >
bool getListOfValuesFor2Keys (const std::string &columnName, std::vector< T > &resultValues, const U &primarySelectionValue, const uint32_t &secondarySelectionLowValue, const uint32_t &secondarySelectionHighValue)
 
template<class T , class U , class V >
bool getListOfValuesFor3Keys (const std::string &columnName, std::vector< T > &resultValues, const U &primarySelectionValue, const V &secondarySelectionValue, const uint32_t &tertiarySelectionLowValue, const uint32_t &tertiarySelectionHighValue)
 
template<class T , class U >
bool getDataSetFor2Keys (const std::string &columnName, SimpleDataSet< T > &resultDataSet, const U &primarySelectionValue, const uint32_t &secondarySelectionLowValue, const uint32_t &secondarySelectionHighValue)
 
template<class T , class U , class V >
bool getDataSetFor3Keys (const std::string &columnName, SimpleDataSet< T > &resultDataSet, const U &primarySelectionValue, const V &secondarySelectionValue, const uint32_t &tertiarySelectionLowValue, const uint32_t &tertiarySelectionHighValue)
 
template<class T , class U >
bool getSetOfValuesFor3Keys (const std::string &columnName, std::vector< boost::shared_ptr< std::vector< T > > > &resultValues, const U &primarySelectionValue, const uint32_t &secondarySelectionLowValue, const uint32_t &secondarySelectionHighValue, const uint32_t &tertiarySelectionLowValue, const uint32_t &tertiarySelectionHighValue)
 
template<class T , class U >
bool getDataSetMapFor3Keys (const std::string &columnName, std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &twoLevelDataSet, const U &primarySelectionValue, const uint32_t &secondarySelectionLowValue, const uint32_t &secondarySelectionHighValue, const uint32_t &tertiarySelectionLowValue, const uint32_t &tertiarySelectionHighValue)
 

Static Public Member Functions

template<class TT >
static std::vector< std::pair< uint64_t, TT > > remapValues (const std::vector< TT > &values, const uint32_t &indexOffset)
 

Private Member Functions

void _init (const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
 
template<class T >
bool _getValueForAllConfigs (const std::string &columnName, const std::vector< std::string > &selectionValues, T &resultValue)
 
template<class T >
bool _getValueForSingleConfig (const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, T &resultValue)
 
template<class T >
bool _getDefaultValue (const std::string &columnName, const uint64_t &configId, const std::vector< std::string > &selectionValues, T &resultValue)
 
template<class T >
bool _getValueFromDB (const std::string &columnName, const uint64_t &configId, const std::vector< std::string > &selectionValues, T &resultValue)
 
template<class T >
bool _getListOfValuesForAllConfigs (const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, std::vector< T > &resultValues)
 
template<class T >
bool _getListOfValuesForSingleConfig (const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &dataSet)
 
template<class T >
bool _getListOfValuesFromDB (const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &dataSet)
 
template<class T >
bool _getDataSetForAllConfigs (const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &resultDataSet)
 
template<class T >
bool _getSetOfValuesForAllConfigs (const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &firstLevelSelectionLowValue, const uint32_t &firstLevelSelectionHighValue, const uint32_t &secondLevelSelectionLowValue, const uint32_t &secondLevelSelectionHighValue, std::vector< boost::shared_ptr< std::vector< T > > > &resultValues)
 
template<class T >
bool _getSetOfValuesForSingleConfig (const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &firstLevelSelectionLowValue, const uint32_t &firstLevelSelectionHighValue, const uint32_t &secondLevelSelectionLowValue, const uint32_t &secondLevelSelectionHighValue, std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &twoLevelDataSet)
 
template<class T >
bool _getSetOfValuesFromDB (const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &firstLevelSelectionLowValue, const uint32_t &firstLevelSelectionHighValue, const uint32_t &secondLevelSelectionLowValue, const uint32_t &secondLevelSelectionHighValue, std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &twoLevelDataSet)
 
template<class T >
bool _getDataSetMapForAllConfigs (const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &firstLevelSelectionLowValue, const uint32_t &firstLevelSelectionHighValue, const uint32_t &secondLevelSelectionLowValue, const uint32_t &secondLevelSelectionHighValue, std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &twoLevelDataSet)
 
bool _setValidityRanges (const std::vector< std::string > &selectionValues, bool fillInDefaults=true)
 

Private Attributes

boost::shared_ptr< NOVADB::Table_dbTablePtr
 
bool _hasValidConnection
 
std::vector< std::string_selectionColumns
 
std::vector< int64_t > _namedConfigLineage
 
boost::mutex _dataMutex
 
std::string _globalDefault
 

Detailed Description

Class to handle fetching of DAQ configuration data from the database.

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

Definition at line 40 of file GeneralDataReader.h.

Constructor & Destructor Documentation

dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const uint64_t &  subsystemConfigId,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 16 of file GeneralDataReader.cpp.

References _init().

Referenced by GeneralDataReader().

19 {
20  _init(tableDefinitionFilename, subsystemConfigId,
21  namesTableDefinitionFilename);
22 }
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const uint64_t &  subsystemConfigId,
const std::string primarySelectionColumnName,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 29 of file GeneralDataReader.cpp.

References _init(), _selectionColumns, and GeneralDataReader().

33 {
34  _selectionColumns.push_back(primarySelectionColumnName);
35  _init(tableDefinitionFilename, subsystemConfigId,
36  namesTableDefinitionFilename);
37 }
std::vector< std::string > _selectionColumns
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const uint64_t &  subsystemConfigId,
const std::string primarySelectionColumnName,
const std::string secondarySelectionColumnName,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 44 of file GeneralDataReader.cpp.

References _init(), _selectionColumns, and GeneralDataReader().

49 {
50  _selectionColumns.push_back(primarySelectionColumnName);
51  _selectionColumns.push_back(secondarySelectionColumnName);
52  _init(tableDefinitionFilename, subsystemConfigId,
53  namesTableDefinitionFilename);
54 }
std::vector< std::string > _selectionColumns
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const uint64_t &  subsystemConfigId,
const std::string primarySelectionColumnName,
const std::string secondarySelectionColumnName,
const std::string tertiarySelectionColumnName,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 61 of file GeneralDataReader.cpp.

References _init(), _selectionColumns, and GeneralDataReader().

67 {
68  _selectionColumns.push_back(primarySelectionColumnName);
69  _selectionColumns.push_back(secondarySelectionColumnName);
70  _selectionColumns.push_back(tertiarySelectionColumnName);
71  _init(tableDefinitionFilename, subsystemConfigId,
72  namesTableDefinitionFilename);
73 }
std::vector< std::string > _selectionColumns
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const std::vector< int64_t > &  subsystemConfigIdList,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 80 of file GeneralDataReader.cpp.

References _init(), _namedConfigLineage, and GeneralDataReader().

83 {
84  _namedConfigLineage = subsystemConfigIdList;
85  _init(tableDefinitionFilename, 0, namesTableDefinitionFilename);
86 }
std::vector< int64_t > _namedConfigLineage
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const std::vector< int64_t > &  subsystemConfigIdList,
const std::string primarySelectionColumnName,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 93 of file GeneralDataReader.cpp.

References _init(), _namedConfigLineage, _selectionColumns, and GeneralDataReader().

97 {
98  _selectionColumns.push_back(primarySelectionColumnName);
99  _namedConfigLineage = subsystemConfigIdList;
100  _init(tableDefinitionFilename, 0, namesTableDefinitionFilename);
101 }
std::vector< int64_t > _namedConfigLineage
std::vector< std::string > _selectionColumns
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const std::vector< int64_t > &  subsystemConfigIdList,
const std::string primarySelectionColumnName,
const std::string secondarySelectionColumnName,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 108 of file GeneralDataReader.cpp.

References _init(), _namedConfigLineage, _selectionColumns, and GeneralDataReader().

113 {
114  _selectionColumns.push_back(primarySelectionColumnName);
115  _selectionColumns.push_back(secondarySelectionColumnName);
116  _namedConfigLineage = subsystemConfigIdList;
117  _init(tableDefinitionFilename, 0, namesTableDefinitionFilename);
118 }
std::vector< int64_t > _namedConfigLineage
std::vector< std::string > _selectionColumns
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)
dbutils::daqconfig::GeneralDataReader::GeneralDataReader ( const std::string tableDefinitionFilename,
const std::vector< int64_t > &  subsystemConfigIdList,
const std::string primarySelectionColumnName,
const std::string secondarySelectionColumnName,
const std::string tertiarySelectionColumnName,
const std::string namesTableDefinitionFilename = 0 
)

Constructs a data reader for the specified database table and named subsystem configuration.

Definition at line 125 of file GeneralDataReader.cpp.

References _init(), _namedConfigLineage, and _selectionColumns.

131 {
132  _selectionColumns.push_back(primarySelectionColumnName);
133  _selectionColumns.push_back(secondarySelectionColumnName);
134  _selectionColumns.push_back(tertiarySelectionColumnName);
135  _namedConfigLineage = subsystemConfigIdList;
136  _init(tableDefinitionFilename, 0, namesTableDefinitionFilename);
137 }
std::vector< int64_t > _namedConfigLineage
std::vector< std::string > _selectionColumns
void _init(const std::string &tableDefinitionFilename, const uint64_t &subsystemConfigId, const std::string *namesTableDefinitionFilename)

Member Function Documentation

template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getDataSetForAllConfigs ( const std::string columnName,
const std::vector< std::string > &  selectionValues,
const uint32_t &  fineGrainedSelectionLowValue,
const uint32_t &  fineGrainedSelectionHighValue,
SimpleDataSet< T > &  resultDataSet 
)
private

Fetches the requested values...

Definition at line 767 of file GeneralDataReader.h.

References _getSetOfValuesForAllConfigs(), dbutils::daqconfig::SimpleDataSet< T >::dataMap, compare_h5_caf::idx, and dbutils::daqconfig::SimpleDataSet< T >::numberOfValidValues.

Referenced by _getListOfValuesFromDB().

772 {
773  // require there to be an exact match between the number of
774  // selection columns and the number of selection values
775  // (including the fine-grained one)
776  if (selectionValues.size() != (_selectionColumns.size() - 1)) {
777  return false;
778  }
779 
780  // verify that the requested number of values is reasonable
781  if (fineGrainedSelectionLowValue > fineGrainedSelectionHighValue) {
782  return false;
783  }
784 
785  // if the requested number of values is one, simply call the
786  // single-value method?
787 
788  // initialize the resulting data set
789  resultDataSet.dataMap.clear();
790  resultDataSet.numberOfValidValues = 0;
791  for (uint32_t rdx = fineGrainedSelectionLowValue;
792  rdx <= fineGrainedSelectionHighValue; ++rdx) {
793  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
794  dataPtr.reset(new SimpleDataContainer<uint32_t, T>());
795  dataPtr->key = rdx;
796  dataPtr->hasValue = false;
797  resultDataSet.dataMap[rdx] = dataPtr;
798  }
799 
800  // loop over named configurations until we've found all of
801  // the requested values
802  for (uint32_t idx = 0; idx < _namedConfigLineage.size(); ++idx) {
803  if (! _getListOfValuesFromDB(columnName,
805  selectionValues,
806  fineGrainedSelectionLowValue,
807  fineGrainedSelectionHighValue,
808  resultDataSet)) {
809  return false;
810  }
811  }
812  return true;
813 }
bool _getListOfValuesFromDB(const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &dataSet)
std::vector< int64_t > _namedConfigLineage
std::vector< std::string > _selectionColumns
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getDataSetMapForAllConfigs ( const std::string columnName,
const std::vector< std::string > &  selectionValues,
const uint32_t &  firstLevelSelectionLowValue,
const uint32_t &  firstLevelSelectionHighValue,
const uint32_t &  secondLevelSelectionLowValue,
const uint32_t &  secondLevelSelectionHighValue,
std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &  twoLevelDataSet 
)
private
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getDefaultValue ( const std::string columnName,
const uint64_t &  configId,
const std::vector< std::string > &  selectionValues,
T resultValue 
)
private

Fetches the requested value...

Definition at line 567 of file GeneralDataReader.h.

References _getValueFromDB().

Referenced by _getValueForSingleConfig().

571 {
572  return _getValueFromDB(columnName, configId,
573  selectionValues, resultValue);
574 }
bool _getValueFromDB(const std::string &columnName, const uint64_t &configId, const std::vector< std::string > &selectionValues, T &resultValue)
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getListOfValuesForAllConfigs ( const std::string columnName,
const std::vector< std::string > &  selectionValues,
const uint32_t &  fineGrainedSelectionLowValue,
const uint32_t &  fineGrainedSelectionHighValue,
std::vector< T > &  resultValues 
)
private

Fetches the requested values...

Definition at line 608 of file GeneralDataReader.h.

References _getListOfValuesForSingleConfig(), dbutils::daqconfig::SimpleDataSet< T >::dataMap, compare_h5_caf::idx, dbutils::daqconfig::SimpleDataSet< T >::isComplete(), and dbutils::daqconfig::SimpleDataSet< T >::numberOfValidValues.

Referenced by _getValueFromDB().

613 {
614  // require there to be an exact match between the number of
615  // selection columns and the number of selection values
616  // (including the fine-grained one)
617  if (selectionValues.size() != (_selectionColumns.size() - 1)) {
618  return false;
619  }
620 
621  // verify that the requested number of values is reasonable
622  if (fineGrainedSelectionLowValue > fineGrainedSelectionHighValue) {
623  return false;
624  }
625 
626  // if the requested number of values is one, simply call the
627  // single-value method?
628 
629  // initialize the working list of values
630  SimpleDataSet<T> dataSet;
631  dataSet.numberOfValidValues = 0;
632  for (uint32_t rdx = fineGrainedSelectionLowValue;
633  rdx <= fineGrainedSelectionHighValue; ++rdx) {
634  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
635  dataPtr.reset(new SimpleDataContainer<uint32_t, T>());
636  dataPtr->key = rdx;
637  dataPtr->hasValue = false;
638  dataSet.dataMap[rdx] = dataPtr;
639  }
640 
641  // loop over named configurations until we've found all of
642  // the requested values
643  for (uint32_t idx = 0; idx < _namedConfigLineage.size(); ++idx) {
644  if (! _getListOfValuesForSingleConfig(columnName,
646  selectionValues,
647  fineGrainedSelectionLowValue,
648  fineGrainedSelectionHighValue,
649  dataSet)) {
650  return false;
651  }
652  if (dataSet.isComplete()) {
653  for (uint32_t rdx = fineGrainedSelectionLowValue;
654  rdx <= fineGrainedSelectionHighValue; ++rdx) {
655  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
656  dataPtr = dataSet.dataMap[rdx];
657  resultValues.push_back(dataPtr->value);
658  }
659  return true;
660  }
661  }
662  return false;
663 }
bool _getListOfValuesForSingleConfig(const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &dataSet)
std::vector< int64_t > _namedConfigLineage
std::vector< std::string > _selectionColumns
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getListOfValuesForSingleConfig ( const std::string columnName,
const uint64_t &  configId,
std::vector< std::string selectionValues,
const uint32_t &  fineGrainedSelectionLowValue,
const uint32_t &  fineGrainedSelectionHighValue,
SimpleDataSet< T > &  dataSet 
)
private

Fetches the requested values...

Definition at line 670 of file GeneralDataReader.h.

References _getListOfValuesFromDB(), dbutils::daqconfig::SimpleDataSet< T >::dataMap, modifyFHiCL::found, dbutils::daqconfig::SimpleDataSet< T >::isComplete(), dbutils::daqconfig::SimpleDataSet< T >::numberOfValidValues, and T.

Referenced by _getListOfValuesForAllConfigs().

676 {
677  if (! _getListOfValuesFromDB(columnName, configId,
678  selectionValues,
679  fineGrainedSelectionLowValue,
680  fineGrainedSelectionHighValue,
681  dataSet)) {
682  return false;
683  }
684  if (dataSet.isComplete()) {return true;}
685 
686  selectionValues.push_back("bogusEntry");
687  while (selectionValues.size() > 0) {
688  selectionValues.pop_back();
689  T resultValue;
690  bool found = _getDefaultValue(columnName, configId,
691  selectionValues,
692  resultValue);
693  if (found) {
694  for (uint32_t rdx = fineGrainedSelectionLowValue;
695  rdx <= fineGrainedSelectionHighValue; ++rdx) {
696  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
697  dataPtr = dataSet.dataMap[rdx];
698  if (! dataPtr->hasValue) {
699  dataPtr->value = resultValue;
700  dataPtr->hasValue = true;
701  ++dataSet.numberOfValidValues;
702  }
703  }
704  break;
705  }
706  }
707  return true;
708 }
bool _getListOfValuesFromDB(const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &dataSet)
double T
Definition: Xdiff_gwt.C:5
bool _getDefaultValue(const std::string &columnName, const uint64_t &configId, const std::vector< std::string > &selectionValues, T &resultValue)
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getListOfValuesFromDB ( const std::string columnName,
const uint64_t &  configId,
std::vector< std::string selectionValues,
const uint32_t &  fineGrainedSelectionLowValue,
const uint32_t &  fineGrainedSelectionHighValue,
SimpleDataSet< T > &  dataSet 
)
private

Fetches the requested values...

Definition at line 715 of file GeneralDataReader.h.

References _getDataSetForAllConfigs(), nova::database::Row::Col(), dbutils::daqconfig::SimpleDataSet< T >::dataMap, nova::database::Column::Get(), compare_h5_caf::idx, dbutils::daqconfig::SimpleDataSet< T >::numberOfValidValues, string, and T.

Referenced by _getListOfValuesForSingleConfig().

721 {
722  if (! _hasValidConnection) {return false;}
723  _dbTablePtr->Clear();
724  if (! _setValidityRanges(selectionValues, false)) {
725  return false;
726  }
727  std::string fineGrainedSelectionColumn =
729  _dbTablePtr->SetValidityRange(fineGrainedSelectionColumn,
730  fineGrainedSelectionLowValue,
731  fineGrainedSelectionHighValue);
732  _dbTablePtr->SetValidityRange("subsysCfgId", configId);
733  //_dbTablePtr->SetVerbosity(1);
734  if (_dbTablePtr->LoadFromDB()) {
735  for (int32_t idx = 0; idx < _dbTablePtr->NRow(); ++idx) {
736  NOVADB::Row* rowPtr = _dbTablePtr->GetRow(idx);
737  T resultValue;
738  NOVADB::Column* colPtr = rowPtr->Col(columnName);
739  if (! colPtr->Get(resultValue)) {
740  return false;
741  }
742 
743  int32_t selectionValue;
744  colPtr = rowPtr->Col(fineGrainedSelectionColumn);
745  if (! colPtr->Get(selectionValue)) {
746  return false;
747  }
748 
749  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
750  dataPtr = dataSet.dataMap[selectionValue];
751  if (! dataPtr->hasValue) {
752  dataPtr->value = resultValue;
753  dataPtr->hasValue = true;
754  ++dataSet.numberOfValidValues;
755  }
756  }
757  return true;
758  }
759  return false;
760 }
bool _setValidityRanges(const std::vector< std::string > &selectionValues, bool fillInDefaults=true)
boost::shared_ptr< NOVADB::Table > _dbTablePtr
bool Get(T &val) const
Definition: Column.h:53
std::vector< std::string > _selectionColumns
double T
Definition: Xdiff_gwt.C:5
Column & Col(int i)
Definition: Row.h:51
enum BeamMode string
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getSetOfValuesForAllConfigs ( const std::string columnName,
const std::vector< std::string > &  selectionValues,
const uint32_t &  firstLevelSelectionLowValue,
const uint32_t &  firstLevelSelectionHighValue,
const uint32_t &  secondLevelSelectionLowValue,
const uint32_t &  secondLevelSelectionHighValue,
std::vector< boost::shared_ptr< std::vector< T > > > &  resultValues 
)
private

Fetches the requested values...

Definition at line 820 of file GeneralDataReader.h.

References _getSetOfValuesForSingleConfig(), and compare_h5_caf::idx.

Referenced by _getDataSetForAllConfigs().

827 {
828  // require there to be an exact match between the number of
829  // selection columns and the number of selection values
830  // (including the multiple fine-grained ones)
831  if (selectionValues.size() != (_selectionColumns.size() - 2)) {
832  return false;
833  }
834 
835  // verify that the requested number of values is reasonable
836  if (firstLevelSelectionLowValue > firstLevelSelectionHighValue) {
837  return false;
838  }
839  if (secondLevelSelectionLowValue > secondLevelSelectionHighValue) {
840  return false;
841  }
842 
843  // if the requested number of values is one, simply call the
844  // single-value method?
845 
846  // initialize the working list of values
847  std::map<uint32_t, boost::shared_ptr<SimpleDataSet<T> > > twoLevelDataSet;
848  for (uint32_t idx = firstLevelSelectionLowValue;
849  idx <= firstLevelSelectionHighValue; ++idx) {
850  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
851  dataSetPtr.reset(new SimpleDataSet<T>());
852  dataSetPtr->numberOfValidValues = 0;
853  twoLevelDataSet[idx] = dataSetPtr;
854  for (uint32_t jdx = secondLevelSelectionLowValue;
855  jdx <= secondLevelSelectionHighValue; ++jdx) {
856  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
857  dataPtr.reset(new SimpleDataContainer<uint32_t, T>());
858  dataPtr->key = jdx;
859  dataPtr->hasValue = false;
860  dataSetPtr->dataMap[jdx] = dataPtr;
861  }
862  }
863 
864  // loop over named configurations until we've found all of
865  // the requested values
866  for (uint32_t idx = 0; idx < _namedConfigLineage.size(); ++idx) {
867  if (! _getSetOfValuesForSingleConfig(columnName,
869  selectionValues,
870  firstLevelSelectionLowValue,
871  firstLevelSelectionHighValue,
872  secondLevelSelectionLowValue,
873  secondLevelSelectionHighValue,
874  twoLevelDataSet)) {
875  return false;
876  }
877 
878  bool totallyComplete = true;
879  for (uint32_t idx = firstLevelSelectionLowValue;
880  idx <= firstLevelSelectionHighValue; ++idx) {
881  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
882  dataSetPtr = twoLevelDataSet[idx];
883  if (! dataSetPtr->isComplete()) {
884  totallyComplete = false;
885  break;
886  }
887  }
888  if (totallyComplete) {
889  for (uint32_t idx = firstLevelSelectionLowValue;
890  idx <= firstLevelSelectionHighValue; ++idx) {
891  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
892  dataSetPtr = twoLevelDataSet[idx];
893  boost::shared_ptr<std::vector<T> > secondLevelValues;
894  secondLevelValues.reset(new std::vector<T>());
895 
896  for (uint32_t jdx = secondLevelSelectionLowValue;
897  jdx <= secondLevelSelectionHighValue; ++jdx) {
898  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
899  dataPtr = dataSetPtr->dataMap[jdx];
900  secondLevelValues->push_back(dataPtr->value);
901  }
902 
903  resultValues.push_back(secondLevelValues);
904  }
905  return true;
906  }
907  }
908  return false;
909 }
bool _getSetOfValuesForSingleConfig(const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &firstLevelSelectionLowValue, const uint32_t &firstLevelSelectionHighValue, const uint32_t &secondLevelSelectionLowValue, const uint32_t &secondLevelSelectionHighValue, std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &twoLevelDataSet)
std::vector< int64_t > _namedConfigLineage
std::vector< std::string > _selectionColumns
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getSetOfValuesForSingleConfig ( const std::string columnName,
const uint64_t &  configId,
std::vector< std::string selectionValues,
const uint32_t &  firstLevelSelectionLowValue,
const uint32_t &  firstLevelSelectionHighValue,
const uint32_t &  secondLevelSelectionLowValue,
const uint32_t &  secondLevelSelectionHighValue,
std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &  twoLevelDataSet 
)
private

Fetches the requested values...

Definition at line 916 of file GeneralDataReader.h.

References _getSetOfValuesFromDB(), modifyFHiCL::found, compare_h5_caf::idx, and T.

Referenced by _getSetOfValuesForAllConfigs().

925 {
926  if (! _getSetOfValuesFromDB(columnName, configId,
927  selectionValues,
928  firstLevelSelectionLowValue,
929  firstLevelSelectionHighValue,
930  secondLevelSelectionLowValue,
931  secondLevelSelectionHighValue,
932  twoLevelDataSet)) {
933  return false;
934  }
935  bool totallyComplete = true;
936  for (uint32_t idx = firstLevelSelectionLowValue;
937  idx <= firstLevelSelectionHighValue; ++idx) {
938  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
939  dataSetPtr = twoLevelDataSet[idx];
940  if (! dataSetPtr->isComplete()) {
941  totallyComplete = false;
942  break;
943  }
944  }
945  if (totallyComplete) {return true;}
946 
947  for (uint32_t idx = firstLevelSelectionLowValue;
948  idx <= firstLevelSelectionHighValue; ++idx) {
949  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
950  dataSetPtr = twoLevelDataSet[idx];
951 
952  selectionValues.push_back(boost::lexical_cast<std::string>(idx));
953  T resultValue;
954  bool found = _getDefaultValue(columnName, configId,
955  selectionValues,
956  resultValue);
957  if (found) {
958  for (uint32_t jdx = secondLevelSelectionLowValue;
959  jdx <= secondLevelSelectionHighValue; ++jdx) {
960  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
961  dataPtr = dataSetPtr->dataMap[jdx];
962  if (! dataPtr->hasValue) {
963  dataPtr->value = resultValue;
964  dataPtr->hasValue = true;
965  ++dataSetPtr->numberOfValidValues;
966  }
967  }
968  }
969  selectionValues.pop_back();
970  }
971 
972  totallyComplete = true;
973  for (uint32_t idx = firstLevelSelectionLowValue;
974  idx <= firstLevelSelectionHighValue; ++idx) {
975  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
976  dataSetPtr = twoLevelDataSet[idx];
977  if (! dataSetPtr->isComplete()) {
978  totallyComplete = false;
979  break;
980  }
981  }
982  if (totallyComplete) {return true;}
983 
984  selectionValues.push_back("bogusEntry");
985  while (selectionValues.size() > 0) {
986  selectionValues.pop_back();
987  T resultValue;
988  bool found = _getDefaultValue(columnName, configId,
989  selectionValues,
990  resultValue);
991  if (found) {
992  for (uint32_t idx = firstLevelSelectionLowValue;
993  idx <= firstLevelSelectionHighValue; ++idx) {
994  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
995  dataSetPtr = twoLevelDataSet[idx];
996 
997  for (uint32_t jdx = secondLevelSelectionLowValue;
998  jdx <= secondLevelSelectionHighValue; ++jdx) {
999  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
1000  dataPtr = dataSetPtr->dataMap[jdx];
1001  if (! dataPtr->hasValue) {
1002  dataPtr->value = resultValue;
1003  dataPtr->hasValue = true;
1004  ++dataSetPtr->numberOfValidValues;
1005  }
1006  }
1007  }
1008  break;
1009  }
1010  }
1011  return true;
1012 }
bool _getSetOfValuesFromDB(const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, const uint32_t &firstLevelSelectionLowValue, const uint32_t &firstLevelSelectionHighValue, const uint32_t &secondLevelSelectionLowValue, const uint32_t &secondLevelSelectionHighValue, std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &twoLevelDataSet)
double T
Definition: Xdiff_gwt.C:5
bool _getDefaultValue(const std::string &columnName, const uint64_t &configId, const std::vector< std::string > &selectionValues, T &resultValue)
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getSetOfValuesFromDB ( const std::string columnName,
const uint64_t &  configId,
std::vector< std::string selectionValues,
const uint32_t &  firstLevelSelectionLowValue,
const uint32_t &  firstLevelSelectionHighValue,
const uint32_t &  secondLevelSelectionLowValue,
const uint32_t &  secondLevelSelectionHighValue,
std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &  twoLevelDataSet 
)
private

Fetches the requested values...

Definition at line 1019 of file GeneralDataReader.h.

References nova::database::Row::Col(), nova::database::Column::Get(), compare_h5_caf::idx, string, and T.

Referenced by _getSetOfValuesForSingleConfig().

1028 {
1029  if (! _hasValidConnection) {return false;}
1030  _dbTablePtr->Clear();
1031  if (! _setValidityRanges(selectionValues, false)) {
1032  return false;
1033  }
1034  std::string firstLevelSelectionColumn =
1036  _dbTablePtr->SetValidityRange(firstLevelSelectionColumn,
1037  firstLevelSelectionLowValue,
1038  firstLevelSelectionHighValue);
1039  std::string secondLevelSelectionColumn =
1041  _dbTablePtr->SetValidityRange(secondLevelSelectionColumn,
1042  secondLevelSelectionLowValue,
1043  secondLevelSelectionHighValue);
1044  _dbTablePtr->SetValidityRange("subsysCfgId", configId);
1045  //_dbTablePtr->SetVerbosity(1);
1046  if (_dbTablePtr->LoadFromDB()) {
1047  for (int32_t idx = 0; idx < _dbTablePtr->NRow(); ++idx) {
1048  NOVADB::Row* rowPtr = _dbTablePtr->GetRow(idx);
1049 
1050  T resultValue;
1051  NOVADB::Column* colPtr = rowPtr->Col(columnName);
1052  if (! colPtr->Get(resultValue)) {
1053  return false;
1054  }
1055 
1056  int32_t firstSelectionValue;
1057  colPtr = rowPtr->Col(firstLevelSelectionColumn);
1058  if (! colPtr->Get(firstSelectionValue)) {
1059  return false;
1060  }
1061 
1062  int32_t secondSelectionValue;
1063  colPtr = rowPtr->Col(secondLevelSelectionColumn);
1064  if (! colPtr->Get(secondSelectionValue)) {
1065  return false;
1066  }
1067 
1068  boost::shared_ptr<SimpleDataSet<T> > dataSetPtr;
1069  dataSetPtr = twoLevelDataSet[firstSelectionValue];
1070 
1071  boost::shared_ptr<SimpleDataContainer<uint32_t, T> > dataPtr;
1072  dataPtr = dataSetPtr->dataMap[secondSelectionValue];
1073  if (! dataPtr->hasValue) {
1074  dataPtr->value = resultValue;
1075  dataPtr->hasValue = true;
1076  ++dataSetPtr->numberOfValidValues;
1077  }
1078  }
1079  return true;
1080  }
1081  return false;
1082 }
bool _setValidityRanges(const std::vector< std::string > &selectionValues, bool fillInDefaults=true)
boost::shared_ptr< NOVADB::Table > _dbTablePtr
bool Get(T &val) const
Definition: Column.h:53
std::vector< std::string > _selectionColumns
double T
Definition: Xdiff_gwt.C:5
Column & Col(int i)
Definition: Row.h:51
enum BeamMode string
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getValueForAllConfigs ( const std::string columnName,
const std::vector< std::string > &  selectionValues,
T resultValue 
)
private

Fetches the requested value...

Definition at line 514 of file GeneralDataReader.h.

References _getValueForSingleConfig(), and compare_h5_caf::idx.

Referenced by remapValues().

517 {
518  for (uint32_t idx = 0; idx < _namedConfigLineage.size(); ++idx) {
519  if (_getValueForSingleConfig(columnName,
521  selectionValues,
522  resultValue)) {
523  return true;
524  }
525  }
526  return false;
527 }
bool _getValueForSingleConfig(const std::string &columnName, const uint64_t &configId, std::vector< std::string > selectionValues, T &resultValue)
std::vector< int64_t > _namedConfigLineage
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getValueForSingleConfig ( const std::string columnName,
const uint64_t &  configId,
std::vector< std::string selectionValues,
T resultValue 
)
private

Fetches the requested value...

Definition at line 534 of file GeneralDataReader.h.

References _getDefaultValue(), and modifyFHiCL::found.

Referenced by _getValueForAllConfigs().

538 {
539  if (_getValueFromDB(columnName, configId,
540  selectionValues, resultValue)) {
541  return true;
542  }
543  while (selectionValues.size() > 0) {
544  selectionValues.pop_back();
545  //if (selectionValues.size() == 0 && _globalDefault.size() > 0) {
546  // resultValue = boost::lexical_cast<T>(_globalDefault);
547  // return true;
548  //}
549  //else {
550  bool found = _getDefaultValue(columnName, configId,
551  selectionValues,
552  resultValue);
553  //if (_globalDefault.size() == 0 && selectionValues.size() == 0) {
554  // _globalDefault = boost::lexical_cast<std::string>(resultValue);
555  //}
556  if (found) {return true;}
557  //}
558  }
559  return false;
560 }
bool _getDefaultValue(const std::string &columnName, const uint64_t &configId, const std::vector< std::string > &selectionValues, T &resultValue)
bool _getValueFromDB(const std::string &columnName, const uint64_t &configId, const std::vector< std::string > &selectionValues, T &resultValue)
template<class T >
bool dbutils::daqconfig::GeneralDataReader::_getValueFromDB ( const std::string columnName,
const uint64_t &  configId,
const std::vector< std::string > &  selectionValues,
T resultValue 
)
private

Fetches the requested value...

Definition at line 581 of file GeneralDataReader.h.

References _getListOfValuesForAllConfigs(), nova::database::Row::Col(), and nova::database::Column::Get().

Referenced by _getDefaultValue().

585 {
586  if (! _hasValidConnection) {return false;}
587  _dbTablePtr->Clear();
588  if (! _setValidityRanges(selectionValues)) {
589  return false;
590  }
591  _dbTablePtr->SetValidityRange("subsysCfgId", configId);
592  if (_dbTablePtr->LoadFromDB()) {
593  if (_dbTablePtr->NRow() == 1) {
594  NOVADB::Row* rowPtr = _dbTablePtr->GetRow(0);
595  NOVADB::Column* colPtr = rowPtr->Col(columnName);
596  if (colPtr == 0) {return false;}
597  return colPtr->Get(resultValue);
598  }
599  }
600  return false;
601 }
bool _setValidityRanges(const std::vector< std::string > &selectionValues, bool fillInDefaults=true)
boost::shared_ptr< NOVADB::Table > _dbTablePtr
bool Get(T &val) const
Definition: Column.h:53
Column & Col(int i)
Definition: Row.h:51
void dbutils::daqconfig::GeneralDataReader::_init ( const std::string tableDefinitionFilename,
const uint64_t &  subsystemConfigId,
const std::string namesTableDefinitionFilename 
)
private

Handles the necessary internal initialization at construction time.

Definition at line 142 of file GeneralDataReader.cpp.

References _dbTablePtr, _hasValidConnection, _namedConfigLineage, _setValidityRanges(), dbutils::daqconfig::IDSpec::DAQ, dbutils::daqconfig::NamedConfigUtils::getConfigIdAncestry(), and dbutils::daqconfig::IDSpec::SUBSYSTEM.

Referenced by GeneralDataReader().

145 {
146  _hasValidConnection = false;
147  _dbTablePtr.reset(new NOVADB::Table(tableDefinitionFilename.c_str()));
148  if (_dbTablePtr->GetConnection()) {
149  if (_dbTablePtr->ExistsInDB()) {
150  _hasValidConnection = true;
151  }
152  }
153 
154  if (_namedConfigLineage.size() == 0) {
155  IDSpec idSpec(subsystemConfigId, IDSpec::SUBSYSTEM, IDSpec::DAQ);
156  if (namesTableDefinitionFilename != 0) {
159  *namesTableDefinitionFilename);
160  }
161  else {
164  }
165  }
166 }
static bool getConfigIdAncestry(const IDSpec &idSpec, std::vector< int64_t > &idList, const std::string &tableFile=DEFAULT_GLOBAL_NAMES_TABLE_FILE)
boost::shared_ptr< NOVADB::Table > _dbTablePtr
std::vector< int64_t > _namedConfigLineage
bool dbutils::daqconfig::GeneralDataReader::_setValidityRanges ( const std::vector< std::string > &  selectionValues,
bool  fillInDefaults = true 
)
private

Does the work of setting the validity ranges in the database table object based on the selection columns and values stored in the data members of this class.

Definition at line 174 of file GeneralDataReader.cpp.

References _dbTablePtr, _hasValidConnection, _selectionColumns, dbutils::daqconfig::DBColumnParams::getInstance(), compare_h5_caf::idx, and string.

Referenced by _init().

176 {
177  if (! _hasValidConnection) {return false;}
178  for (uint32_t idx = 0; idx < _selectionColumns.size(); ++idx) {
179  if (selectionValues.size() > idx) {
180  if (! _dbTablePtr->SetValidityRange(_selectionColumns[idx],
181  selectionValues[idx])) {
182  return false;
183  }
184  }
185  else if (fillInDefaults) {
186  std::string defaultValue;
187  DBColumnParams& params = DBColumnParams::getInstance();
188  if (! params.
189  columnKeyToGetDefaultValue(_selectionColumns[idx],
190  defaultValue)) {
191  return false;
192  }
193  if (! _dbTablePtr->SetValidityRange(_selectionColumns[idx],
194  defaultValue)) {
195  return false;
196  }
197  }
198  }
199  return true;
200 }
boost::shared_ptr< NOVADB::Table > _dbTablePtr
static DBColumnParams & getInstance()
std::vector< std::string > _selectionColumns
enum BeamMode string
template<class T , class U >
bool dbutils::daqconfig::GeneralDataReader::getDataSetFor2Keys ( const std::string columnName,
SimpleDataSet< T > &  resultDataSet,
const U &  primarySelectionValue,
const uint32_t &  secondarySelectionLowValue,
const uint32_t &  secondarySelectionHighValue 
)

Fetches the requested values...

Definition at line 415 of file GeneralDataReader.h.

References getDataSetFor3Keys(), and datagram_client::sl.

Referenced by getListOfValuesFor3Keys().

420 {
421  boost::mutex::scoped_lock sl(_dataMutex);
422  std::vector<std::string> selectionValues;
423  selectionValues.push_back(boost::lexical_cast<std::string>
424  (primarySelectionValue));
425  return _getDataSetForAllConfigs(columnName, selectionValues,
426  secondarySelectionLowValue,
427  secondarySelectionHighValue,
428  resultDataSet);
429 }
bool _getDataSetForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &resultDataSet)
template<class T , class U , class V >
bool dbutils::daqconfig::GeneralDataReader::getDataSetFor3Keys ( const std::string columnName,
SimpleDataSet< T > &  resultDataSet,
const U &  primarySelectionValue,
const V &  secondarySelectionValue,
const uint32_t &  tertiarySelectionLowValue,
const uint32_t &  tertiarySelectionHighValue 
)

Fetches the requested values...

Definition at line 436 of file GeneralDataReader.h.

References getSetOfValuesFor3Keys(), and datagram_client::sl.

Referenced by getDataSetFor2Keys().

442 {
443  boost::mutex::scoped_lock sl(_dataMutex);
444  std::vector<std::string> selectionValues;
445  selectionValues.push_back(boost::lexical_cast<std::string>
446  (primarySelectionValue));
447  selectionValues.push_back(boost::lexical_cast<std::string>
448  (secondarySelectionValue));
449  return _getDataSetForAllConfigs(columnName, selectionValues,
450  tertiarySelectionLowValue,
451  tertiarySelectionHighValue,
452  resultDataSet);
453 }
bool _getDataSetForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, SimpleDataSet< T > &resultDataSet)
template<class T , class U >
bool dbutils::daqconfig::GeneralDataReader::getDataSetMapFor3Keys ( const std::string columnName,
std::map< uint32_t, boost::shared_ptr< SimpleDataSet< T > > > &  twoLevelDataSet,
const U &  primarySelectionValue,
const uint32_t &  secondarySelectionLowValue,
const uint32_t &  secondarySelectionHighValue,
const uint32_t &  tertiarySelectionLowValue,
const uint32_t &  tertiarySelectionHighValue 
)
template<class T , class U >
bool dbutils::daqconfig::GeneralDataReader::getListOfValuesFor2Keys ( const std::string columnName,
std::vector< T > &  resultValues,
const U &  primarySelectionValue,
const uint32_t &  secondarySelectionLowValue,
const uint32_t &  secondarySelectionHighValue 
)

Fetches the requested values...

Definition at line 370 of file GeneralDataReader.h.

References getListOfValuesFor3Keys(), and datagram_client::sl.

Referenced by getValueFor3Keys().

375 {
376  boost::mutex::scoped_lock sl(_dataMutex);
377  std::vector<std::string> selectionValues;
378  selectionValues.push_back(boost::lexical_cast<std::string>
379  (primarySelectionValue));
380  return _getListOfValuesForAllConfigs(columnName, selectionValues,
381  secondarySelectionLowValue,
382  secondarySelectionHighValue,
383  resultValues);
384 }
bool _getListOfValuesForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, std::vector< T > &resultValues)
template<class T , class U , class V >
bool dbutils::daqconfig::GeneralDataReader::getListOfValuesFor3Keys ( const std::string columnName,
std::vector< T > &  resultValues,
const U &  primarySelectionValue,
const V &  secondarySelectionValue,
const uint32_t &  tertiarySelectionLowValue,
const uint32_t &  tertiarySelectionHighValue 
)

Fetches the requested values...

Definition at line 391 of file GeneralDataReader.h.

References getDataSetFor2Keys(), and datagram_client::sl.

Referenced by getListOfValuesFor2Keys().

397 {
398  boost::mutex::scoped_lock sl(_dataMutex);
399  std::vector<std::string> selectionValues;
400  selectionValues.push_back(boost::lexical_cast<std::string>
401  (primarySelectionValue));
402  selectionValues.push_back(boost::lexical_cast<std::string>
403  (secondarySelectionValue));
404  return _getListOfValuesForAllConfigs(columnName, selectionValues,
405  tertiarySelectionLowValue,
406  tertiarySelectionHighValue,
407  resultValues);
408 }
bool _getListOfValuesForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &fineGrainedSelectionLowValue, const uint32_t &fineGrainedSelectionHighValue, std::vector< T > &resultValues)
template<class T , class U >
bool dbutils::daqconfig::GeneralDataReader::getSetOfValuesFor3Keys ( const std::string columnName,
std::vector< boost::shared_ptr< std::vector< T > > > &  resultValues,
const U &  primarySelectionValue,
const uint32_t &  secondarySelectionLowValue,
const uint32_t &  secondarySelectionHighValue,
const uint32_t &  tertiarySelectionLowValue,
const uint32_t &  tertiarySelectionHighValue 
)

Fetches the requested values...

Definition at line 460 of file GeneralDataReader.h.

References remapValues(), and datagram_client::sl.

Referenced by getDataSetFor3Keys().

468 {
469  boost::mutex::scoped_lock sl(_dataMutex);
470  std::vector<std::string> selectionValues;
471  selectionValues.push_back(boost::lexical_cast<std::string>
472  (primarySelectionValue));
473  return _getSetOfValuesForAllConfigs(columnName, selectionValues,
474  secondarySelectionLowValue,
475  secondarySelectionHighValue,
476  tertiarySelectionLowValue,
477  tertiarySelectionHighValue,
478  resultValues);
479 }
bool _getSetOfValuesForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, const uint32_t &firstLevelSelectionLowValue, const uint32_t &firstLevelSelectionHighValue, const uint32_t &secondLevelSelectionLowValue, const uint32_t &secondLevelSelectionHighValue, std::vector< boost::shared_ptr< std::vector< T > > > &resultValues)
template<class T >
bool dbutils::daqconfig::GeneralDataReader::getValue ( const std::string columnName,
T resultValue 
)

Fetches the requested value...

Definition at line 304 of file GeneralDataReader.h.

References getValueFor1Key(), and datagram_client::sl.

305 {
306  boost::mutex::scoped_lock sl(_dataMutex);
307  std::vector<std::string> selectionValues;
308  return _getValueForAllConfigs(columnName, selectionValues, resultValue);
309 }
bool _getValueForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, T &resultValue)
template<class T , class U >
bool dbutils::daqconfig::GeneralDataReader::getValueFor1Key ( const std::string columnName,
T resultValue,
const U &  primarySelectionValue 
)

Fetches the requested value...

Definition at line 316 of file GeneralDataReader.h.

References getValueFor2Keys(), and datagram_client::sl.

Referenced by getValue().

318 {
319  boost::mutex::scoped_lock sl(_dataMutex);
320  std::vector<std::string> selectionValues;
321  selectionValues.push_back(boost::lexical_cast<std::string>
322  (primarySelectionValue));
323  return _getValueForAllConfigs(columnName, selectionValues, resultValue);
324 }
bool _getValueForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, T &resultValue)
template<class T , class U , class V >
bool dbutils::daqconfig::GeneralDataReader::getValueFor2Keys ( const std::string columnName,
T resultValue,
const U &  primarySelectionValue,
const V &  secondarySelectionValue 
)

Fetches the requested value...

Definition at line 331 of file GeneralDataReader.h.

References getValueFor3Keys(), and datagram_client::sl.

Referenced by getValueFor1Key().

334 {
335  boost::mutex::scoped_lock sl(_dataMutex);
336  std::vector<std::string> selectionValues;
337  selectionValues.push_back(boost::lexical_cast<std::string>
338  (primarySelectionValue));
339  selectionValues.push_back(boost::lexical_cast<std::string>
340  (secondarySelectionValue));
341  return _getValueForAllConfigs(columnName, selectionValues, resultValue);
342 }
bool _getValueForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, T &resultValue)
template<class T , class U , class V , class W >
bool dbutils::daqconfig::GeneralDataReader::getValueFor3Keys ( const std::string columnName,
T resultValue,
const U &  primarySelectionValue,
const V &  secondarySelectionValue,
const W tertiarySelectionValue 
)

Fetches the requested value...

Definition at line 349 of file GeneralDataReader.h.

References getListOfValuesFor2Keys(), and datagram_client::sl.

Referenced by getValueFor2Keys().

353 {
354  boost::mutex::scoped_lock sl(_dataMutex);
355  std::vector<std::string> selectionValues;
356  selectionValues.push_back(boost::lexical_cast<std::string>
357  (primarySelectionValue));
358  selectionValues.push_back(boost::lexical_cast<std::string>
359  (secondarySelectionValue));
360  selectionValues.push_back(boost::lexical_cast<std::string>
361  (tertiarySelectionValue));
362  return _getValueForAllConfigs(columnName, selectionValues, resultValue);
363 }
bool _getValueForAllConfigs(const std::string &columnName, const std::vector< std::string > &selectionValues, T &resultValue)
template<class TT >
std::vector< std::pair< uint64_t, TT > > dbutils::daqconfig::GeneralDataReader::remapValues ( const std::vector< TT > &  values,
const uint32_t &  indexOffset 
)
static

Definition at line 484 of file GeneralDataReader.h.

References _getValueForAllConfigs(), modifyFHiCL::found, compare_h5_caf::idx, make_pair(), and moon_position_table_new3::second.

Referenced by getSetOfValuesFor3Keys().

486 {
487  std::vector<std::pair<uint64_t, TT> > resultList;
488  for (uint32_t idx = 0; idx < values.size(); ++idx) {
489  uint32_t bitIndex = idx + indexOffset;
490  TT value = values[idx];
491  bool found = false;
492 
493  for (uint32_t jdx = 0; jdx < resultList.size(); ++jdx) {
494  if (resultList[jdx].second == value) {
495  resultList[jdx].first |= ((uint64_t) 1) << bitIndex;
496  found = true;
497  break;
498  }
499  }
500 
501  if (! found) {
502  uint64_t workingBitmap = ((uint64_t) 1) << bitIndex;
503  resultList.push_back(std::make_pair(workingBitmap, value));
504  }
505  }
506  return resultList;
507 }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
const XML_Char int const XML_Char * value
Definition: expat.h:331

Member Data Documentation

boost::mutex dbutils::daqconfig::GeneralDataReader::_dataMutex
mutableprivate

Definition at line 294 of file GeneralDataReader.h.

boost::shared_ptr<NOVADB::Table> dbutils::daqconfig::GeneralDataReader::_dbTablePtr
private

Definition at line 288 of file GeneralDataReader.h.

Referenced by _init(), and _setValidityRanges().

std::string dbutils::daqconfig::GeneralDataReader::_globalDefault
private

Definition at line 296 of file GeneralDataReader.h.

bool dbutils::daqconfig::GeneralDataReader::_hasValidConnection
private

Definition at line 289 of file GeneralDataReader.h.

Referenced by _init(), and _setValidityRanges().

std::vector<int64_t> dbutils::daqconfig::GeneralDataReader::_namedConfigLineage
private

Definition at line 292 of file GeneralDataReader.h.

Referenced by _init(), and GeneralDataReader().

std::vector<std::string> dbutils::daqconfig::GeneralDataReader::_selectionColumns
private

Definition at line 291 of file GeneralDataReader.h.

Referenced by _setValidityRanges(), and GeneralDataReader().


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