Go to the documentation of this file.
20 #ifndef KERNEL_SMARTREF_H
21 #define KERNEL_SMARTREF_H 1
106 SmartRef(
long hint,
long link,
const TYPE* obj =
nullptr ) {
159 return const_cast<TYPE*
>(
m_target );
184 explicit operator bool()
const {
return target() !=
nullptr; }
258 #endif // KERNEL_SMARTREF_H
const SmartRef< TYPE > & operator()(const ContainedObject *pObj) const
operator() const: assigns parent object for serialisation
const TYPE * operator->() const
Dereference operator to const object.
friend bool operator!=(const SmartRef< TYPE > &ref, std::nullptr_t)
SmartRef< TYPE > & operator()(ContainedObject *pObj)
operator(): assigns parent object for serialisation
const TYPE * m_target
Pointer to target data object.
SmartRef< TYPE > & operator=(const TYPE *pObject)
Assignment.
TYPE & operator*()
Dereference operator.
TYPE * operator->()
Dereference operator.
bool operator==(const SmartRef< TYPE > &c) const
Equality operator.
const TYPE * data() const
bool shouldFollowLink(const ContainedObject *) const
Check if link should be followed: link must be valid and object not yet loaded.
User example objects: SmartRefBase.
long m_linkID
Object data: ID of the object within the identifiable container (if any)
StreamBuffer & readRef(StreamBuffer &s)
Read the reference from the stream buffer (needed due to stupid G++ compiler)
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
long hintID() const
Access hint id:
long linkID() const
Access link id:
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
const std::string & path() const
Return the path of the linked object inside the data store.
TYPE * target()
Access to the object.
friend StreamBuffer & operator>>(StreamBuffer &_s, SmartRef< TYPE > &ptr)
Input Streamer operator.
bool operator!=(const SmartRef< TYPE > &c) const
NON-Equality operator.
SmartRef< TYPE > & operator=(const SmartRef< TYPE > &c)
Assignment.
const SmartRef< TYPE > & operator()(const DataObject *pObj) const
operator() const: assigns parent object for serialisation
const std::string & path() const
Shortcut to access the path to the linked object.
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
void set(DataObject *pObj, long hint_id, long link_id)
Setup smart reference when reading. Must be allowed from external sources.
TYPE entry_type
Entry type definition.
long m_hintID
Object data: ID of the link hint to the identifiable object.
bool shouldFollowLink(const DataObject *) const
Check if link should be followed: link must be valid and object not yet loaded.
void set(DataObject *pObj, long hint_id, long link_id)
Setup smart reference when reading. Must be allowed from external sources.
const ObjectContainerBase * parent() const
Access to parent object.
friend bool operator==(std::nullptr_t, const SmartRef< TYPE > &ref)
Friend helper to check for object existence (will load object)
SmartRef(const TYPE *pObject=nullptr)
Standard Constructor.
void setObjectType(const ContainedObject *) const
friend bool operator==(const SmartRef< TYPE > &ref, std::nullptr_t)
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
const TYPE & operator*() const
Dereference operator.
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
friend bool operator!=(std::nullptr_t, const SmartRef< TYPE > &ref)
Friend helper to check for object existence (will load object)
SmartRef(const SmartRef ©)
Copy Constructor.
SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd)
Set the environment (CONST)
SmartRef(const DataObject *pObj, long hint, long link, const TYPE *obj=nullptr)
Constructor for references to contained objects passing environment.
const ContainedObject * accessData(const ContainedObject *typ) const
Load on demand of ContainedObject like references.
StreamBuffer & writeRef(StreamBuffer &s) const
Write the reference to the stream buffer (needed due to stupid G++ compiler)
SmartRef(long hint, long link, const TYPE *obj=nullptr)
Constructor.
friend StreamBuffer & operator<<(StreamBuffer &_s, const SmartRef< TYPE > &ptr)
Output Streamer operator.
Kernel objects: SmartRef.
SmartRef(const DataObject *pObj, long hint, const TYPE *obj=nullptr)
Constructor for references to DataObjects passing environment.
SmartRef(const ContainedObject *pObj, long hint, long link, const TYPE *obj=nullptr)
Constructor for references to contained objects passing environment.
bool isEqualEx(const DataObject *pObj, const SmartRefBase &c) const
Extended equality check.
TYPE * data()
Access to raw data pointer.
SmartRef< TYPE > & operator()(DataObject *pObj)
operator(): assigns parent object for serialisation
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
const TYPE * target() const
Access to the object.
const std::type_info * type() const
Access to embedded type.