1 #ifndef _ots_TableBase_h_
2 #define _ots_TableBase_h_
8 #include "otsdaq/TableCore/TableVersion.h"
9 #include "otsdaq/TableCore/TableView.h"
14 class ConfigurationManager;
17 #define __SELF_NODE__ getNode(getTableName())
33 TableBase(
bool specialTable,
const std::string& specialTableName);
34 TableBase(
const std::string& tableName, std::string* accumulatedExceptions = 0);
42 void destroy (
void) { ; }
43 void reset (
bool keepTemporaryVersions =
false);
47 void print (std::ostream& out = std::cout)
const;
49 std::string getTypeId (
void);
55 void trimCache (
unsigned int trimSize = -1);
59 std::map<std::string , std::vector<std::string /* colName */>>* v1ModifiedRecords = 0)
const;
63 const std::string& getTableDescription (
void)
const;
64 std::set<TableVersion> getStoredVersions (
void)
const;
75 virtual std::string getStructureAsJSON (
const ConfigurationManager* ) {__SS__ <<
"getStructureAsJSON() is not implemented for this table '" <<
getTableName() <<
"'" << __E__; __SS_ONLY_THROW__;};
76 virtual void initPrereqsForARTDAQ (
const ConfigurationManager* ) {__SS__ <<
"initPrereqsForARTDAQ() is not implemented for this table '" <<
getTableName() <<
"'" << __E__; __SS_ONLY_THROW__;};
77 virtual std::string getFclValueForARTDAQ (
const ConfigurationManager* ,
const std::string& )
const {__SS__ <<
"getFclValueForARTDAQ() is not implemented for this table '" <<
getTableName() <<
"'" << __E__; __SS_ONLY_THROW__;};
81 void setTableDescription (
const std::string& tableDescription);
82 bool setActiveView (TableVersion version);
83 TableVersion
copyView (
const TableView& sourceView, TableVersion destinationVersion,
const std::string& author,
bool looseColumnMatching =
false);
85 const TableView& sourceViewA,
86 const TableView& sourceViewB,
87 TableVersion destinationVersion,
88 const std::string& author,
90 std::map<std::pair<std::string /*original table*/, std::string /*original uidB*/>,
91 std::string >& uidConversionMap,
92 std::map<std::pair<std::string ,
93 std::pair<std::string ,
95 std::string >& groupidConversionMap,
96 bool fillRecordConversionMaps,
97 bool applyRecordConversionMaps,
98 bool generateUniqueDataColumns =
false,
99 std::stringstream* mergeRepoert =
nullptr);
103 static std::string
convertToCaps (std::string& str,
bool isConfigName =
false);
119 static const std::string GROUP_CACHE_PREPEND;
120 static const std::string JSON_DOC_PREPEND;
121 static const std::string GROUP_METADATA_TABLE_NAME;
124 std::string tableName_;
125 std::string tableDescription_;
const std::string & getTableName(void) const
Getters.
std::map< TableVersion, TableView > tableViews_
TableVersion createTemporaryView(TableVersion sourceViewVersion=TableVersion(), TableVersion destTemporaryViewVersion=TableVersion::getNextTemporaryVersion())
source of -1, from MockUp, else from valid view version
void setupMockupView(TableVersion version)
bool diffTwoVersions(TableVersion v1, TableVersion v2, std::stringstream *diffReport=0, std::map< std::string, std::vector< std::string >> *v1ModifiedRecords=0) const
MergeApproach
Merge approach enumeration for mergeViews function.
@ RENAME
Rename records with UID conflicts from source view B.
@ REPLACE
Replace records with UID conflicts from source view B.
@ SKIP
Skip records with UID conflicts from source view B.
bool isFirstAppInContext_
for managing things that should only happen once per node (e.g., write files). If used,...
TableBase(bool specialTable, const std::string &specialTableName)
void trimTemporary(TableVersion targetVersion=TableVersion())
unsigned int getNumberOfStoredViews(void) const
TableVersion checkForDuplicate(TableVersion needleVersion, TableVersion ignoreVersion=TableVersion()) const
bool isActive(void)
isActive
TableVersion mergeViews(const TableView &sourceViewA, const TableView &sourceViewB, TableVersion destinationVersion, const std::string &author, MergeApproach mergeApproach, std::map< std::pair< std::string, std::string >, std::string > &uidConversionMap, std::map< std::pair< std::string, std::pair< std::string, std::string > >, std::string > &groupidConversionMap, bool fillRecordConversionMaps, bool applyRecordConversionMaps, bool generateUniqueDataColumns=false, std::stringstream *mergeRepoert=nullptr)
static std::string convertToCaps(std::string &str, bool isConfigName=false)
friend std::ostream & operator<<(std::ostream &out, const TableBase &table)
output table name for ostream operator
TableView * getTemporaryView(TableVersion temporaryVersion)
const unsigned int MAX_VIEWS_IN_CACHE
TableVersion getNextVersion(void) const
const TableVersion & getViewVersion(void) const
always the active one
TableVersion copyView(const TableView &sourceView, TableVersion destinationVersion, const std::string &author, bool looseColumnMatching=false)
bool latestAndMockupColumnNumberMismatch(void) const
void setTableName(const std::string &tableName)
Setters.
void print(std::ostream &out=std::cout) const
always prints active view
void specialMetaTableConstructor(void)
Methods.
TableVersion getNextTemporaryVersion(void) const
void trimCache(unsigned int trimSize=-1)
static TableVersion getNextTemporaryVersion(const TableVersion &version=TableVersion())
defines used also by OtsConfigurationWizardSupervisor