1 #ifndef _ots_ConfigurationInterface_h_
2 #define _ots_ConfigurationInterface_h_
8 #include "otsdaq/Macros/CoutMacros.h"
10 #include "otsdaq/TableCore/MakeTable.h"
11 #include "otsdaq/TableCore/TableBase.h"
12 #include "otsdaq/TableCore/TableGroupKey.h"
13 #include "otsdaq/TableCore/TableVersion.h"
14 #include "otsdaq/TableCore/TableView.h"
20 class ConfigurationHandlerBase;
32 enum class CONFIGURATION_MODE
40 static bool isVersionTrackingEnabled (
void);
41 static void setVersionTrackingEnabled (
bool setValue);
43 static const std::string GROUP_METADATA_TABLE_NAME;
46 #include "otsdaq/ConfigurationInterface/ConfigurationInterface.icc"
47 virtual std::set<std::string >
getAllTableNames (
void)
const { __SS__; __THROW__(ss.str() +
"ConfigurationInterface::... Must only call getAllTableNames in a mode with this functionality implemented (e.g. DatabaseConfigurationInterface)."); }
48 virtual std::set<TableVersion> getVersions (
const TableBase* configuration)
const = 0;
49 static const CONFIGURATION_MODE& getMode (
void);
53 virtual std::set<std::string >
getAllTableGroupNames (
const std::string& =
"")
const { __SS__; __THROW__(ss.str() +
"ConfigurationInterface::... Must only call getAllTableGroupNames in a mode with this functionality implemented (e.g. DatabaseConfigurationInterface)."); }
54 virtual std::set<TableGroupKey> getKeys (
const std::string& )
const { __SS__; __THROW__(ss.str() +
"ConfigurationInterface::... Must only call getKeys in a mode with this functionality implemented (e.g. DatabaseConfigurationInterface)."); }
60 virtual std::map<std::string ,
61 TableVersion >
getTableGroupMembers (std::string
const& ,
bool =
false)
const { __SS__; __THROW__(ss.str() +
"ConfigurationInterface::... Must only call getTableGroupMembers in a mode with this functionality implemented (e.g. DatabaseConfigurationInterface)."); }
62 virtual void saveTableGroup (std::map<std::string /*name*/,TableVersion /*version*/>
const& , std::string
const& )
const { __SS__; __THROW__(ss.str() +
"ConfigurationInterface::... Must only call saveTableGroup in a mode with this functionality implemented (e.g. DatabaseConfigurationInterface)."); }
64 virtual std::pair<std::string, TableVersion> saveCustomJSON (
const std::string& JSON,
const std::string& documentNameToSave)
const { __COUTV__(JSON); __COUTV__(documentNameToSave);
return std::make_pair(
"",TableVersion());}
65 virtual std::string loadCustomJSON (
const std::string& documentNameToLoad, TableVersion documentVersionToLoad)
const {__COUTV__(documentNameToLoad); __COUTV__(documentVersionToLoad);
return "{}";};
69 virtual void fill (TableBase* configuration, TableVersion version)
const = 0;
73 virtual TableGroupKey findLatestGroupKey (
const std::string& )
const { __SS__; __THROW__(ss.str() +
"ConfigurationInterface::... Must only call findLatestGroupKey in a mode with this functionality implemented (e.g. DatabaseConfigurationInterface)."); }
75 virtual void saveActiveVersion (
const TableBase* configuration,
bool overwrite =
false)
const = 0;
78 ConfigurationHandlerBase* theConfigurationHandler_;
82 static CONFIGURATION_MODE theMode_;
83 static bool theVersionTrackingEnabled_;
85 std::mutex tableReaderMutex_;
virtual std::set< std::string > getAllTableGroupNames(const std::string &="") const
group handling
ConfigurationInterface(void)
Protected constructor.
virtual std::set< std::string > getAllTableNames(void) const
virtual TableGroupKey findLatestGroupKey(const std::string &) const
otsdaq_database_migrate and otsdaq_import_system_aliases to compile
TableVersion saveNewVersion(TableBase *configuration, TableVersion temporaryVersion, TableVersion newVersion=TableVersion())
virtual std::map< std::string, TableVersion > getTableGroupMembers(std::string const &, bool=false) const
virtual TableVersion findLatestVersion(const TableBase *configuration) const =0
return INVALID if no existing versions