Belle II Software  release-08-01-10
DBPointer< T, KEY, METHOD, NAME > Class Template Reference

Class for pointing to an element in an array stored in the database. More...

#include <DBPointer.h>

Public Member Functions

 DBPointer (KEY key)
 Constructor of pointer to an array element in the database. More...
 
KEY key () const
 Accessor for key value.
 
 operator KEY () const
 Accessor for key value.
 
KEY operator= (KEY key)
 Setter for key value.
 
bool isValid () const
 Check whether we point to a valid object. More...
 
 operator bool () const
 Is this pointer's data safe to access?
 
const T & operator* () const
 Imitate pointer functionality.
 
const T * operator-> () const
 Imitate pointer functionality.
 

Private Member Functions

const T * getPointer () const
 Find the referred object and set m_object to it.
 

Private Attributes

KEY m_key
 Key value of the referred array element.
 
const T * m_object
 Pointer to actual object.
 

Detailed Description

template<class T, typename KEY, KEY(T::*)() const METHOD, const std::string & NAME = DBPointer_defaultName>
class Belle2::DBPointer< T, KEY, METHOD, NAME >

Class for pointing to an element in an array stored in the database.

Definition at line 24 of file DBPointer.h.

Constructor & Destructor Documentation

◆ DBPointer()

DBPointer ( KEY  key)
inlineexplicit

Constructor of pointer to an array element in the database.

Parameters
keyThe key value to identify the element.

Definition at line 31 of file DBPointer.h.

31  :
32  m_key(key), m_object(0) {};
KEY m_key
Key value of the referred array element.
Definition: DBPointer.h:67
KEY key() const
Accessor for key value.
Definition: DBPointer.h:35
const T * m_object
Pointer to actual object.
Definition: DBPointer.h:70

Member Function Documentation

◆ isValid()

bool isValid ( ) const
inline

Check whether we point to a valid object.

Returns
True if the object exists.

Definition at line 47 of file DBPointer.h.


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