| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

RefTable1toN< FROM, TO > Class Template Reference

#include <RefTable.h>

Inheritance diagram for RefTable1toN< FROM, TO >:

[legend]
Collaboration diagram for RefTable1toN< FROM, TO >:
[legend]
List of all members.

inline code of class DataObject

void setRegistry (IRegistry *pRegistry)
 Set pointer to Registry.
IRegistryregistry () const
 Get pointer to Registry.
LinkManagerlinkMgr () const
 Retrieve Link manager.
unsigned char version () const
 Retrieve version number of this object representation.
void setVersion (unsigned char vsn)
 Set version number of this object representation.
unsigned long refCount () const
 Return the refcount.
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the output stream (ASCII).
std::ostream & operator<< (std::ostream &s, const DataObject &obj)
 Output operator (ASCII).

Public Types

typedef FROM KeyType
typedef SmartRefVector< TO > EntryType
typedef RefTableBase< FROM,
EntryType
BaseType
typedef GaudiUtils::HashMap<
const void *, EntryType
TableType
 Define Reference map.
typedef TableType::iterator iterator
 Definition of map iterator.
typedef TableType::const_iterator const_iterator
 Definition of map iterator (CONST).

Public Member Functions

 RefTable1toN (const CLID &clid, int len=16)
 Standard Constructor.
virtual ~RefTable1toN ()
 Standard Destructor.
virtual const CLIDclID () const
 Retrieve reference to class definition structure.
bool insert (const FROM *from, TO *to)
 Insert new Entry into Reference container.
bool insert (const FROM *from, const SmartRef< TO > &to)
 Insert new Entry into Reference container.
bool insert (const FROM *from, const EntryType &to)
 Insert new Entry into Reference container.
EntryTypereference (const FROM *from)
 Find Reference from it's source entry.
const EntryTypereference (const FROM *from) const
 Find Reference from it's source entry (CONST).
bool isReferenced (const FROM *from, const EntryType &to)
 Check if two entries are Referenced to each other.
bool isReferenced (const FROM *from, const TO *to)
 Check if two entries are Referenced to each other.
bool isReferenced (const FROM *from, const SmartRef< TO > &to)
 Check if two entries are Referenced to each other.
virtual void clear ()
 Clear Reference map.
iterator begin ()
 Start of direct access iterator.
const_iterator begin () const
 Start of direct access iterator (CONST).
iterator end ()
 End of direct access iterator.
const_iterator end () const
 End of direct access iterator (CONST).
long size () const
 Size of References.
void reserve (int len)
 Size of References.
virtual StreamBufferserialize (StreamBuffer &s) const
 Serialize the object for writing.
virtual StreamBufferserialize (StreamBuffer &s)
 Serialize the object for reading.
virtual unsigned long addRef ()
 Add reference to object.
virtual unsigned long release ()
 release reference to object
const std::string & name () const
 Retreive DataObject name. It is the name when registered in the store.

Static Public Member Functions

static const CLIDclassID ()
 Retrieve reference to class definition structure (static access).

Public Attributes

CLID m_clid
 Class id of the reference table.

Protected Member Functions

bool insertMapElement (const KeyType *from, EntryType &to)
 Insert new Entry into Reference container.
EntryTypei_reference (const KeyType *from)
 Find Reference from it's source entry.
const EntryTypei_reference (const KeyType *from) const
 Find Reference from it's source entry (CONST).

Detailed Description

template<class FROM, class TO>
class RefTable1toN< FROM, TO >

Definition at line 209 of file RefTable.h.


Member Typedef Documentation

typedef FROM RefTableBase< FROM , SmartRefVector< TO > >::KeyType [inherited]

Definition at line 49 of file RefTable.h.

typedef SmartRefVector< TO > RefTableBase< FROM , SmartRefVector< TO > >::EntryType [inherited]

Definition at line 51 of file RefTable.h.

typedef RefTableBase<FROM , EntryType> RefTableBase< FROM , SmartRefVector< TO > >::BaseType [inherited]

Definition at line 53 of file RefTable.h.

typedef GaudiUtils::HashMap< const void* , EntryType > RefTableBase< FROM , SmartRefVector< TO > >::TableType [inherited]

