1 #ifndef _ots_ConfigurationManagerRW_h_
2 #define _ots_ConfigurationManagerRW_h_
4 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
16 std::set<TableVersion> versions_;
22 std::set<TableGroupKey> keys_;
23 std::string latestKeyGroupAuthor_, latestKeyGroupComment_, latestKeyGroupCreationTime_, latestKeyGroupTypeString_;
24 std::map<std::string ,
TableVersion > latestKeyMemberMap_;
31 #define __GETCFG_RW__(X) getConfigurationRW<X>(QUOTE(X))
46 const std::string& getUsername (
void)
const {
return username_; }
49 const std::map<std::string, TableInfo>& getAllTableInfo (
bool refresh =
false, std::string* accumulatedWarnings = 0,
const std::string& errorFilterName =
"");
50 std::map<std::string ,
51 std::map<std::string ,
55 T* getConfigurationRW (std::string name) {
return (T*)getTableByName(name); }
56 TableBase* getVersionedTableByName (
const std::string& tableName,
TableVersion version,
bool looseColumnMatching =
false, std::string* accumulatedErrors = 0);
57 TableBase* getTableByName (
const std::string& tableName);
58 TableGroupKey findTableGroup (
const std::string& groupName,
const std::map<std::string, TableVersion>& groupMembers,
59 const std::map<std::string /*name*/, std::string /*alias*/>& groupAliases = std::map<std::string /*name*/, std::string /*alias*/>());
60 TableBase* getMetadataTable (
void) {
return &groupMetadataTable_; }
66 const std::string& tableName,
71 bool ignoreDuplicates =
false,
72 bool lookForEquivalent =
false,
73 bool* foundEquivalent =
nullptr);
77 void clearCachedVersions (
const std::string& tableName);
78 void clearAllCachedVersions (
void);
82 void activateTableGroup (
const std::string& tableGroupName,
TableGroupKey tableGroupKey, std::string* accumulatedTreeErrors = 0);
89 TableGroupKey saveNewTableGroup (
const std::string& groupName, std::map<std::string, TableVersion>& groupMembers,
90 const std::string& groupComment = TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT,
91 std::map<std::string /*table*/, std::string /*alias*/>* groupAliases = 0);
95 const GroupInfo& getGroupInfo (
const std::string& groupName);
96 const std::map<std::string, GroupInfo>& getAllGroupInfo (
void) {
return allGroupInfo_; }
98 void testXDAQContext (
void);
103 void cacheGroupKey (
const std::string& groupName,
TableGroupKey key);
107 std::map<std::string, TableInfo> allTableInfo_;
108 std::map<std::string, GroupInfo> allGroupInfo_;
120 bool createdTemporaryVersion_;
122 std::string tableName_;
126 __SS__ <<
"impossible!" << std::endl;
127 ss << StringMacros::stackTrace();
131 : createdTemporaryVersion_(
false), modified_(markModified), tableName_(tableName)
134 table_ = cfgMgr->getTableByName(tableName_);
137 if(!table_->isActive() ||
138 !(originalVersion_ = table_->getView().getVersion()).isTemporaryVersion())
143 temporaryVersion_ = table_->createTemporaryView(originalVersion_);
144 cfgMgr->saveNewTable(
149 __COUT__ <<
"Created '" << tableName_ <<
"' temporary version " << temporaryVersion_ << std::endl;
150 createdTemporaryVersion_ =
true;
155 tableView_ = table_->getViewP();
167 std::map<std::string, TableVersion> groupMembers_;
168 std::map<std::string, TableEditStruct> groupTables_;
170 const ConfigurationManager::GroupType groupType_;
171 const std::string originalGroupName_;
178 : groupType_(ConfigurationManager::GroupType::CONFIGURATION_TYPE) {__SS__ <<
"impossible!" << __E__; __SS_THROW__;}
183 void dropChanges (
void);
185 const std::string& groupNameToSave,
187 bool* foundEquivalentGroupKey =
nullptr,
188 bool activateNewGroup =
false,
189 bool updateGroupAliases =
false,
190 bool updateTableAliases =
false,
192 bool* foundEquivalentBackboneKey =
nullptr,
193 std::string* accumulatedWarnings =
nullptr);
195 TableEditStruct& getTableEditStruct (
const std::string& tableName,
bool markModified =
false);