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())
25 TableBase(
bool specialTable,
const std::string& specialTableName);
26 TableBase(
const std::string& tableName, std::string* accumulatedExceptions = 0);
33 void destroy (
void) { ; }
34 void reset (
bool keepTemporaryVersions =
false);
38 void print (std::ostream& out = std::cout)
const;
40 std::string getTypeId (
void);
46 void trimCache (
unsigned int trimSize = -1);
50 std::map<std::string , std::vector<std::string /* colName */>>* v1ModifiedRecords = 0)
const;
54 const std::string& getTableDescription (
void)
const;
55 std::set<TableVersion> getStoredVersions (
void)
const;
66 virtual std::string getStructureStatusAsJSON (
ConfigurationManager* configManager)
const {__SS__ <<
"This function is not implemented for this table '" <<
getTableName() <<
"'" << __E__; __SS_THROW__;
return configManager?
"":
"" ;};
70 void setTableDescription (
const std::string& tableDescription);
71 bool setActiveView (TableVersion version);
72 TableVersion
copyView (
const TableView& sourceView, TableVersion destinationVersion,
const std::string& author,
bool looseColumnMatching =
false);
74 const TableView& sourceViewA,
75 const TableView& sourceViewB,
76 TableVersion destinationVersion,
77 const std::string& author,
78 const std::string& mergeApproach ,
79 std::map<std::pair<std::string /*original table*/, std::string /*original uidB*/>,
80 std::string >& uidConversionMap,
81 std::map<std::pair<std::string ,
82 std::pair<std::string ,
84 std::string >& groupidConversionMap,
85 bool fillRecordConversionMaps,
86 bool applyRecordConversionMaps,
87 bool generateUniqueDataColumns =
false,
88 std::stringstream* mergeRepoert =
nullptr);
92 static std::string
convertToCaps (std::string& str,
bool isConfigName =
false);
102 static const std::string GROUP_CACHE_PREPEND;
103 static const std::string JSON_DOC_PREPEND;
106 std::string tableName_;
107 std::string tableDescription_;
109 TableView* activeTableView_;
110 TableView mockupTableView_;
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
TableBase(bool specialTable, const std::string &specialTableName)
void trimTemporary(TableVersion targetVersion=TableVersion())
TableVersion mergeViews(const TableView &sourceViewA, const TableView &sourceViewB, TableVersion destinationVersion, const std::string &author, const std::string &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)
unsigned int getNumberOfStoredViews(void) const
TableVersion checkForDuplicate(TableVersion needleVersion, TableVersion ignoreVersion=TableVersion()) const
bool isActive(void)
isActive
static std::string convertToCaps(std::string &str, bool isConfigName=false)
virtual void init(ConfigurationManager *configManager)
Methods.
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
TableVersion getNextTemporaryVersion(void) const
void trimCache(unsigned int trimSize=-1)
static TableVersion getNextTemporaryVersion(const TableVersion &version=TableVersion())