Define Reference map.

Need to use index into vector, because location of vector entries is not fixed

Definition at line 57 of file RefTable.h.

typedef TableType::iterator RefTableBase< FROM , SmartRefVector< TO > >::iterator [inherited]

Definition of map iterator.

Definition at line 59 of file RefTable.h.

typedef TableType::const_iterator RefTableBase< FROM , SmartRefVector< TO > >::const_iterator [inherited]

Definition of map iterator (CONST).

Definition at line 61 of file RefTable.h.


Constructor & Destructor Documentation

template<class FROM, class TO>
RefTable1toN< FROM, TO >::RefTable1toN ( const CLID clid,
int  len = 16 
) [inline]

Standard Constructor.

Definition at line 213 of file RefTable.h.

00214   : RefTableBase< FROM , SmartRefVector<TO> >(clid, len)    {
00215   }

template<class FROM, class TO>
virtual RefTable1toN< FROM, TO >::~RefTable1toN (  )  [inline, virtual]

Standard Destructor.

Definition at line 217 of file RefTable.h.

00217                             {
00218   }


Member Function Documentation

template<class FROM, class TO>
virtual const CLID& RefTable1toN< FROM, TO >::clID (  )  const [inline, virtual]

Retrieve reference to class definition structure.

Reimplemented from DataObject.

Definition at line 220 of file RefTable.h.

00220                                           { 
00221     return m_clid; 
00222   }

template<class FROM, class TO>
bool RefTable1toN< FROM, TO >::insert ( const FROM *  from,
TO *  to 
) [inline]

Insert new Entry into Reference container.

Definition at line 224 of file RefTable.h.

00224                                              {
00225     EntryType* entry = i_reference(from);
00226     if ( 0 == entry )   {
00227       bool result = insertMapElement(from, EntryType());
00228       EntryType* newEntry = i_reference(from);
00229       if ( !( 0 == newEntry) )    {
00230         newEntry->push_back( SmartRef<TO>(to) );
00231         return true;
00232       }
00233       return false;
00234     }
00235     entry->push_back( SmartRef<TO>(to) );
00236     return true;
00237   }

template<class FROM, class TO>
bool RefTable1toN< FROM, TO >::insert ( const FROM *  from,
const SmartRef< TO > &  to 
) [inline]

Insert new Entry into Reference container.

Definition at line 239 of file RefTable.h.

00239                                                              {
00240     EntryType* entry = i_reference(from);
00241     if ( 0 == entry )   {
00242       bool result = insertMapElement(from, EntryType());
00243       EntryType* newEntry = i_reference(from);
00244       if ( !(0 == newEntry) )    {
00245         newEntry->push_back( to );
00246         return true;
00247       }
00248       return false;
00249     }
00250     entry->push_back( to );
00251     return true;
00252   }

template<class FROM, class TO>
bool RefTable1toN< FROM, TO >::insert ( const FROM *  from,
const EntryType to 
) [inline]

Insert new Entry into Reference container.

Definition at line 254 of file RefTable.h.

00254                                                           {
00255     return insertMapElement(from, const_cast<EntryType&>(to));
00256   }

template<class FROM, class TO>
EntryType& RefTable1toN< FROM, TO >::reference ( const FROM *  from  )  [inline]

Find Reference from it's source entry.

Definition at line 258 of file RefTable.h.

00258                                           {
00259     static EntryType empty;
00260     EntryType* e = i_reference(from);
00261     return (0 == e) ? empty : *e;
00262   }

template<class FROM, class TO>
const EntryType& RefTable1toN< FROM, TO >::reference ( const FROM *  from  )  const [inline]

Find Reference from it's source entry (CONST).

Definition at line 264 of file RefTable.h.

00264                                                       {
00265     static EntryType empty;
00266     EntryType* e = i_reference(from);
00267     return (0 == e) ? empty : (*e);
00268   }

template<class FROM, class TO>
bool RefTable1toN< FROM, TO >::isReferenced ( const FROM *  from,
const EntryType to 
) [inline]

Check if two entries are Referenced to each other.

