List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
det::VSQLManager Class Referenceabstract

Interface for detector managers that use MySQL. More...

#include <VSQLManager_MySQL.h>

Inheritance diagram for det::VSQLManager:
Inheritance graph
[legend]

Public Types

typedef std::map< std::string,
std::string > 
IndexMap
 
enum  Status { eFound, eNotFound }
 Specifies success or (eventually) various possible failure modes. More...
 

Public Member Functions

template<typename T >
VSQLManager::Status FetchColumn (std::vector< T > &data) const
 
template<typename T >
VSQLManager::Status FetchRow (T &data, const bool freeResult) const
 
template<typename T >
VSQLManager::Status FetchRow (std::vector< T > &data, const bool freeResult) const
 
template<typename TH , typename TT >
VSQLManager::Status FetchRowMany (boost::tuples::cons< TH, TT > &tuple, const bool freeResult) const
 
template<typename TH , typename TT >
VSQLManager::Status FetchRowTuple (boost::tuples::cons< TH, TT > &tuple, const int idx) const
 
virtual Status GetData (double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (int &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (bool &, const std::string &componentProperty, const std::string &componentName, const VManager::IndexMap &) const
 
virtual Status GetData (std::string &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::vector< double > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::vector< int > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::vector< std::string > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::vector< bool > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::list< double > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::list< int > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::list< std::string > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::list< std::pair< int, int >> &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (utl::TabulatedFunction &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::map< int, utl::TabulatedFunction > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (utl::TabulatedFunctionComplexLgAmpPhase &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::map< std::string, double > &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
 
virtual Status GetData (std::vector< std::vector< int >> &, const std::string &componentProperty, const std::string &componentName, const VManager::IndexMap &) const
 
virtual Status GetData (std::map< unsigned int, int > &, const std::string &componentProperty, const std::string &componentName, const VManager::IndexMap &) const
 
Status GetData (Handle &returnData, const std::string &component, const std::string &property, const IndexMap &index=IndexMap()) const
 new data accessor More...
 
const std::string & GetName () const
 
bool IsInitialized () const
 
void SetName (const std::string &name)
 
void SetReportingErrors (const bool flag=true)
 Generic data accessors. More...
 
 VSQLManager ()
 
 VSQLManager ()
 
virtual ~VSQLManager ()
 
virtual ~VSQLManager ()
 

Static Public Member Functions

template<typename T >
static T FindComponent (const std::string &componentName, const IndexMap &componentIndex)
 
template<typename T , typename U >
static T FindComponent (const std::string &componentName, const U &defaultValue, const IndexMap &componentIndex)
 
static std::string QueryInfoMessage (const Handle &returnData, const std::string &component)
 
static std::string QueryInfoMessage (const Handle &returnData, const std::string &component, const std::string &property, const IndexMap &index)
 
static std::string QueryInfoMessage (const std::string &componentProperty, const std::string &componentName)
 
static std::string QueryInfoMessage (const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex)
 
static void SetGlobalLogQueries (const int q)
 

Protected Member Functions

template<typename T >
void AddAvailability (const std::string &component)
 
void Close ()
 
void Close ()
 
void Connect () const
 
template<typename T >
Status FetchColumn (std::vector< T > &data) const
 Get the first item from many rows of an SQLite query result. More...
 
template<typename T >
Status FetchNextRow (T &result) const
 Fetch first item (may be a tuple) from current row. More...
 
template<typename T >
Status FetchNextRow (T &result) const
 Fetch first item (may be a tuple) from current row. More...
 
template<typename TH , typename TT >
Status FetchNextRowMany (boost::tuples::cons< TH, TT > &result) const
 workaround More...
 
template<typename TH , typename TT >
Status FetchNextRowMany (boost::tuples::cons< TH, TT > &result) const
 workaround More...
 
template<typename T >
Status FetchRow (T &data, const bool freeResult=true) const
 Get data from the first element of the first row of an SQLite result. More...
 
template<typename T >
Status FetchRow (std::vector< T > &data, const bool freeResult=true) const
 Get a data vector from the first (full) row of an SQLite query result. More...
 
MYSQL_ROW FetchRow () const
 
template<typename TH , typename TT >
Status FetchRowMany (boost::tuples::cons< TH, TT > &tuple, const bool freeResult=true) const
 Get a tuple of values from the first row of an SQLite query result. More...
 
void FindConfig (const std::string &configLink)
 Locate the configuration file in CentralConfig and make a Reader for it. More...
 
 FreeResult ()
 
 FreeResult ()
 
int FreeResult () const
 Erase the query result and release all resources. More...
 
 FreeResult ()
 
 FreeResult ()
 
template<typename T >
Status GetDBData (T &returnData, const std::string &tableName, const std::string &columnName, const IndexMap &componentIndex) const
 
template<typename T >
Status GetDBData (std::vector< T > &returnData, const std::string &tableName, const std::string &columnName, const IndexMap &componentIndex) const
 
template<typename T >
Status GetDBData (T &returnData, const std::string &tableName, const std::string &columnName, const IndexMap &componentIndex) const
 
template<typename T >
Status GetDBData (std::vector< T > &returnData, const std::string &tableName, const std::string &columnName, const IndexMap &componentIndex) const
 
virtual Status GetDBResFundamental (const std::string &, const std::string &, const IndexMap &) const
 overload this in all derived managers that need it More...
 
virtual Status GetDBResFundamental (const std::string &, const std::string &, const IndexMap &) const
 overload this in all derived managers that need it More...
 
virtual Status GetDBResVector (const std::string &, const std::string &, const IndexMap &) const
 overload this in all derived managers that need it More...
 
virtual Status GetDBResVector (const std::string &, const std::string &, const IndexMap &) const
 overload this in all derived managers that need it More...
 
 if (row &&row[0])
 
 if (row)
 
 if (row)
 
virtual void Init (const std::string &configLink)
 Manager Initialization. configLink is the CentralConfig hook for the configuration file. More...
 
virtual void Init (const std::string &configLink)
 Manager Initialization. configLink is the CentralConfig hook for the configuration file. More...
 
bool IsReportingErrors () const
 
std::string NotImplementedMessage (const std::string &type, const std::string &componentProperty, const std::string &componentName) const
 
unsigned int NumFields () const
 
unsigned int NumFields () const
 Number of fields (columns) in the current query result. More...
 
size_t NumRows () const
 Total number of rows in the current query result. More...
 
Status Query (const std::ostringstream &os, const std::string &what="") const
 query MySQL More...
 
Status Query (const std::string &query, const std::string &what="") const
 
Status Query (const std::ostringstream &os, const std::string &what="") const
 query MySQL More...
 
Status Query (const std::ostringstream &os, const std::ostringstream &what) const
 
Status Query (const std::string &query, const std::string &what="") const
 
Status Query (const std::ostringstream &os, const std::ostringstream &what) const
 
 while ((row=FetchRow())) if(row[0])
 

Static Protected Member Functions

static std::string MergeIndexMap (const IndexMap &componentIndex)
 

Protected Attributes

template<typename T >
Status const
 Fetch first item from first row and optionally free query result. More...
 
void const
 Fetch tuple from first row and optionally free query result. More...
 
return eFound
 
 else
 
return eNotFound
 
std::set< std::string > fAvailableComponents
 
utl::Branch fBranch
 
std::string fDatabaseSoftwareVersion
 
bool fIsInitialized = false
 
bool fReportingErrors = false
 

Private Member Functions

 ERROR (err)
 
int FetchRow () const
 Step through one row of an SQLite query result. More...
 
Status FetchRowTuple (const boost::tuples::null_type &, const int) const
 Helper function that stops the recursion of FetchRowTuple. More...
 
template<typename TH , typename TT >
Status FetchRowTuple (boost::tuples::cons< TH, TT > &tuple, const int idx=0) const
 
Status FetchRowTuple (const MYSQL_ROW, const boost::tuples::null_type &, const int) const
 stop taking tuples More...
 
template<typename TH , typename TT >
Status FetchRowTuple (const MYSQL_ROW row, boost::tuples::cons< TH, TT > &tuple, const int index=0) const
 
VSQLManageroperator= (const VSQLManager &)
 
VSQLManageroperator= (const VSQLManager &)
 
throw utl::IOFailureException (err)
 
 VSQLManager (const VSQLManager &)
 
 VSQLManager (const VSQLManager &)
 

Static Private Member Functions

template<typename T >
static void BadLexicalCast (const char *const row, const std::string &action)
 

Private Attributes

MYSQL_RES * const
 
const std::string err = "Empty MySQL result queue."
 
std::string fDatabaseName
 Database filename. More...
 
std::string fDatabasePassword
 
std::string fDatabaseServer
 
std::string fDatabaseUserName
 
sqlite3 * fDb = nullptr
 SQLite database object pointer. More...
 
int fLogQueries = 0
 
std::ofstream * fLogQueryStream = nullptr
 
MYSQL * fMySQL = nullptr
 
MYSQL_RES * fMySQLResult = nullptr
 
int fPort = -1
 
sqlite3_stmt * fResult = nullptr
 Storage for SQLite query results. More...
 
utl::RealTimeStopwatch fTime {false}
 

Static Private Attributes

static int fgGlobalLogQueries = 0
 

Detailed Description

Interface for detector managers that use MySQL.

This class provides a few services for detector managers that query MySQL databases, such as performing initialization tasks like establishing the database connection based on instructions from a configuration file.

Author
T. Paul
D. Veberic
Date
04 Feb 2004
12 Jan 2007 DV update

This class provides a few services for detector managers that query SQLite databases,

Author
S. BenZvi
T. Paul
D. Veberic
Date
13 Jul 2010

Definition at line 45 of file VSQLManager_MySQL.h.

Member Typedef Documentation

typedef std::map<std::string, std::string> det::VManager::IndexMap
inherited

Definition at line 133 of file VManager.h.

Member Enumeration Documentation

enum det::VManager::Status
inherited

Specifies success or (eventually) various possible failure modes.

Various failure modes to be specified (for example, failure to connect to db, faiure to find db record, failure to find table name, etc

Enumerator
eFound 
eNotFound 

Definition at line 127 of file VManager.h.

Constructor & Destructor Documentation

det::VSQLManager::VSQLManager ( )
inline

Definition at line 48 of file VSQLManager_MySQL.h.

virtual det::VSQLManager::~VSQLManager ( )
inlinevirtual

Definition at line 49 of file VSQLManager_MySQL.h.

References Close().

det::VSQLManager::VSQLManager ( const VSQLManager )
private
det::VSQLManager::VSQLManager ( )
inline

Definition at line 46 of file VSQLManager_SQLite.h.

virtual det::VSQLManager::~VSQLManager ( )
inlinevirtual

Definition at line 47 of file VSQLManager_SQLite.h.

References Close().

det::VSQLManager::VSQLManager ( const VSQLManager )
private

Member Function Documentation

template<typename T >
void det::VManager::AddAvailability ( const std::string &  component)
inlineprotectedinherited

Definition at line 347 of file VManager.h.

template<typename T >
static void det::VSQLManager::BadLexicalCast ( const char *const  row,
const std::string &  action 
)
inlinestaticprivate

Definition at line 269 of file VSQLManager_MySQL.h.

References err, and ERROR().

void det::VSQLManager::Close ( )
protected
void VSQLManager::Close ( )
protected

Definition at line 17 of file VSQLManager_MySQL.cc.

References INFO, and galactic::second.

Referenced by ~VSQLManager().

void det::VSQLManager::Connect ( ) const
protected
det::VSQLManager::ERROR ( err  )
private
template<typename T >
Status det::VSQLManager::FetchColumn ( std::vector< T > &  data) const
protected

Get the first item from many rows of an SQLite query result.

Referenced by GetDBData().

template<typename T >
VSQLManager::Status det::VSQLManager::FetchColumn ( std::vector< T > &  data) const

Definition at line 110 of file VSQLManager_impl_SQLite.h.

References ERROR.

template<typename T >
Status det::VSQLManager::FetchNextRow ( T &  result) const
inlineprotected

Fetch first item (may be a tuple) from current row.

Definition at line 82 of file VSQLManager_SQLite.h.

References FetchRow().

template<typename T >
Status det::VSQLManager::FetchNextRow ( T &  result) const
inlineprotected

Fetch first item (may be a tuple) from current row.

Definition at line 160 of file VSQLManager_MySQL.h.

References FetchRow().

template<typename TH , typename TT >
Status det::VSQLManager::FetchNextRowMany ( boost::tuples::cons< TH, TT > &  result) const
inlineprotected

workaround

Definition at line 87 of file VSQLManager_SQLite.h.

References FetchRowMany().

template<typename TH , typename TT >
Status det::VSQLManager::FetchNextRowMany ( boost::tuples::cons< TH, TT > &  result) const
inlineprotected

workaround

Definition at line 165 of file VSQLManager_MySQL.h.

References FetchRowMany().

template<typename T >
VSQLManager::Status det::VSQLManager::FetchRow ( T &  data,
const bool  freeResult 
) const

Definition at line 10 of file VSQLManager_impl_SQLite.h.

References ERROR.

template<typename T >
VSQLManager::Status det::VSQLManager::FetchRow ( std::vector< T > &  data,
const bool  freeResult 
) const

Definition at line 40 of file VSQLManager_impl_SQLite.h.

References ERROR.

template<typename T >
Status det::VSQLManager::FetchRow ( T &  data,
const bool  freeResult = true 
) const
protected

Get data from the first element of the first row of an SQLite result.

template<typename T >
Status det::VSQLManager::FetchRow ( std::vector< T > &  data,
const bool  freeResult = true 
) const
protected

Get a data vector from the first (full) row of an SQLite query result.

int det::VSQLManager::FetchRow ( ) const
private

Step through one row of an SQLite query result.

int VSQLManager::FetchRow ( ) const
inlineprotected

Definition at line 241 of file VSQLManager_MySQL.h.

Referenced by FetchNextRow(), and GetDBData().

template<typename TH , typename TT >
Status det::VSQLManager::FetchRowMany ( boost::tuples::cons< TH, TT > &  tuple,
const bool  freeResult = true 
) const
protected

Get a tuple of values from the first row of an SQLite query result.

Referenced by FetchNextRowMany().

template<typename TH , typename TT >
VSQLManager::Status det::VSQLManager::FetchRowMany ( boost::tuples::cons< TH, TT > &  tuple,
const bool  freeResult 
) const

Definition at line 94 of file VSQLManager_impl_SQLite.h.

template<typename TH , typename TT >
VSQLManager::Status det::VSQLManager::FetchRowTuple ( boost::tuples::cons< TH, TT > &  tuple,
const int  idx 
) const

Definition at line 74 of file VSQLManager_impl_SQLite.h.

References ERROR.

Status det::VSQLManager::FetchRowTuple ( const boost::tuples::null_type &  ,
const int   
) const
inlineprivate

Helper function that stops the recursion of FetchRowTuple.

Definition at line 140 of file VSQLManager_SQLite.h.

References eFound.

template<typename TH , typename TT >
Status det::VSQLManager::FetchRowTuple ( boost::tuples::cons< TH, TT > &  tuple,
const int  idx = 0 
) const
private

Helper function called by FetchRowMany to extract data from a row of SQLite results

Status det::VSQLManager::FetchRowTuple ( const MYSQL_ROW  ,
const boost::tuples::null_type &  ,
const int   
) const
inlineprivate

stop taking tuples

Definition at line 245 of file VSQLManager_MySQL.h.

References eFound.

Referenced by FetchRowTuple(), and if().

template<typename TH , typename TT >
Status det::VSQLManager::FetchRowTuple ( const MYSQL_ROW  row,
boost::tuples::cons< TH, TT > &  tuple,
const int  index = 0 
) const
inlineprivate

Definition at line 251 of file VSQLManager_MySQL.h.

References eNotFound, and FetchRowTuple().

template<typename T >
static T det::VManager::FindComponent ( const std::string &  componentName,
const IndexMap componentIndex 
)
inlinestaticinherited

Definition at line 307 of file VManager.h.

References ERROR.

template<typename T , typename U >
static T det::VManager::FindComponent ( const std::string &  componentName,
const U defaultValue,
const IndexMap componentIndex 
)
inlinestaticinherited

Definition at line 322 of file VManager.h.

void det::VManager::FindConfig ( const std::string &  configLink)
protectedinherited

Locate the configuration file in CentralConfig and make a Reader for it.

Definition at line 25 of file VManager.cc.

References ERROR, and WARNING.

det::VSQLManager::FreeResult ( )
protected

Referenced by if().

det::VSQLManager::FreeResult ( )
protected
int VSQLManager::FreeResult ( ) const
protected

Erase the query result and release all resources.

Definition at line 38 of file VSQLManager_SQLite.cc.

det::VSQLManager::FreeResult ( )
protected
det::VSQLManager::FreeResult ( )
protected
virtual Status det::VManager::GetData ( double &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited

Implemented in det::ManagerRegister, fdet::FdUpTimeFileManager, fdet::FdUpTimeSQLManager, and fwk::TestSQLManager.

Referenced by atm::AerosolDB::AerosolDB(), atm::MolecularZone::CacheLayers(), fdet::Telescope::CachePixelCloudData(), atm::VZone::CacheSlices(), atm::AerosolDB::CacheZones(), atm::LidarDB::CacheZones(), atm::MolecularDB::CacheZones(), cdet::CDetector::FetchStationGroups(), atm::GOESDB::GetAllCloudProbabilities(), rdet::AntennaType::GetAntennaData(), fdet::Camera::GetCameraChannelData(), fdet::Camera::GetCameraData(), fdet::Camera::GetCameraDataDiaphragm(), fdet::Camera::GetCameraPixelData(), fdet::Channel::GetChannelData(), rdet::Channel::GetChannelData(), atm::LidarZone::GetCloudData(), fdet::Corrector::GetCorrectorData(), rdet::RDetector::GetDetectorData(), fdet::Diaphragm::GetDiaphragmData(), fdet::Eye::GetEyeData(), fdet::FDetector::GetFDetectorData(), fdet::Filter::GetFilterData(), fdet::FDetector::GetFullEyeList(), rdet::RDetector::GetFullStationList(), cdet::CDetector::GetFullStationList(), atm::VZoneSlice::GetLambdaSliceData(), atm::MolecularLayer::GetLayerData(), fdet::Mirror::GetMirrorData(), fdet::MirrorSegment::GetMirrorSegmentData(), fdet::Pixel::GetPixelData(), fdet::Pixel::GetPixelDataDiaphragm(), cdet::Station::GetRPCData(), sdet::Scintillator::GetScintillatorData(), atm::VZoneSlice::GetSliceData(), rdet::RSimulationStationListManager::GetSourceType(), cdet::CDetector::GetStation(), rdet::Station::GetStationData(), cdet::Station::GetStationData(), fdet::Telescope::GetTelescopeData(), atm::GOESDB::HasData(), atm::LidarDB::LidarDB(), atm::LidarZone::LidarZone(), atm::MolecularDB::MolecularDB(), atm::MolecularZone::MolecularZone(), rdet::Station::SetListOfChannelIds(), and det::ComponentGroup< P, C, Creator, ManagerProvider >::Update().

virtual Status det::VManager::GetData ( int &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( bool &  ,
const std::string &  componentProperty,
const std::string &  componentName,
const VManager::IndexMap  
) const
inlinevirtualinherited

Definition at line 241 of file VManager.h.

virtual Status det::VManager::GetData ( std::string &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::vector< double > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::vector< int > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::vector< std::string > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::vector< bool > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::list< double > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::list< int > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::list< std::string > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::list< std::pair< int, int >> &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( utl::TabulatedFunction returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::map< int, utl::TabulatedFunction > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( utl::TabulatedFunctionComplexLgAmpPhase returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::map< std::string, double > &  returnData,
const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
) const
pure virtualinherited
virtual Status det::VManager::GetData ( std::vector< std::vector< int >> &  ,
const std::string &  componentProperty,
const std::string &  componentName,
const VManager::IndexMap  
) const
inlinevirtualinherited

Definition at line 255 of file VManager.h.

virtual Status det::VManager::GetData ( std::map< unsigned int, int > &  ,
const std::string &  componentProperty,
const std::string &  componentName,
const VManager::IndexMap  
) const
inlinevirtualinherited

Definition at line 256 of file VManager.h.

Status det::VManager::GetData ( Handle returnData,
const std::string &  component,
const std::string &  property,
const IndexMap index = IndexMap() 
) const
inlineinherited

new data accessor

Any property of the detector is supposed to be accessible through this interface. Interface specifies the name of the property and the component to which it belongs, together with a map of (index name, index value) identifying the specific instance of the component. For example, to request the quantum efficiency of PMT 3 in station 57, one would have

  • component = "PMT"
  • property = "quantumEfficiency"
  • index["stationId"] = "57"
  • index["PMT"] = "3"

Definition at line 275 of file VManager.h.

References det::VManager::CheckedGetData().

template<typename T >
Status det::VSQLManager::GetDBData ( T &  returnData,
const std::string &  tableName,
const std::string &  columnName,
const IndexMap componentIndex 
) const
inlineprotected

Definition at line 101 of file VSQLManager_SQLite.h.

References eNotFound, FetchRow(), and GetDBResFundamental().

template<typename T >
Status det::VSQLManager::GetDBData ( std::vector< T > &  returnData,
const std::string &  tableName,
const std::string &  columnName,
const IndexMap componentIndex 
) const
inlineprotected

Definition at line 120 of file VSQLManager_SQLite.h.

References eNotFound, FetchColumn(), and GetDBResVector().

template<typename T >
Status det::VSQLManager::GetDBData ( T &  returnData,
const std::string &  tableName,
const std::string &  columnName,
const IndexMap componentIndex 
) const
inlineprotected

Definition at line 182 of file VSQLManager_MySQL.h.

References eNotFound, FetchRow(), and GetDBResFundamental().

template<typename T >
Status det::VSQLManager::GetDBData ( std::vector< T > &  returnData,
const std::string &  tableName,
const std::string &  columnName,
const IndexMap componentIndex 
) const
inlineprotected

Definition at line 202 of file VSQLManager_MySQL.h.

References eNotFound, FetchColumn(), and GetDBResVector().

virtual Status det::VSQLManager::GetDBResFundamental ( const std::string &  ,
const std::string &  ,
const IndexMap  
) const
inlineprotectedvirtual

overload this in all derived managers that need it

Reimplemented in atm::AMolecularSQLManager, atm::AOverallQualitySQLManager, atm::ACloudSQLManager, atm::ALidarSQLManager, and atm::AGOESSQLManager.

Definition at line 94 of file VSQLManager_SQLite.h.

References eNotFound, and ERROR().

virtual Status det::VSQLManager::GetDBResFundamental ( const std::string &  ,
const std::string &  ,
const IndexMap  
) const
inlineprotectedvirtual

overload this in all derived managers that need it

Reimplemented in atm::AMolecularSQLManager, atm::AOverallQualitySQLManager, atm::ACloudSQLManager, atm::ALidarSQLManager, and atm::AGOESSQLManager.

Definition at line 177 of file VSQLManager_MySQL.h.

References eNotFound, and ERROR().

Referenced by GetDBData().

virtual Status det::VSQLManager::GetDBResVector ( const std::string &  ,
const std::string &  ,
const IndexMap  
) const
inlineprotectedvirtual

overload this in all derived managers that need it

Reimplemented in atm::AMolecularSQLManager, and atm::ALidarSQLManager.

Definition at line 113 of file VSQLManager_SQLite.h.

References eNotFound, and ERROR().

virtual Status det::VSQLManager::GetDBResVector ( const std::string &  ,
const std::string &  ,
const IndexMap  
) const
inlineprotectedvirtual

overload this in all derived managers that need it

Reimplemented in atm::AMolecularSQLManager, and atm::ALidarSQLManager.

Definition at line 195 of file VSQLManager_MySQL.h.

References eNotFound, and ERROR().

Referenced by GetDBData().

const std::string& det::VManager::GetName ( ) const
inlineinherited
det::VSQLManager::if ( row &&  row[0])
inlineprotected

Definition at line 76 of file VSQLManager_MySQL.h.

References eFound, and FreeResult().

det::VSQLManager::if ( row  )
inlineprotected

Definition at line 97 of file VSQLManager_MySQL.h.

References eFound, ERROR(), FreeResult(), and NumFields().

det::VSQLManager::if ( row  )
inlineprotected

Definition at line 127 of file VSQLManager_MySQL.h.

References eNotFound, FetchRowTuple(), and FreeResult().

virtual void det::VSQLManager::Init ( const std::string &  configLink)
protectedvirtual

Manager Initialization. configLink is the CentralConfig hook for the configuration file.

This method instructs the manager to initialize itself. In the case of a manager which fetches data from an XML file, configuration involves getting the link to the appropriate configuration file from the CentralConfig and parsing the file to create a DOM or some other representation of the data in memory. For a manager which uses a MySQL database, configuration involves getting the link to the appropriate configuration file from the CentralConfig, then using the instructions in that file to establish a connection to the relevant database.

Note that one might initially think it makes more sense to just initialize managers automatically in their constructors so that developers don't need to remember to explicitly invoke the Init() method. (In fact it worked like this in an earlier version.) The rationale for not having automatic configuration via the constructors is that the configuration can now be delayed until the time that the user specifically requests a particular manager, rather than doing it at the time that the Detector object constructs the Managers. For example, when the user declares his set of desired managers in the ManagerRegister configuration, only those particular Managers will get initialized (though all available Managers will be constructed!). Consider someone who wants to test only the Fluorescence portion of the detector. By requiring explicit invocation of Init() one avoids providing hooks to all the SD related configuration files and databases which aren't even going to be used. Though the SD Managers will be constructed, no attempt will be made to Initialize them until the user specifically requests them by, for example, specifying them in the configuration file for the appropriate ManagerRegister.

Reimplemented from det::VManager.

Reimplemented in rdet::RChannelSQLManager, fdet::FdUpTimeSQLManager, rdet::RBadStationSQLManager, rdet::RBeaconSQLManager, rdet::RSimulationStationListManager, fdet::FCalibSQLManager, rdet::MonitoringSQLManager, rdet::RStationListSQLManager, fdet::FOpticalEfficiencyLossSQLManager, and sdet::SStationListSQLManager.

void VSQLManager::Init ( const std::string &  configLink)
protectedvirtual

Manager Initialization. configLink is the CentralConfig hook for the configuration file.

This method instructs the manager to initialize itself. In the case of a manager which fetches data from an XML file, configuration involves getting the link to the appropriate configuration file from the CentralConfig and parsing the file to create a DOM or some other representation of the data in memory. For a manager which uses a MySQL database, configuration involves getting the link to the appropriate configuration file from the CentralConfig, then using the instructions in that file to establish a connection to the relevant database.

Note that one might initially think it makes more sense to just initialize managers automatically in their constructors so that developers don't need to remember to explicitly invoke the Init() method. (In fact it worked like this in an earlier version.) The rationale for not having automatic configuration via the constructors is that the configuration can now be delayed until the time that the user specifically requests a particular manager, rather than doing it at the time that the Detector object constructs the Managers. For example, when the user declares his set of desired managers in the ManagerRegister configuration, only those particular Managers will get initialized (though all available Managers will be constructed!). Consider someone who wants to test only the Fluorescence portion of the detector. By requiring explicit invocation of Init() one avoids providing hooks to all the SD related configuration files and databases which aren't even going to be used. Though the SD Managers will be constructed, no attempt will be made to Initialize them until the user specifically requests them by, for example, specifying them in the configuration file for the appropriate ManagerRegister.

Reimplemented from det::VManager.

Reimplemented in rdet::RChannelSQLManager, fdet::FdUpTimeSQLManager, rdet::RBadStationSQLManager, rdet::RBeaconSQLManager, rdet::RSimulationStationListManager, fdet::FCalibSQLManager, rdet::MonitoringSQLManager, rdet::RStationListSQLManager, fdet::FOpticalEfficiencyLossSQLManager, and sdet::SStationListSQLManager.

Definition at line 41 of file VSQLManager_MySQL.cc.

References utl::Branch::GetChild(), utl::Branch::GetData(), INFO, and fwk::CoordinateSystemRegistry::Init().

bool det::VManager::IsInitialized ( ) const
inlineinherited

Definition at line 214 of file VManager.h.

References det::VManager::fIsInitialized.

Referenced by det::ManagerRegister::InterpretXML().

bool det::VManager::IsReportingErrors ( ) const
inlineprotectedinherited
string VSQLManager::MergeIndexMap ( const IndexMap componentIndex)
staticprotected
string det::VManager::NotImplementedMessage ( const std::string &  type,
const std::string &  componentProperty,
const std::string &  componentName 
) const
protectedinherited

Definition at line 47 of file VManager.cc.

unsigned int det::VSQLManager::NumFields ( ) const
inlineprotected

Definition at line 90 of file VSQLManager_SQLite.h.

References fResult.

unsigned int det::VSQLManager::NumFields ( ) const
inlineprotected

Number of fields (columns) in the current query result.

Definition at line 169 of file VSQLManager_MySQL.h.

Referenced by if().

size_t det::VSQLManager::NumRows ( ) const
inlineprotected

Total number of rows in the current query result.

Definition at line 173 of file VSQLManager_MySQL.h.

VSQLManager& det::VSQLManager::operator= ( const VSQLManager )
private
VSQLManager& det::VSQLManager::operator= ( const VSQLManager )
private
Status det::VSQLManager::Query ( const std::ostringstream &  os,
const std::string &  what = "" 
) const
inlineprotected

query MySQL

Definition at line 56 of file VSQLManager_SQLite.h.

References Query().

Status det::VSQLManager::Query ( const std::string &  query,
const std::string &  what = "" 
) const
protected
Status det::VSQLManager::Query ( const std::ostringstream &  os,
const std::ostringstream &  what 
) const
inlineprotected

Definition at line 61 of file VSQLManager_SQLite.h.

References Query().

Status det::VSQLManager::Query ( const std::ostringstream &  os,
const std::string &  what = "" 
) const
inlineprotected
VManager::Status VSQLManager::Query ( const std::string &  query,
const std::string &  what = "" 
) const
protected

Definition at line 159 of file VSQLManager_MySQL.cc.

References ERROR, galactic::second, and WARNING.

Status det::VSQLManager::Query ( const std::ostringstream &  os,
const std::ostringstream &  what 
) const
inlineprotected

Definition at line 66 of file VSQLManager_MySQL.h.

References Query().

string det::VManager::QueryInfoMessage ( const Handle returnData,
const std::string &  component 
)
staticinherited
string det::VManager::QueryInfoMessage ( const Handle returnData,
const std::string &  component,
const std::string &  property,
const IndexMap index 
)
staticinherited

Definition at line 119 of file VManager.cc.

static std::string det::VManager::QueryInfoMessage ( const std::string &  componentProperty,
const std::string &  componentName 
)
inlinestaticinherited

Definition at line 294 of file VManager.h.

string det::VManager::QueryInfoMessage ( const std::string &  componentProperty,
const std::string &  componentName,
const IndexMap componentIndex 
)
staticinherited

Definition at line 58 of file VManager.cc.

static void det::VSQLManager::SetGlobalLogQueries ( const int  q)
inlinestatic

Definition at line 51 of file VSQLManager_MySQL.h.

References fgGlobalLogQueries.

Referenced by main().

void det::VManager::SetName ( const std::string &  name)
inlineinherited

Definition at line 332 of file VManager.h.

References det::VManager::fName.

Referenced by det::ManagerRegister::InterpretXML().

void det::VManager::SetReportingErrors ( const bool  flag = true)
inlineinherited

Generic data accessors.

Any property of the detector is supposed to be accessible through this interface. Interface specifies the name of the property and the component to which it belongs, together with a map of (index name, index value) identifying the specific instance of the component. For example, to request the quantum efficiency of PMT 3 in station 57, one would have

  • componentProperty = "quantumEfficiency"
  • componentName = "PMT"
  • componentIndex["stationId"] = "57"
  • componentIndex["PMT"] = "3"

Definition at line 231 of file VManager.h.

References det::VManager::fReportingErrors.

throw det::VSQLManager::utl::IOFailureException ( err  )
private
det::VSQLManager::while ( (row=FetchRow())  )
inlineprotected

Definition at line 144 of file VSQLManager_MySQL.h.

Member Data Documentation

template<typename T >
Status det::VSQLManager::const
protected
Initial value:
{
const MYSQL_ROW row = FetchRow()

Fetch first item from first row and optionally free query result.

Fetch first item from many rows and free query result.

Fetch tuple from first row and optionally free query result.

Fetch whole row and optionally free query result.

Definition at line 74 of file VSQLManager_MySQL.h.

Status det::VSQLManager::const
protected
Initial value:
{
if (fMySQLResult) {
mysql_free_result(fMySQLResult);
fMySQLResult = nullptr;
}
}
static std::string MergeIndexMap(const IndexMap& componentIndex)

Fetch tuple from first row and optionally free query result.

Definition at line 219 of file VSQLManager_MySQL.h.

MYSQL_RES* det::VSQLManager::const
private
Initial value:
{
return fMySQLResult

Definition at line 232 of file VSQLManager_MySQL.h.

return det::VSQLManager::eFound
protected
det::VSQLManager::else
protected
Initial value:

Definition at line 151 of file VSQLManager_MySQL.h.

return det::VSQLManager::eNotFound
protected
const std::string det::VSQLManager::err = "Empty MySQL result queue."
private

Definition at line 235 of file VSQLManager_MySQL.h.

Referenced by BadLexicalCast().

std::set<std::string> det::VManager::fAvailableComponents
protectedinherited
utl::Branch det::VManager::fBranch
protectedinherited
std::string det::VSQLManager::fDatabaseName
mutableprivate

Database filename.

Definition at line 295 of file VSQLManager_MySQL.h.

std::string det::VSQLManager::fDatabasePassword
mutableprivate

Definition at line 294 of file VSQLManager_MySQL.h.

std::string det::VSQLManager::fDatabaseServer
mutableprivate

Definition at line 292 of file VSQLManager_MySQL.h.

std::string det::VSQLManager::fDatabaseSoftwareVersion
mutableprotected
std::string det::VSQLManager::fDatabaseUserName
mutableprivate

Definition at line 293 of file VSQLManager_MySQL.h.

sqlite3* det::VSQLManager::fDb = nullptr
private

SQLite database object pointer.

Definition at line 149 of file VSQLManager_SQLite.h.

int det::VSQLManager::fgGlobalLogQueries = 0
staticprivate

Definition at line 305 of file VSQLManager_MySQL.h.

Referenced by SetGlobalLogQueries().

bool det::VManager::fIsInitialized = false
mutableprotectedinherited

Definition at line 354 of file VManager.h.

Referenced by det::VManager::IsInitialized().

int det::VSQLManager::fLogQueries = 0
mutableprivate

Definition at line 303 of file VSQLManager_MySQL.h.

std::ofstream* det::VSQLManager::fLogQueryStream = nullptr
mutableprivate

Definition at line 304 of file VSQLManager_MySQL.h.

MYSQL* det::VSQLManager::fMySQL = nullptr
mutableprivate

Definition at line 299 of file VSQLManager_MySQL.h.

MYSQL_RES* det::VSQLManager::fMySQLResult = nullptr
mutableprivate

Definition at line 300 of file VSQLManager_MySQL.h.

int det::VSQLManager::fPort = -1
mutableprivate

Definition at line 297 of file VSQLManager_MySQL.h.

bool det::VManager::fReportingErrors = false
protectedinherited
sqlite3_stmt* det::VSQLManager::fResult = nullptr
mutableprivate

Storage for SQLite query results.

Definition at line 150 of file VSQLManager_SQLite.h.

Referenced by NumFields().

utl::RealTimeStopwatch det::VSQLManager::fTime {false}
mutableprivate

Definition at line 302 of file VSQLManager_MySQL.h.


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

, generated on Tue Sep 26 2023.