| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# KeyedObjectManager.h

Go to the documentation of this file.

    00001 // $Id $
    00002 #ifndef GAUDIKERNEL_KEYEDOBJECTMANAGER_H
    00003 #define GAUDIKERNEL_KEYEDOBJECTMANAGER_H
    00004
    00005 // Framework include files
    00006 #include "GaudiKernel/Kernel.h"
    00007 #include "GaudiKernel/ClassID.h"
    00008 #include "GaudiKernel/KeyedTraits.h"
    00009
    00010 // STL includes
    00011 #include <vector>
    00012
    00013 // Forward declarations
    00014 class ObjectContainerBase;
    00015 class ContainedObject;
    00016
    00019 namespace Containers   {
    00020
    00022   typedef long (*MANIPULATOR)(void*);
    00024   struct hashmap;
    00026   struct map;
    00028   struct array;
    00030   struct vector;
    00031
    00045   template <class SETUP>
    00046   class KeyedObjectManager    {
    00047   private:
    00048     typedef std::vector<void*> seq_type;
    00050     seq_type*       m_seq;
    00052     mutable long    m_direct;
    00053     mutable long    m_keyCtxt;
    00054     union {
    00056       char          buffer[128];
    00057       SETUP*        s;
    00058     } m_setup;
    00059
    00061     void onDirty()  const;
    00062
    00063   public:
    00065     KeyedObjectManager();
    00067     virtual ~KeyedObjectManager();
    00069     void clearDirect();
    00071     long insertDirect(ObjectContainerBase* b,ContainedObject* c,void* o, long k);
    00073     long isDirect() const {      return m_direct;    }
    00075     void* object(long key)  const;
    00077     long insert(ObjectContainerBase* b,ContainedObject* c,void* o, long* k);
    00079     long insert(ObjectContainerBase* b,ContainedObject* c,void* o,long k);
    00081     void* erase(long key, const void* obj);
    00083     long erase(seq_type::iterator beg, seq_type::iterator end);
    00085     void reserve(long size);
    00087     void clear();
    00089     void setup(void* seq, void** rndm);
    00091     static const CLID classID();
    00092   };
    00093
    00095   typedef KeyedObjectManager< map >     Map;
    00097   typedef KeyedObjectManager< hashmap > HashMap;
    00099   typedef KeyedObjectManager< vector >  Vector;
    00101   typedef KeyedObjectManager< array >   Array;
    00102 }
    00103 #endif // GAUDIKERNEL_KEYEDOBJECTMANAGER_H