2 #ifndef GAUDIKERNEL_REFTABLE_H
3 #define GAUDIKERNEL_REFTABLE_H 1
7 #include "GaudiKernel/Kernel.h"
8 #include "GaudiKernel/DataObject.h"
9 #include "GaudiKernel/StreamBuffer.h"
10 #include "GaudiKernel/SmartRefVector.h"
11 #include "GaudiKernel/SmartRef.h"
12 #include "GaudiKernel/HashMap.h"
15 static const CLID CLID_RefTable1to1 = 300;
16 static const CLID CLID_RefTable1toN = 301;
76 return m_table.insert( from, to );
80 iterator
i = m_table.find( from );
82 return &((*i).second);
87 const EntryType*
i_reference(
const KeyType* from)
const {
88 const_iterator i = m_table.find( from );
89 if ( i != m_table.end() ) {
90 return &((*i).second);
104 virtual void clear() {
109 return m_table.begin();
112 const_iterator
begin()
const {
113 return m_table.begin();
117 return m_table.end();
120 const_iterator
end()
const {
121 return m_table.end();
125 return m_table.size();
129 m_table.reserve(len);
133 DataObject::serialize(s) << m_table.
size();
145 DataObject::serialize(s) >> siz;
174 bool insert (
const FROM* from, TO* to ) {
178 bool insert (
const FROM* from,
const EntryType& to) {
188 return (0 == e) ? 0 : (*e);
192 const TO*
reference(
const FROM* from)
const {
194 return (0 == e) ? 0 : (*e);
200 return (e == 0) ?
false : ((*e) == to);
203 bool isReferenced(
const FROM* from,
const EntryType& to ) {
205 return (assoc!=0) ? ((*e)!=to) ? (e->target()==to.target()) :
false :
false;
224 bool insert (
const FROM* from, TO* to) {
229 if ( !( 0 == newEntry) ) {
244 if ( !(0 == newEntry) ) {
245 newEntry->push_back( to );
250 entry->push_back( to );
254 bool insert (
const FROM* from,
const EntryType& to) {
259 static EntryType empty;
261 return (0 == e) ? empty : *e;
264 const EntryType&
reference(
const FROM* from)
const {
265 static EntryType empty;
267 return (0 == e) ? empty : (*e);
270 bool isReferenced(
const FROM* from,
const EntryType& to ) {
272 return (0 == e) ?
false : (*e == to);
283 return (i == e->end()) ?
false :
true;
290 #endif // GAUDIKERNEL_REFTABLE_H
CLID m_clid
Class id of the reference table.
RefTableBase< FROM, EntryType > BaseType
virtual ~RefTableBase()
Destructor.
iterator begin()
Start of direct access iterator.
The stream buffer is a small object collecting object data.
GaudiUtils::HashMap< const void *, EntryType > TableType
Define Reference map.
TableType::const_iterator const_iterator
Definition of map iterator (CONST)
SmartRef< KeyType > m_fromRef
This is a completely useless entry, but the compiler wants it to be instantiated before the serialize...
TO * reference(const FROM *from)
Find Reference from it's source entry.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Kernel objects: SmartRefVector.
EntryType * i_reference(const KeyType *from)
Find Reference from it's source entry.
void reserve(long len)
Reserve buffer space; Default: 16 k buffer size.
void reserve(int len)
Size of References.
long size() const
Size of References.
TableType::iterator iterator
Definition of map iterator.
iterator end()
End of direct access iterator.
RefTableBase(const CLID &clid, int len)
Constructors.
virtual ~RefTable1to1()
Standard Destructor.
RefTable1toN(const CLID &clid, int len=16)
Standard Constructor.
map_type::const_iterator const_iterator
unsigned int CLID
Class ID definition.
virtual void clear()
Clear Reference map.
virtual StreamBuffer & serialize(StreamBuffer &s) const
Serialize the object for writing.
TableType m_table
Reference map.
map_type::iterator iterator
virtual ~RefTable1toN()
Standard Destructor.
RefTable1to1(const CLID &clid, int len=16)
Standard Constructor.
bool insert(const FROM *from, TO *to)
Insert new Entry into Reference container.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
bool insertMapElement(const KeyType *from, EntryType &to)
Insert new Entry into Reference container.
bool isReferenced(const FROM *from, const TO *to)
Check if two entries are associated to each other.
EntryType & reference(const FROM *from)
Find Reference from it's source entry.
A DataObject is the base class of any identifiable object on any data store.
long size() const
Total buffer size.
bool isReferenced(const FROM *from, const EntryType &to)
Check if two entries are Referenced to each other.
bool insert(const FROM *from, TO *to)
Insert new Entry into Reference container.