tdaq-develop-2025-02-12
ots::TableBase Class Reference
Inheritance diagram for ots::TableBase:
ots::ARTDAQTableBase ots::DesktopIconTable ots::FESlowControlsTable ots::IterateTable ots::MessageFacilityTable ots::SlowControlsTableBase ots::TemplateTable ots::TestConfiguration001 ots::TestConfiguration002 ots::XDAQContextTable

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< TableVersiongetStoredVersions (void) const
 
const TableViewgetView (TableVersion version=TableVersion(TableVersion::INVALID)) const
 
TableViewgetViewP (TableVersion version=TableVersion(TableVersion::INVALID))
 
TableViewgetMockupViewP (void)
 
const TableVersiongetViewVersion (void) const
 always the active one
 
TableViewgetTemporaryView (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_
 
TableViewactiveTableView_
 
TableView mockupTableView_
 
std::map< TableVersion, TableViewtableViews_
 

Detailed Description

Definition at line 19 of file TableBase.h.

Constructor & Destructor Documentation

◆ TableBase() [1/2]

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() [2/2]

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.

◆ ~TableBase()

TableBase::~TableBase ( void  )
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.

Member Function Documentation

◆ checkForDuplicate()

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.

◆ convertToCaps()

std::string TableBase::convertToCaps ( std::string &  str,
bool  isTableName = false 
)
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.

◆ copyView()

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.

◆ createTemporaryView()

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.

◆ deactivate()

void TableBase::deactivate ( void  )

deactivate reset the active view

Definition at line 813 of file TableBase.cc.

◆ diffTwoVersions()

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.

◆ getNextTemporaryVersion()

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.

◆ getNextVersion()

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.

◆ getNumberOfStoredViews()

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.

◆ getTemporaryView()

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.

◆ latestAndMockupColumnNumberMismatch()

bool TableBase::latestAndMockupColumnNumberMismatch ( void  ) const

latestAndMockupColumnNumberMismatch intended to check if the column count was recently changed

Definition at line 698 of file TableBase.cc.

◆ mergeViews()

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.

◆ setupMockupView()

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.

◆ trimCache()

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.

◆ trimTemporary()

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.

Member Data Documentation

◆ MAX_VIEWS_IN_CACHE

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.

◆ tableViews_

std::map<TableVersion, TableView> ots::TableBase::tableViews_
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.


The documentation for this class was generated from the following files: