00001
00002
00003 #ifndef XAODCORE_AUXINFOBASE_H
00004 #define XAODCORE_AUXINFOBASE_H
00005
00006
00007 #include <vector>
00008
00009
00010 #include "AthContainersInterfaces/IAuxStore.h"
00011 #include "AthContainersInterfaces/IAuxStoreIO.h"
00012 #include "AthContainersInterfaces/IAuxStoreHolder.h"
00013 #include "AthContainers/tools/threading.h"
00014 #ifndef XAOD_STANDALONE
00015 # include "AthenaKernel/ILockable.h"
00016 #endif // not XAOD_STANDALONE
00017
00018
00019 #include "xAODCore/AuxSelection.h"
00020
00021
00022 namespace SG {
00023 class IAuxTypeVector;
00024 class AuxDataOption;
00025 }
00026
00027 namespace xAOD {
00028
00040 class AuxInfoBase : public SG::IAuxStore,
00041 public SG::IAuxStoreIO,
00042 public SG::IAuxStoreHolder
00043 #ifndef XAOD_STANDALONE
00044 , public ILockable
00045 #endif // not XAOD_STANDALONE
00046 {
00047
00048 public:
00050 typedef SG::auxid_t auxid_t;
00052 typedef SG::auxid_set_t auxid_set_t;
00053
00055 AuxInfoBase( bool allowDynamicVars = true );
00057 AuxInfoBase( const AuxInfoBase& parent );
00059 AuxInfoBase( const SG::IAuxStore* store );
00061 ~AuxInfoBase();
00062
00064 AuxInfoBase& operator=( const AuxInfoBase& rhs );
00065
00068
00070 virtual SG::IAuxStore* getStore() const;
00072 virtual void setStore( SG::IAuxStore* store );
00074 virtual AuxStoreType getStoreType() const { return AST_ObjectStore; }
00075
00077
00080
00082 virtual const void* getData( auxid_t auxid ) const;
00083
00085 virtual const auxid_set_t& getAuxIDs() const;
00086
00088 virtual void* getDecoration( auxid_t auxid, size_t size,
00089 size_t capacity );
00090
00092 virtual void lock();
00093
00095 virtual void clearDecorations();
00096
00098 virtual size_t size() const;
00099
00101
00104
00106 virtual void* getData( auxid_t auxid, size_t size,
00107 size_t capacity );
00108
00110 virtual const auxid_set_t& getWritableAuxIDs() const;
00111
00113 virtual void resize( size_t size );
00115 virtual void reserve( size_t size );
00117 virtual void shift( size_t pos, ptrdiff_t offs );
00119 virtual bool setOption( auxid_t id, const SG::AuxDataOption& option );
00120
00122
00125
00127 virtual const void* getIOData( auxid_t auxid ) const;
00128
00130 virtual const std::type_info* getIOType( auxid_t auxid ) const;
00131
00133 virtual const auxid_set_t& getDynamicAuxIDs() const;
00134
00136 virtual void selectAux( const std::set< std::string >& attributes );
00137
00139 virtual const SG::auxid_set_t& getSelectedAuxIDs() const;
00140
00142
00145
00147 const char* name() const;
00149 void setName( const char* name );
00150
00152
00153 protected:
00155 template< typename T >
00156 void regAuxVar( const std::string& name,
00157 T& info );
00158
00159 private:
00161 AuxSelection m_selection;
00163 mutable auxid_set_t m_auxids;
00165 std::vector< SG::IAuxTypeVector* > m_vecs;
00166
00168 SG::IAuxStore* m_store;
00170 SG::IAuxStoreIO* m_storeIO;
00172 bool m_ownsStore;
00174 bool m_locked;
00175
00177 mutable size_t m_tick;
00178
00180 typedef AthContainers_detail::mutex mutex_t;
00181 typedef AthContainers_detail::lock_guard< mutex_t > guard_t;
00182 mutable mutex_t m_mutex;
00183
00185 struct TSAuxidSet {
00186 size_t m_tick;
00187 auxid_set_t m_set;
00188 TSAuxidSet( size_t tick, const auxid_set_t& set )
00189 : m_tick( tick ), m_set( set ) { }
00190 };
00192 mutable AthContainers_detail::thread_specific_ptr< TSAuxidSet > m_tsAuxids;
00193
00195 std::string m_name;
00196
00197 };
00198
00199 }
00200
00201
00202 #include "xAODCore/CLASS_DEF.h"
00203 CLASS_DEF( xAOD::AuxInfoBase, 226113180, 1 )
00204
00205
00206 #include "xAODCore/BaseInfo.h"
00207 SG_BASES3( xAOD::AuxInfoBase, SG::IAuxStore, SG::IAuxStoreIO,
00208 SG::IAuxStoreHolder );
00209
00210
00211 #include "AuxInfoBase.icc"
00212
00213 #endif // XAODCORE_AUXINFOBASE_H