10 #ifndef KERNEL_SMARTREF_H 11 #define KERNEL_SMARTREF_H 1 104 m_target =
const_cast<TYPE*
>( pObject );
116 SmartRef(
long hint,
long link, TYPE* obj =
nullptr )
163 void set(
DataObject* pObj,
long hint_id,
long link_id ) { m_base.
set( pObj, hint_id, link_id ); }
170 const TYPE*
target()
const;
252 friend StreamBuffer& operator<<( StreamBuffer& _s, const SmartRef<TYPE>& ptr ) {
return ptr.writeRef( _s ); }
268 template <
class TYPE>
274 return const_cast<TYPE*
>(
m_target );
278 template <
class TYPE>
288 template <
class TYPE>
296 template <
class TYPE>
304 template <
class TYPE>
307 return ref.
target() ==
nullptr;
311 template <
class TYPE>
314 return ref.
target() ==
nullptr;
318 template <
class TYPE>
321 return ref.
target() !=
nullptr;
325 template <
class TYPE>
328 return ref.
target() !=
nullptr;
331 #endif // KERNEL_SMARTREF_H SmartRef(const DataObject *pObj, long hint, TYPE *obj=nullptr)
Constructor for references to DataObjects passing environment.
SmartRef< TYPE > & operator=(const SmartRef< TYPE > &c)
Assignment.
TYPE entry_type
Entry type definition.
SmartRef()
Standard Constructor.
bool shouldFollowLink(const DataObject *) const
Standard destructor.
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
bool isEqualEx(const DataObject *pObj, const SmartRefBase &c) const
Extended equality check.
bool shouldFollowLink(const ContainedObject *) const
Check if link should be followed: link must be valid and object not yet loaded.
const ContainedObject * accessData(const ContainedObject *typ) const
Load on demand of ContainedObject like references.
const TYPE * operator->() const
Dereference operator to const object.
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
const std::string & path() const
Return the path of the linked object inside the data store.
The stream buffer is a small object collecting object data.
long m_hintID
Object data: ID of the link hint to the identifiable object.
const TYPE * target() const
Access to the object.
const SmartRef< TYPE > & operator()(const DataObject *pObj) const
operator() const: assigns parent object for serialisation
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
void setObjectType(const ContainedObject *) const
SmartRef(const DataObject *pObj, long hint, long link, TYPE *obj=nullptr)
Constructor for references to contained objects passing environment.
SmartRef(const SmartRef ©)
Copy Constructor.
const std::type_info * type() const
Access to embedded type.
long linkID() const
Access link id:
Kernel objects: SmartRef.
User example objects: SmartRefBase.
SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd)
Set the environment (CONST)
const ObjectContainerBase * parent() const
Access to parent object.
bool operator!=(const SmartRef< TYPE > &c) const
NON-Equality operator.
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
TYPE * data()
Access to raw data pointer.
const std::string & path() const
Shortcut to access the path to the linked object.
SmartRef(const ContainedObject *pObj, long hint, long link, TYPE *obj=nullptr)
Constructor for references to contained objects passing environment.
SmartRef< TYPE > & operator()(DataObject *pObj)
operator(): assigns parent object for serialisation
const SmartRef< TYPE > & operator()(const ContainedObject *pObj) const
operator() const: assigns parent object for serialisation
bool operator==(const SmartRef< TYPE > &c) const
Equality operator.
SmartRef< TYPE > & operator()(ContainedObject *pObj)
operator(): assigns parent object for serialisation
SmartRef< TYPE > & operator=(TYPE *pObject)
Assignment.
const TYPE * data() const
const TYPE * m_target
Pointer to target data object.
long m_linkID
Object data: ID of the object within the identifiable container (if any)
SmartRef(long hint, long link, TYPE *obj=nullptr)
Constructor.
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
long hintID() const
Access hint id:
TYPE & operator*()
Dereference operator.
TYPE * operator->()
Dereference operator.
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
void set(DataObject *pObj, long hint_id, long link_id)
Setup smart reference when reading. Must be allowed from external sources.
StreamBuffer & writeRef(StreamBuffer &s) const
Write the reference to the stream buffer (needed due to stupid G++ compiler)
A DataObject is the base class of any identifiable object on any data store.
friend StreamBuffer & operator>>(StreamBuffer &_s, SmartRef< TYPE > &ptr)
Input Streamer operator.
StreamBuffer & readRef(StreamBuffer &s)
Read the reference from the stream buffer (needed due to stupid G++ compiler)
const TYPE & operator*() const
Dereference operator.
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
SmartRef(const TYPE *pObject)
Standard Constructor with initialisation from const object.
SmartRef(TYPE *pObject)
Standard Constructor with initialisation.