|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |
#include <SmartRefBase.h>

Public Types | |
| enum | { DATAOBJECT, CONTAINEDOBJECT } |
Public Member Functions | |
| const ContainedObject * | accessData (const ContainedObject *typ) const |
| Load on demand of ContainedObject like references. | |
| const DataObject * | accessData (const DataObject *typ) const |
| Load on demand of DataObject like references. | |
| bool | isEqualEx (const DataObject *pObj, const SmartRefBase &c) const |
| Extended equality check. | |
| bool | isEqualEx (const ContainedObject *pObj, const SmartRefBase &c) const |
| Extended equality check. | |
| bool | isEqual (const ContainedObject *, const SmartRefBase &c) const |
| Equality operator for ContainedObject like references. | |
| bool | isEqual (const DataObject *, const SmartRefBase &c) const |
| Equality operator for DataObject like references. | |
| void | writeObject (const DataObject *pObject, StreamBuffer &s) const |
| Output streamer for DataObject like references. | |
| void | writeObject (const ContainedObject *pObject, StreamBuffer &s) const |
| Output streamer for ContainedObject like references. | |
| DataObject * | readObject (const DataObject *, StreamBuffer &s) const |
| Input streamer for DataObject like references. | |
| ContainedObject * | readObject (const ContainedObject *, StreamBuffer &s) const |
| Output streamer for ContainedObject like references. | |
| void | setObjectType (const ContainedObject *) const |
| void | setObjectType (const DataObject *) const |
| const std::string & | path () const |
| Shortcut to access the path to the linked object. | |
| int | objectType () const |
| void | set (DataObject *pObj, long hint_id, long link_id) |
| Setup smart reference when reading. Must be allowed from external sources. | |
Public Attributes | |
| long | m_hintID |
| Object data: ID of the link hint to the identifiable object. | |
| long | m_linkID |
| Object data: ID of the object within the identifiable container (if any). | |
| const DataObject * | m_data |
| Object data: Pointer to the identifiable object the link originates. | |
| const ContainedObject * | m_contd |
| Object data: Pointer to the Contained object (if applicable). | |
| long | m_type |
Description: Base class of SmartReference objects. The base class handles the object requests to the data store. The separation of the SmartReference and the base class is mainly to avoid code blow up, because if the object is not yet present serious work must be performed in order to request the object from the store and invoke object updates to keep pointers in sync.
Base Class: None
Dependencies: None
History :
+---------+----------------------------------------------+--------+
| Date | Comment | Who |
+---------+----------------------------------------------+--------+
| 21/06/99| Initial version. | MF |
+---------+----------------------------------------------+--------+
Author: M.Frank Version: 1.0
Definition at line 47 of file SmartRefBase.h.
| anonymous enum |
| const ContainedObject * SmartRefBase::accessData | ( | const ContainedObject * | typ | ) | const |
Load on demand of ContainedObject like references.
Load on demand: ContainedObject type references.
Definition at line 35 of file SmartRefBase.cpp.
00035 { 00036 if ( m_hintID != StreamBuffer::INVALID && m_linkID != StreamBuffer::INVALID ) { 00037 const _Container* cnt = dynamic_cast<const _Container*>(accessData(m_data)); 00038 if ( 0 != cnt ) { 00039 return cnt->containedObject(m_linkID); 00040 } 00041 } 00042 return 0; 00043 }
| const DataObject * SmartRefBase::accessData | ( | const DataObject * | typ | ) | const |
Load on demand of DataObject like references.
Load on demand: DataObject type references.
Definition at line 46 of file SmartRefBase.cpp.
00046 { 00047 DataObject* target = 0; 00048 DataObject* source =0; 00049 if ( 0 == m_data && 0 != m_contd ) { 00050 m_data = m_contd->parent(); 00051 } 00052 source = const_cast<DataObject*>(m_data); 00053 if ( m_hintID != StreamBuffer::INVALID && source != 0 ) { 00054 LinkManager* mgr = source->linkMgr(); 00055 if ( 0 != mgr ) { 00056 LinkManager::Link* link = mgr->link(m_hintID); 00057 if ( 0 != link ) { 00058 target = link->object(); 00059 if ( 0 == target ) { 00060 IRegistry* reg = source->registry(); 00061 if ( 0 != reg ) { 00062 IDataProviderSvc* datasvc = reg->dataSvc(); 00063 if ( 0 != datasvc ) { 00064 if ( datasvc->retrieveObject(link->path(), target).isSuccess() ) { 00065 link->setObject(target); 00066 } 00067 } 00068 } 00069 } 00070 } 00071 } 00072 } 00073 return target; 00074 }
| bool SmartRefBase::isEqualEx | ( | const DataObject * | pObj, | |
| const SmartRefBase & | c | |||
| ) | const |
Extended equality check.
Definition at line 77 of file SmartRefBase.cpp.
00077 { 00078 if ( c.m_hintID != StreamBuffer::INVALID && 0 != pObj ) { 00079 DataObject* source = const_cast<DataObject*>(c.m_data); 00080 if ( 0 != source ) { 00081 LinkManager* mgr = source->linkMgr(); 00082 if ( 0 != mgr ) { 00083 LinkManager::Link* link = mgr->link(c.m_hintID); 00084 if ( 0 != link ) { 00085 IRegistry* pReg = pObj->registry(); 00086 if ( pReg != 0 ) { 00087 return link->path() == pReg->identifier(); 00088 } 00089 } 00090 } 00091 } 00092 } 00093 return false; 00094 }
| bool SmartRefBase::isEqualEx | ( | const ContainedObject * | pObj, | |
| const SmartRefBase & | c | |||
| ) | const |
| bool SmartRefBase::isEqual | ( | const ContainedObject * | , | |
| const SmartRefBase & | c | |||
| ) | const [inline] |
| bool SmartRefBase::isEqual | ( | const DataObject * | , | |
| const SmartRefBase & | c | |||
| ) | const [inline] |
| void SmartRefBase::writeObject | ( | const DataObject * | pObject, | |
| StreamBuffer & | s | |||
| ) | const [inline] |
Output streamer for DataObject like references.
Definition at line 81 of file SmartRefBase.h.
00081 { 00082 s.addIdentifiedLink(pObject, m_hintID); 00083 }
| void SmartRefBase::writeObject | ( | const ContainedObject * | pObject, | |
| StreamBuffer & | s | |||
| ) | const [inline] |
Output streamer for ContainedObject like references.
Definition at line 85 of file SmartRefBase.h.
00085 { 00086 s.addContainedLink(pObject, m_hintID, m_linkID); 00087 }
| DataObject* SmartRefBase::readObject | ( | const DataObject * | , | |
| StreamBuffer & | s | |||
| ) | const [inline] |
Input streamer for DataObject like references.
Definition at line 89 of file SmartRefBase.h.
00089 { 00090 DataObject* pObj = 0; 00091 s.getIdentifiedLink(pObj, m_hintID); 00092 return pObj; 00093 }
| ContainedObject* SmartRefBase::readObject | ( | const ContainedObject * | , | |
| StreamBuffer & | s | |||
| ) | const [inline] |
Output streamer for ContainedObject like references.
Definition at line 95 of file SmartRefBase.h.
00095 { 00096 ContainedObject* pObj = 0; 00097 s.getContainedLink(pObj, m_hintID, m_linkID); 00098 return pObj; 00099 }
| void SmartRefBase::setObjectType | ( | const ContainedObject * | ) | const [inline] |
| void SmartRefBase::setObjectType | ( | const DataObject * | ) | const [inline] |
| const std::string & SmartRefBase::path | ( | ) | const |
Shortcut to access the path to the linked object.
Definition at line 104 of file SmartRefBase.cpp.
00104 { 00105 static std::string s_empty_string = std::string(); 00106 DataObject *source = 0; 00107 if ( 0 == m_data && 0 != m_contd ) { 00108 m_data = m_contd->parent(); 00109 } 00110 source = const_cast<DataObject*>(m_data); 00111 if ( m_hintID != StreamBuffer::INVALID && source != 0 ) { 00112 LinkManager* mgr = source->linkMgr(); 00113 if ( 0 != mgr ) { 00114 LinkManager::Link* link = mgr->link(m_hintID); 00115 if ( 0 != link ) 00116 return link->path(); 00117 } 00118 } 00119 return s_empty_string; 00120 }
| int SmartRefBase::objectType | ( | ) | const [inline] |
| void SmartRefBase::set | ( | DataObject * | pObj, | |
| long | hint_id, | |||
| long | link_id | |||
| ) |
Setup smart reference when reading. Must be allowed from external sources.
Setup smart reference.
Definition at line 28 of file SmartRefBase.cpp.
long SmartRefBase::m_hintID [mutable] |
Object data: ID of the link hint to the identifiable object.
Definition at line 50 of file SmartRefBase.h.
long SmartRefBase::m_linkID [mutable] |
Object data: ID of the object within the identifiable container (if any).
Definition at line 52 of file SmartRefBase.h.
const DataObject* SmartRefBase::m_data [mutable] |
Object data: Pointer to the identifiable object the link originates.
Definition at line 54 of file SmartRefBase.h.
const ContainedObject* SmartRefBase::m_contd [mutable] |
Object data: Pointer to the Contained object (if applicable).
Definition at line 56 of file SmartRefBase.h.
long SmartRefBase::m_type [mutable] |
Definition at line 58 of file SmartRefBase.h.