Definition at line 270 of file RefTable.h.

00270                                                               {
00271     const EntryType* e = i_reference(from);
00272     return (0 == e) ? false : (*e == to);
00273   }

template<class FROM, class TO>
bool RefTable1toN< FROM, TO >::isReferenced ( const FROM *  from,
const TO *  to 
) [inline]

Check if two entries are Referenced to each other.

Definition at line 275 of file RefTable.h.

00275                                                        {
00276     return isReferenced(from, SmartRef<TO>(to));
00277   }

template<class FROM, class TO>
bool RefTable1toN< FROM, TO >::isReferenced ( const FROM *  from,
const SmartRef< TO > &  to 
) [inline]

Check if two entries are Referenced to each other.

Definition at line 279 of file RefTable.h.

00279                                                                  {
00280     const EntryType* e = i_reference(from);
00281     if ( 0 != assoc )   {
00282       SmartRefVector<TO>::const_iterator i = std::find(e->begin(), e->end(), to);
00283       return (i == e->end()) ? false : true;
00284     }
00285     return false;
00286   }

bool RefTableBase< FROM , SmartRefVector< TO > >::insertMapElement ( const KeyType from,
EntryType to 
) [inline, protected, inherited]

Insert new Entry into Reference container.

Definition at line 75 of file RefTable.h.

00075                                                                   {
00076     return m_table.insert( from, to );
00077   }

EntryType* RefTableBase< FROM , SmartRefVector< TO > >::i_reference ( const KeyType from  )  [inline, protected, inherited]

Find Reference from it's source entry.

Definition at line 79 of file RefTable.h.

00079                                                {
00080     iterator i = m_table.find( from );
00081     if ( i != 0 )    {
00082       return &((*i).second);
00083     }
00084     return 0; 
00085   }

const EntryType* RefTableBase< FROM , SmartRefVector< TO > >::i_reference ( const KeyType from  )  const [inline, protected, inherited]

Find Reference from it's source entry (CONST).

Definition at line 87 of file RefTable.h.

00087                                                             {
00088     const_iterator i = m_table.find( from );
00089     if ( i != m_table.end() )    {
00090       return &((*i).second);
00091     }
00092     return 0; 
00093   }

virtual void RefTableBase< FROM , SmartRefVector< TO > >::clear (  )  [inline, virtual, inherited]

Clear Reference map.

Definition at line 104 of file RefTable.h.

00104                           {
00105     m_table.clear();
00106   }

iterator RefTableBase< FROM , SmartRefVector< TO > >::begin (  )  [inline, inherited]

Start of direct access iterator.

Definition at line 108 of file RefTable.h.

00108                      {
00109     return m_table.begin();
00110   }

const_iterator RefTableBase< FROM , SmartRefVector< TO > >::begin (  )  const [inline, inherited]

Start of direct access iterator (CONST).

Definition at line 112 of file RefTable.h.

00112                                  {
00113     return m_table.begin();
00114   }

iterator RefTableBase< FROM , SmartRefVector< TO > >::end (  )  [inline, inherited]

End of direct access iterator.

Definition at line 116 of file RefTable.h.

00116                    {
00117     return m_table.end();
00118   }

const_iterator RefTableBase< FROM , SmartRefVector< TO > >::end (  )  const [inline, inherited]

End of direct access iterator (CONST).

Definition at line 120 of file RefTable.h.

00120                                {
00121     return m_table.end();
00122   }

long RefTableBase< FROM , SmartRefVector< TO > >::size (  )  const [inline, inherited]

Size of References.

Definition at line 124 of file RefTable.h.

00124                         {
00125     return m_table.size();
00126   }

void RefTableBase< FROM , SmartRefVector< TO > >::reserve ( int  len  )  [inline, inherited]

Size of References.

Definition at line 128 of file RefTable.h.

00128                           {
00129     m_table.reserve(len);
00130   }

virtual StreamBuffer& RefTableBase< FROM , SmartRefVector< TO > >::serialize ( StreamBuffer s  )  const [inline, virtual, inherited]

Serialize the object for writing.

Reimplemented from DataObject.

Definition at line 132 of file RefTable.h.

