FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
TimePointCacheTable Class Reference

Convenience class to maintain a table of TimePointCache objects. More...

#include <time_point.hpp>

Public Member Functions

 TimePointCacheTable (const char *tableName="timeCache")
 
 ~TimePointCacheTable ()
 
const TimePointCachegetCacheEntry (time_t t)
 Returns a TimePointCache entry for the day indicated by the number of seconds since the POSIX epoch. More...
 

Private Attributes

TimedMutex tblLock
 
std::map< time_t, TimePointCache * > timeTable
 

Detailed Description

Convenience class to maintain a table of TimePointCache objects.

Many applications make repeated references to times covering a small population of dates. Initialization of a TimePointCache object is relatively expensive, often requiring a trip into the kernel to examine the filesystem. A TimePointCacheTable can be used to avoid creating redundant TimePointCache objects along with the unproductive repeated work.

Constructor & Destructor Documentation

◆ TimePointCacheTable()

TimePointCacheTable::TimePointCacheTable ( const char *  tableName = "timeCache")
inlineexplicit

◆ ~TimePointCacheTable()

TimePointCacheTable::~TimePointCacheTable ( )
inline

Member Function Documentation

◆ getCacheEntry()

const TimePointCache& TimePointCacheTable::getCacheEntry ( time_t  t)
inline

Returns a TimePointCache entry for the day indicated by the number of seconds since the POSIX epoch.

Parameters
tspecifies the time in question
Returns
a reference to the corresponding record is returned.

NOTE: this routine is thread-safe. Records are automatically created as needed. The address of the returned record will not change during the lifetime of the table.

References tblLock, timeTable, and TimedMutex::unlock().

Referenced by LogMessageRecord::formatRecordAsText().

Member Data Documentation

◆ tblLock

TimedMutex TimePointCacheTable::tblLock
private

Referenced by getCacheEntry().

◆ timeTable

std::map<time_t,TimePointCache *> TimePointCacheTable::timeTable
private

Referenced by getCacheEntry().


The documentation for this class was generated from the following file:
Generated: Tue Jul 28 2020 16:03:27
Support Information