10#include <framework/database/DBArray.h>
24 template<
class T,
typename KEY, KEY(T::*METHOD)() const, const std::
string& NAME = DBPo
inter_defaultName>
class DBPointer {
38 inline operator KEY()
const {
return m_key;}
50 inline operator bool()
const {
return isValid();}
Class for accessing arrays of objects in the database.
const T * getByKey(KEY(T::*method)(void) const, KEY key) const
Access object by key instead of by index.
Class for pointing to an element in an array stored in the database.
const T & operator*() const
Imitate pointer functionality.
KEY m_key
Key value of the referred array element.
DBPointer(KEY key)
Constructor of pointer to an array element in the database.
bool isValid() const
Check whether we point to a valid object.
const T * getPointer() const
Find the referred object and set m_object to it.
KEY key() const
Accessor for key value.
KEY operator=(KEY key)
Setter for key value.
const T * operator->() const
Imitate pointer functionality.
const T * m_object
Pointer to actual object.
std::string DBPointer_defaultName
Use default name for array in DBPointer.
Abstract base class for different kinds of events.