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

In This Package:

Containers::traits< CONTAINER, DATATYPE > Struct Template Reference

Definition of the container traits class. More...

#include <KeyedTraits.h>

Inheritance diagram for Containers::traits< CONTAINER, DATATYPE >:

[legend]
Collaboration diagram for Containers::traits< CONTAINER, DATATYPE >:
[legend]
List of all members.

Public Types

typedef DATATYPE::key_type key_type
 Declaration of key-type.
typedef KeyedObject< key_typeobj_type
 Declaration of keyed object type.

Static Public Member Functions

static bool checkBounds (const std::vector< DATATYPE * > *cnt, const typename DATATYPE::key_type &k)
 Allow to check the access to container elements for consistency.
static key_type makeKey (long k)
 Create key from its full integer representation.
static key_type makeKey (int k)
static long identifier (const key_type &k)
 Full unhashed key identifier.
static long hash (const key_type &key_value)
 Hash function for this key.
static void setKey (obj_type *v, const key_type &k)
 Set object key when inserted into the container.
static bool checkKey (obj_type *v, const key_type &k)
 Check the validity of the object's key.
static long addRef (obj_type *v)
 Add reference counter to object when inserted into the container.
static long release (obj_type *v)
 Release reference to object.

Detailed Description

template<class CONTAINER, class DATATYPE>
struct Containers::traits< CONTAINER, DATATYPE >

Definition of the container traits class.

Select if container-checks should be performed by switching on/off the macro CHECK_KEYED_CONTAINER.

Author:
M.Frank CERN/LHCb
Version:
1.0

Definition at line 107 of file KeyedTraits.h.


Member Typedef Documentation

typedef DATATYPE::key_type Containers::key_traits< DATATYPE::key_type >::key_type [inherited]

Declaration of key-type.

Definition at line 66 of file KeyedTraits.h.

typedef KeyedObject<key_type> Containers::key_traits< DATATYPE::key_type >::obj_type [inherited]

Declaration of keyed object type.

Definition at line 68 of file KeyedTraits.h.


Member Function Documentation

template<class CONTAINER, class DATATYPE>
static bool Containers::traits< CONTAINER, DATATYPE >::checkBounds ( const std::vector< DATATYPE * > *  cnt,
const typename DATATYPE::key_type &  k 
) [inline, static]

Allow to check the access to container elements for consistency.

Definition at line 110 of file KeyedTraits.h.

00111                                                                 {
00112 #ifdef CHECK_KEYED_CONTAINER
00113       return size_t(cnt->size()) > size_t(traits::hash(k));
00114 #else
00115       return true;
00116 #endif
00117     }

static key_type Containers::key_traits< DATATYPE::key_type >::makeKey ( long  k  )  [inline, static, inherited]

Create key from its full integer representation.

Not implementing on specialization may inhibit the creation of keys, i.e. then a key must be supplied at insertion time.

Definition at line 73 of file KeyedTraits.h.

00073 {return key_type(k); }

static key_type Containers::key_traits< DATATYPE::key_type >::makeKey ( int  k  )  [inline, static, inherited]

Definition at line 74 of file KeyedTraits.h.

00074 {return key_type(k); }

static long Containers::key_traits< DATATYPE::key_type >::identifier ( const key_type k  )  [inline, static, inherited]

Full unhashed key identifier.

Definition at line 76 of file KeyedTraits.h.

00076 {return k;           }

static long Containers::key_traits< DATATYPE::key_type >::hash ( const key_type key_value  )  [inline, static, inherited]

Hash function for this key.

Definition at line 78 of file KeyedTraits.h.

00078 {return key_value;   }

static void Containers::key_traits< DATATYPE::key_type >::setKey ( obj_type v,
const key_type k 
) [inline, static, inherited]

Set object key when inserted into the container.

Definition at line 80 of file KeyedTraits.h.

00080 {if(v)v->setKey(k);  }

static bool Containers::key_traits< DATATYPE::key_type >::checkKey ( obj_type v,
const key_type k 
) [inline, static, inherited]

Check the validity of the object's key.

Select if key-checks should be performed by switching on/off the macro CHECK_KEYED_CONTAINER.

Definition at line 85 of file KeyedTraits.h.

00085                                                         {
00086 #ifdef CHECK_KEYED_CONTAINER
00087       return (v) ? (hash(v->key())==hash(k)) : false;
00088 #else
00089       return true;
00090 #endif
00091     }

static long Containers::key_traits< DATATYPE::key_type >::addRef ( obj_type v  )  [inline, static, inherited]

Add reference counter to object when inserted into the container.

Definition at line 93 of file KeyedTraits.h.

00093 {   return (v) ? v->addRef()  : 0; }

static long Containers::key_traits< DATATYPE::key_type >::release ( obj_type v  )  [inline, static, inherited]

Release reference to object.

Definition at line 95 of file KeyedTraits.h.

00095 {   return (v) ? v->release() : 0; }


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

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