DP3
Public Member Functions | Static Public Member Functions | List of all members
dp3::parmdb::ParmDB Class Reference

Envelope class for a table holding parameters. More...

#include <ParmDB.h>

Public Member Functions

 ParmDB (const ParmDB &)
 Copy contructor has reference semantics. More...
 
 ParmDB (const ParmDBMeta &ptm, bool forceNew=false)
 
 ~ParmDB ()
 Delete underlying object if no more references to it. More...
 
void clearTables ()
 Clear database tables (i.e. remove all rows from all tables). More...
 
void deleteDefValues (const std::string &parmNamePattern)
 Delete the default value records for the given parameters. More...
 
void deleteValues (const std::string &parmNamePattern, const Box &domain)
 Delete the records for the given parameters and domain. More...
 
void flush (bool fsync=false)
 
const std::vector< double > & getDefaultSteps () const
 Get the default step values for the axes. More...
 
ParmValueSet getDefValue (const std::string &parmName, const ParmValue &defaultValue=ParmValue()) const
 Get the initial value for the given parameter. More...
 
void getDefValues (ParmMap &result, const std::string &parmNamePattern) const
 
int getNameId (const std::string &parmName)
 
std::vector< std::string > getNames (const std::string &pattern) const
 Get the names matching the pattern in the table. More...
 
const ParmDBMetagetParmDBMeta () const
 Get the name and type of the ParmDB. More...
 
int getParmDBSeqNr () const
 Get ParmDB sequence nr. More...
 
void getValues (ParmMap &result, const std::string &parmNamePattern, const Box &domain) const
 
void getValues (std::vector< ParmValueSet > &values, const std::vector< unsigned int > &nameIds, const std::vector< ParmId > &parmIds, const Box &domain)
 
ParmDBoperator= (const ParmDB &)
 Assignment has reference semantics. More...
 
void putDefValue (const std::string &parmName, const ParmValueSet &value, bool check=true)
 Put the default value for the given parameter. More...
 
void putValues (const std::string &name, int &nameId, ParmValueSet &values)
 
void setDefaultSteps (const std::vector< double > &steps)
 Set the default step values. More...
 
void lock (bool lockForWrite=true)
 
void unlock ()
 
Box getRange (const std::string &parmNamePattern="") const
 
Box getRange (const std::vector< std::string > &parmNames) const
 

Static Public Member Functions

static ParmDB getParmDB (unsigned int index)
 

Detailed Description

Envelope class for a table holding parameters.

Constructor & Destructor Documentation

◆ ParmDB() [1/2]

dp3::parmdb::ParmDB::ParmDB ( const ParmDBMeta ptm,
bool  forceNew = false 
)
explicit

Create the ParmDB object for the given database type. It gets added to the map of open parmDBs.

◆ ParmDB() [2/2]

dp3::parmdb::ParmDB::ParmDB ( const ParmDB )

Copy contructor has reference semantics.

◆ ~ParmDB()

dp3::parmdb::ParmDB::~ParmDB ( )
inline

Delete underlying object if no more references to it.

Member Function Documentation

◆ clearTables()

void dp3::parmdb::ParmDB::clearTables ( )
inline

Clear database tables (i.e. remove all rows from all tables).

◆ deleteDefValues()

void dp3::parmdb::ParmDB::deleteDefValues ( const std::string &  parmNamePattern)
inline

Delete the default value records for the given parameters.

◆ deleteValues()

void dp3::parmdb::ParmDB::deleteValues ( const std::string &  parmNamePattern,
const Box domain 
)
inline

Delete the records for the given parameters and domain.

◆ flush()

void dp3::parmdb::ParmDB::flush ( bool  fsync = false)
inline

Flush possible changes to disk.
If fsync=True the file contents are fsync-ed to disk, to ensure that the system buffers are actually written to disk.

◆ getDefaultSteps()

const std::vector<double>& dp3::parmdb::ParmDB::getDefaultSteps ( ) const
inline

Get the default step values for the axes.

◆ getDefValue()

ParmValueSet dp3::parmdb::ParmDB::getDefValue ( const std::string &  parmName,
const ParmValue defaultValue = ParmValue() 
) const
inline

Get the initial value for the given parameter.

◆ getDefValues()

void dp3::parmdb::ParmDB::getDefValues ( ParmMap result,
const std::string &  parmNamePattern 
) const
inline

Get the default value for the given parameters. Only * and ? should be used in the pattern (no [] and {}).

◆ getNameId()

int dp3::parmdb::ParmDB::getNameId ( const std::string &  parmName)
inline

Get the id of a parameter. If not found in the Names table, it returns -1.

◆ getNames()

std::vector<std::string> dp3::parmdb::ParmDB::getNames ( const std::string &  pattern) const
inline

Get the names matching the pattern in the table.

◆ getParmDB()

static ParmDB dp3::parmdb::ParmDB::getParmDB ( unsigned int  index)
static

Get the ParmDB object of the opened database for the given index. An exception is thrown if not found.

◆ getParmDBMeta()

const ParmDBMeta& dp3::parmdb::ParmDB::getParmDBMeta ( ) const
inline

Get the name and type of the ParmDB.

◆ getParmDBSeqNr()

int dp3::parmdb::ParmDB::getParmDBSeqNr ( ) const
inline

Get ParmDB sequence nr.

◆ getRange() [1/2]

Box dp3::parmdb::ParmDB::getRange ( const std::string &  parmNamePattern = "") const
inline

Get the domain range (freq,time) of the given parameters in the table. This is the minimum and maximum value of these axes for all parameters. An empty name pattern is the same as * (all parms).

◆ getRange() [2/2]

Box dp3::parmdb::ParmDB::getRange ( const std::vector< std::string > &  parmNames) const
inline

◆ getValues() [1/2]

void dp3::parmdb::ParmDB::getValues ( ParmMap result,
const std::string &  parmNamePattern,
const Box domain 
) const
inline

Get the parameter values for the given parameters and domain. Only * and ? should be used in the pattern (no [] and {}).

◆ getValues() [2/2]

void dp3::parmdb::ParmDB::getValues ( std::vector< ParmValueSet > &  values,
const std::vector< unsigned int > &  nameIds,
const std::vector< ParmId > &  parmIds,
const Box domain 
)
inline

Get the parameter values for the given parameters and domain. The parmids form the indices in the result vector.

◆ lock()

void dp3::parmdb::ParmDB::lock ( bool  lockForWrite = true)
inline

Lock and unlock the database tables. The user does not need to lock/unlock, but it can increase performance if many small accesses have to be done.

◆ operator=()

ParmDB& dp3::parmdb::ParmDB::operator= ( const ParmDB )

Assignment has reference semantics.

◆ putDefValue()

void dp3::parmdb::ParmDB::putDefValue ( const std::string &  parmName,
const ParmValueSet value,
bool  check = true 
)
inline

Put the default value for the given parameter.

◆ putValues()

void dp3::parmdb::ParmDB::putValues ( const std::string &  name,
int &  nameId,
ParmValueSet values 
)
inline

Put the values of a parameter. If it is a new value, the new rowid will be stored in the ParmValueSet. If it is a new name, the nameId will be filled in.

◆ setDefaultSteps()

void dp3::parmdb::ParmDB::setDefaultSteps ( const std::vector< double > &  steps)
inline

Set the default step values.

◆ unlock()

void dp3::parmdb::ParmDB::unlock ( )
inline

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