tdaq-develop-2025-02-12
|
Public Member Functions | |
TableBase (bool specialTable, const std::string &specialTableName) | |
TableBase (const std::string &tableName, std::string *accumulatedExceptions=0) | |
virtual | ~TableBase (void) |
virtual void | init (ConfigurationManager *configManager) |
Methods. | |
void | destroy (void) |
void | reset (bool keepTemporaryVersions=false) |
void | deactivate (void) |
bool | isActive (void) |
isActive | |
void | print (std::ostream &out=std::cout) const |
always prints active view | |
std::string | getTypeId (void) |
void | setupMockupView (TableVersion version) |
void | changeVersionAndActivateView (TableVersion temporaryVersion, TableVersion version) |
bool | isStored (const TableVersion &version) const |
bool | eraseView (TableVersion version) |
void | trimCache (unsigned int trimSize=-1) |
void | trimTemporary (TableVersion targetVersion=TableVersion()) |
TableVersion | checkForDuplicate (TableVersion needleVersion, TableVersion ignoreVersion=TableVersion()) const |
bool | diffTwoVersions (TableVersion v1, TableVersion v2, std::stringstream *diffReport=0, std::map< std::string, std::vector< std::string >> *v1ModifiedRecords=0) const |
const std::string & | getTableName (void) const |
Getters. | |
const std::string & | getTableDescription (void) const |
std::set< TableVersion > | getStoredVersions (void) const |
const TableView & | getView (TableVersion version=TableVersion(TableVersion::INVALID)) const |
TableView * | getViewP (TableVersion version=TableVersion(TableVersion::INVALID)) |
TableView * | getMockupViewP (void) |
const TableVersion & | getViewVersion (void) const |
always the active one | |
TableView * | getTemporaryView (TableVersion temporaryVersion) |
TableVersion | getNextTemporaryVersion (void) const |
TableVersion | getNextVersion (void) const |
virtual std::string | getStructureStatusAsJSON (ConfigurationManager *configManager) const |
void | setTableName (const std::string &tableName) |
Setters. | |
void | setTableDescription (const std::string &tableDescription) |
bool | setActiveView (TableVersion version) |
TableVersion | copyView (const TableView &sourceView, TableVersion destinationVersion, const std::string &author, bool looseColumnMatching=false) |
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) |
TableVersion | createTemporaryView (TableVersion sourceViewVersion=TableVersion(), TableVersion destTemporaryViewVersion=TableVersion::getNextTemporaryVersion()) |
source of -1, from MockUp, else from valid view version More... | |
bool | latestAndMockupColumnNumberMismatch (void) const |
unsigned int | getNumberOfStoredViews (void) const |
Static Public Member Functions | |
static std::string | convertToCaps (std::string &str, bool isConfigName=false) |
Public Attributes | |
const unsigned int | MAX_VIEWS_IN_CACHE |
Static Public Attributes | |
static const std::string | GROUP_CACHE_PREPEND = "GroupCache_" |
static const std::string | JSON_DOC_PREPEND = "JSONDoc_" |
Protected Attributes | |
std::string | tableName_ |
std::string | tableDescription_ |
TableView * | activeTableView_ |
TableView | mockupTableView_ |
std::map< TableVersion, TableView > | tableViews_ |
Definition at line 19 of file TableBase.h.
TableBase::TableBase | ( | bool | specialTable, |
const std::string & | specialTableName | ||
) |
TableBase Default constructor is only used to create special tables not based on an ...Info.xml file e.g. the TableGroupMetadata table in ConfigurationManager
Definition at line 116 of file TableBase.cc.
TableBase::TableBase | ( | const std::string & | tableName, |
std::string * | accumulatedExceptions = 0 |
||
) |
TableBase If a valid string pointer is passed in accumulatedExceptions then allowIllegalColumns is set for InfoReader If accumulatedExceptions pointer = 0, then illegal columns throw std::runtime_error exception
Definition at line 24 of file TableBase.cc.
|
virtual |
============================================================================== TableBase::TableBase(void) : MAX_VIEWS_IN_CACHE(1) { SS << "Should not call void constructor, table type is lost!" << E; ss << StringMacros::stackTrace() << E; SS_THROW; }
Definition at line 137 of file TableBase.cc.
TableVersion TableBase::checkForDuplicate | ( | TableVersion | needleVersion, |
TableVersion | ignoreVersion = TableVersion() |
||
) | const |
checkForDuplicate look for a duplicate of the needleVersion in the haystack which is the cached views in tableViews_
Note: ignoreVersion is useful if you know another view is already identical like when converting from temporary to persistent
Return invalid if no matches
Definition at line 287 of file TableBase.cc.
|
static |
convertToCaps static utility for converting table and column names to the caps version throw std::runtime_error if not completely alpha-numeric input
Definition at line 1726 of file TableBase.cc.
TableVersion TableBase::copyView | ( | const TableView & | sourceView, |
TableVersion | destinationVersion, | ||
const std::string & | author, | ||
bool | looseColumnMatching = false |
||
) |
copyView copies source view (including version) and places in self as destination temporary version. if destination version is invalid, then next available temporary version is chosen if conflict, throw exception
Returns version of new temporary view that was created.
Definition at line 1542 of file TableBase.cc.
TableVersion TableBase::createTemporaryView | ( | TableVersion | sourceViewVersion = TableVersion() , |
TableVersion | destTemporaryViewVersion = TableVersion::getNextTemporaryVersion() |
||
) |
source of -1, from MockUp, else from valid view version
createTemporaryView -1, from MockUp, else from valid view version destTemporaryViewVersion is starting point for search for available temporary versions. if destTemporaryViewVersion is invalid, starts search at TableVersion::getNextTemporaryVersion(). returns new temporary version number (which is always negative)
Definition at line 1601 of file TableBase.cc.
void TableBase::deactivate | ( | void | ) |
deactivate reset the active view
Definition at line 813 of file TableBase.cc.
bool TableBase::diffTwoVersions | ( | TableVersion | v1, |
TableVersion | v2, | ||
std::stringstream * | diffReport = 0 , |
||
std::map< std::string, std::vector< std::string >> * | v1ModifiedRecords = 0 |
||
) | const |
diffTwoVersions return a report of differences among two versions
Definition at line 409 of file TableBase.cc.
TableVersion TableBase::getNextTemporaryVersion | ( | void | ) | const |
getNextAvailableTemporaryView TableVersion::INVALID is always MockUp returns next available temporary version number (which is always negative)
Definition at line 1665 of file TableBase.cc.
TableVersion TableBase::getNextVersion | ( | void | ) | const |
getNextVersion returns next available new version the implication is any version number equal or greater is available.
Definition at line 1688 of file TableBase.cc.
unsigned int TableBase::getNumberOfStoredViews | ( | void | ) | const |
getNumberOfStoredViews count number of stored views, not including temporary views (invalid views should be impossible)
Definition at line 723 of file TableBase.cc.
TableView * TableBase::getTemporaryView | ( | TableVersion | temporaryVersion | ) |
getTemporaryView must be a valid temporary version, and the view must be stored in table. temporary version indicates it has not been saved to database and assigned a version number
Definition at line 1712 of file TableBase.cc.
bool TableBase::latestAndMockupColumnNumberMismatch | ( | void | ) | const |
latestAndMockupColumnNumberMismatch intended to check if the column count was recently changed
Definition at line 698 of file TableBase.cc.
TableVersion TableBase::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 |
||
) |
mergeViews merges source view A and B and places in destination temporary version. if destination version is invalid, then next available temporary version is chosen one error, throw exception
Returns version of new temporary view that was created.
end uid conversion map
Definition at line 851 of file TableBase.cc.
void TableBase::setupMockupView | ( | TableVersion | version | ) |
makes active version the specified table view version if the version is not already stored, then creates a mockup version
Definition at line 175 of file TableBase.cc.
void TableBase::trimCache | ( | unsigned int | trimSize = -1 | ) |
trimCache if there are more views than MAX_VIEWS_IN_CACHE, erase them. choose wisely the view to delete (by access time)
Definition at line 205 of file TableBase.cc.
void TableBase::trimTemporary | ( | TableVersion | targetVersion = TableVersion() | ) |
trimCache if there are more views than MAX_VIEWS_IN_CACHE, erase them. choose wisely the view to delete (by access time)
Definition at line 245 of file TableBase.cc.
const unsigned int ots::TableBase::MAX_VIEWS_IN_CACHE |
Each inheriting table class could have varying amounts of cache
Definition at line 22 of file TableBase.h.
|
protected |
Version and data associated to make it work like a cache. It will be very likely just 1 version NOTE: must be very careful to setVersion of view after manipulating (e.g. copy from different version view)
Definition at line 115 of file TableBase.h.