00132                                                              {
00133     DataObject::serialize(s) << m_table.size();
00134     //for (TableType::const_iterator i = m_table.begin(), stop = m_table.end(); i != stop; i++ )    {
00135     //  SmartRef<KeyType> fromRef;
00136     //  fromRef = (KeyType*)(*i).first;
00137     //  s << fromRef(this);
00138     //  s << (*i).second(this);
00139     //}
00140     return s;
00141   }

virtual StreamBuffer& RefTableBase< FROM , SmartRefVector< TO > >::serialize ( StreamBuffer s  )  [inline, virtual, inherited]

Serialize the object for reading.

Reimplemented from DataObject.

Definition at line 143 of file RefTable.h.

00143                                                              {
00144     long siz;
00145     DataObject::serialize(s) >> siz;
00146     m_table.reserve(siz);
00147     //for ( long i = 0; i < siz; i++ )   {
00148     //  SmartRef<KeyType> fromRef;
00149     //  EntryType entry;
00150     //  s >> fromRef(this);
00151     //  s >> entry(this);
00152     //  insertMapElement( fromRef, entry);
00153     //}
00154     return s;
00155   }

virtual unsigned long DataObject::addRef (  )  [virtual, inherited]

Add reference to object.

virtual unsigned long DataObject::release (  )  [virtual, inherited]

release reference to object

static const CLID& DataObject::classID (  )  [static, inherited]

Retrieve reference to class definition structure (static access).

Reimplemented in AlgorithmHistory, AlgToolHistory, DataHistory, HistoryObj, JobHistory, KeyedContainer< DATATYPE, MAPPING >, NTuple::Directory, NTuple::File, NTuple::ColumnWiseTuple, NTuple::RowWiseTuple, ObjectList< TYPE >, ObjectVector< TYPE >, ServiceHistory, and SharedObjectsContainer< TYPE >.

const std::string& DataObject::name (  )  const [inherited]

Retreive DataObject name. It is the name when registered in the store.

Reimplemented in NTuple::File, and ServiceHistory.

void DataObject::setRegistry ( IRegistry pRegistry  )  [inline, inherited]

Set pointer to Registry.

Definition at line 67 of file DataObject.h.

00067                                             {
00068     m_pRegistry = pRegistry;
00069   }

IRegistry* DataObject::registry (  )  const [inline, inherited]

Get pointer to Registry.

Definition at line 71 of file DataObject.h.

00071                                 {
00072     return m_pRegistry;
00073   }

LinkManager* DataObject::linkMgr (  )  const [inline, inherited]

Retrieve Link manager.

Definition at line 75 of file DataObject.h.

00075                                     {
00076     return m_pLinkMgr;
00077   }

unsigned char DataObject::version (  )  const [inline, inherited]

Retrieve version number of this object representation.

Definition at line 79 of file DataObject.h.

00079                                     {
00080     return m_version;
00081   }

void DataObject::setVersion ( unsigned char  vsn  )  [inline, inherited]

Set version number of this object representation.

Definition at line 83 of file DataObject.h.

00083                                         {
00084     m_version = vsn;
00085   }

unsigned long DataObject::refCount (  )  const [inline, inherited]

Return the refcount.

Definition at line 87 of file DataObject.h.

00087                                  {
00088     return m_refCount;
00089   }

virtual std::ostream& DataObject::fillStream ( std::ostream &  s  )  const [inline, virtual, inherited]

Fill the output stream (ASCII).

Reimplemented in ObjectList< TYPE >, and ObjectVector< TYPE >.

Definition at line 91 of file DataObject.h.

00091                                                         {
00092     s << "DataObject at " << std::hex << this;
00093     return s;
00094   }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const DataObject obj 
) [friend, inherited]

Output operator (ASCII).

Definition at line 96 of file DataObject.h.

00096                                                                          {
00097     return obj.fillStream(s);
00098   }


Member Data Documentation

CLID RefTableBase< FROM , SmartRefVector< TO > >::m_clid [inherited]

Class id of the reference table.

Definition at line 63 of file RefTable.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:13 2011 for GaudiKernel by doxygen 1.4.7