The Gaudi Framework  master (29688f1e)
Loading...
Searching...
No Matches
KeyedObjectManager.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
13#include <GaudiKernel/ClassID.h>
14#include <GaudiKernel/Kernel.h>
16#include <vector>
17
19class ContainedObject;
20
21namespace Containers {
23 typedef long ( *MANIPULATOR )( void* );
27 struct GAUDI_API map;
32
46 template <class SETUP>
48 private:
49 typedef std::vector<void*> seq_type;
53 mutable long m_direct;
54 mutable long m_keyCtxt;
55 union {
57 char buffer[128];
58 SETUP* s;
59 } m_setup;
60
62 void onDirty() const;
63
64 public:
73 long insertDirect( ObjectContainerBase* b, ContainedObject* c, void* o, long k );
75 long isDirect() const { return m_direct; }
77 void* object( long key ) const;
79 long insert( ObjectContainerBase* b, ContainedObject* c, void* o, long* k );
81 long insert( ObjectContainerBase* b, ContainedObject* c, void* o, long k );
83 void* erase( long key, const void* obj );
85 long erase( seq_type::iterator beg, seq_type::iterator end );
87 void reserve( long size );
89 void clear();
91 void setup( void* seq, void** rndm );
93 static CLID classID();
94 };
95
104} // namespace Containers
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
#define GAUDI_API
Definition Kernel.h:49
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
KeyedObjectManager Class to manage keyed objects.
static CLID classID()
Access CLID for this type of container.
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long k)
Insert new object into container.
void onDirty() const
Callback when the container becomes dirty.
void * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid).
void setup(void *seq, void **rndm)
Setup of the Map and the parent object.
virtual ~KeyedObjectManager()
Standard Destructor.
long erase(seq_type::iterator beg, seq_type::iterator end)
Remove object by sequential iterators.
void clearDirect()
Clear all direct access fields.
void * object(long key) const
Retrieve object identified by a key from the container.
KeyedObjectManager(KeyedObjectManager &&other)
KeyedObjectManager()
Standard Constructor.
void reserve(long size)
Reserve buffer space.
void clear()
Clear content of the vector.
long isDirect() const
Check if the container is dirty.
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
long insertDirect(ObjectContainerBase *b, ContainedObject *c, void *o, long k)
Insert element into direct access map.
ObjectContainerBase is the base class for Gaudi container classes.
KeyedObjectManager< vector > Vector
Forward declaration of specialized std::vector-like object manager.
long(* MANIPULATOR)(void *)
Object manipulator type definition.
KeyedObjectManager< hashmap > HashMap
Forward declaration of specialized std::hashmap-like object manager.
KeyedObjectManager< map > Map
Forward declaration of specialized std::map-like object manager.
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.