Ratpac-two
  • User’s Guide
  • Programmer’s Guide
  • Doxygen Code References
Ratpac-two
  • Ratpac-two: RAT::DBLink Class Reference
  • View page source

DBLink Class Reference

Ratpac-two: RAT::DBLink Class Reference
Ratpac-two
  • RAT
  • DBLink
Public Member Functions | Protected Attributes | List of all members
RAT::DBLink Class Reference

Public Member Functions

 DBLink (DB *db, std::string tblname, std::string index, int currentRun=1)
 
 ~DBLink ()
 
std::string GetName () const
 
std::string GetIndex () const
 
void SetCurrentRun (int runNumber)
 
int GetI (const std::string &name)
 
double GetD (const std::string &name)
 
std::string GetS (const std::string &name)
 
bool GetZ (const std::string &name)
 
std::vector< int > GetIArray (const std::string &name)
 
std::vector< float > GetFArrayFromD (const std::string &name)
 
std::vector< float > DArrayToFArray (const std::vector< double > &input)
 
std::vector< double > GetDArray (const std::string &name)
 
std::vector< std::string > GetSArray (const std::string &name)
 
std::vector< bool > GetZArray (const std::string &name)
 
json::Value GetJSON (const std::string &name)
 
template<class T >
T Get (const std::string &fieldname)
 
void Unlink ()
 

Protected Attributes

DB * db
 
std::string tblname
 
std::string index
 
int currentRun
 

Constructor & Destructor Documentation

◆ DBLink()

DBLink::DBLink ( DB *  db,
std::string  tblname,
std::string  index,
int  currentRun = 1 
)

Create a new link to a table.

Parameters
dbPointer to database which created this link. When the link is destroyed, the database will be notified.
tblnameName of table
indexIndex of table
currentRunRun number to use for validity range checking

◆ ~DBLink()

DBLink::~DBLink ( )

Destroy link.

When this object is destroyed, it will call DB::RemoveLink() on the database which created it.

Member Function Documentation

◆ Get()

template<class T >
T DBLink::Get ( const std::string &  fieldname)

Get the value of a field from the table, including plane precedence rules.

Parameters
TC++ data type for field
fieldnameName of field

◆ GetD()

double DBLink::GetD ( const std::string &  name)

Retrieve double field.

Exceptions
DBNotFoundErrorif double field name does not exist.

◆ GetDArray()

std::vector< double > DBLink::GetDArray ( const std::string &  name)

Retrieve double array field.

Exceptions
DBNotFoundErrorif double array field name does not exist.

◆ GetFArrayFromD()

std::vector< float > DBLink::GetFArrayFromD ( const std::string &  name)

Retrieve float array field.

Exceptions
DBNotFoundErrorif float array field name does not exist.

◆ GetI()

int DBLink::GetI ( const std::string &  name)

Retrieve integer field.

Exceptions
DBNotFoundErrorif integer field name does not exist.

◆ GetIArray()

std::vector< int > DBLink::GetIArray ( const std::string &  name)

Retrieve integer array field.

Exceptions
DBNotFoundErrorif integer array field name does not exist.

◆ GetIndex()

std::string RAT::DBLink::GetIndex ( ) const
inline

Get index of table this link points to.

◆ GetJSON()

json::Value DBLink::GetJSON ( const std::string &  name)

Retrieve raw JSON value.

Exceptions
DBNotFoundErrorif field name does not exist.

◆ GetName()

std::string RAT::DBLink::GetName ( ) const
inline

Get name of table this link points to.

◆ GetS()

std::string DBLink::GetS ( const std::string &  name)

Retrieve string field.

Exceptions
DBNotFoundErrorif string field name does not exist.

◆ GetSArray()

std::vector< std::string > DBLink::GetSArray ( const std::string &  name)

Retrieve string array field.

Exceptions
DBNotFoundErrorif string array field name does not exist.

◆ GetZ()

bool DBLink::GetZ ( const std::string &  name)

Retrieve bool field.

Exceptions
DBNotFoundErrorif string field name does not exist.

◆ GetZArray()

std::vector< bool > DBLink::GetZArray ( const std::string &  name)

Retrieve bool array field.

Exceptions
DBNotFoundErrorif string array field name does not exist.

◆ SetCurrentRun()

void RAT::DBLink::SetCurrentRun ( int  runNumber)
inline

Set the current run number for fetching run-specific tables from the server

Member Data Documentation

◆ currentRun

int RAT::DBLink::currentRun
protected

Current run number

◆ db

DB* RAT::DBLink::db
protected

Pointer to DB which created this link.

◆ index

std::string RAT::DBLink::index
protected

Index of table this link refers to

◆ tblname

std::string RAT::DBLink::tblname
protected

Name of table this link refers to.


The documentation for this class was generated from the following files:
  • /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/db/include/RAT/DBLink.hh
  • /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/db/src/DBLink.cc

Generated by doxygen 1.9.1

© Copyright 2023, The Regents of the University of California, through Lawrence Berkeley National Laboratory,and Lawrence Livermore National Security, LLC (subject to receipt of any required approvals from the U.S. Dept.of Energy). All rights reserved..

Built with Sphinx using a theme provided by Read the Docs.