00001
00002
00003 #ifndef XAODCORE_SHALLOWAUXCONTAINER_H
00004 #define XAODCORE_SHALLOWAUXCONTAINER_H
00005
00006
00007 #include "AthLinks/DataLink.h"
00008 #include "AthContainersInterfaces/IAuxStore.h"
00009 #include "AthContainersInterfaces/IAuxStoreIO.h"
00010 #include "AthContainersInterfaces/IAuxStoreHolder.h"
00011 #include "AthContainers/tools/threading.h"
00012 #ifndef XAOD_STANDALONE
00013 # include "AthenaKernel/ILockable.h"
00014 #endif // not XAOD_STANDALONE
00015
00016
00017 #include "xAODCore/AuxSelection.h"
00018
00019 namespace xAOD {
00020
00042 class ShallowAuxContainer : public SG::IAuxStore,
00043 public SG::IAuxStoreIO,
00044 public SG::IAuxStoreHolder
00045 #ifndef XAOD_STANDALONE
00046 , public ILockable
00047 #endif // not XAOD_STANDALONE
00048 {
00049
00050 public:
00052 typedef SG::auxid_t auxid_t;
00054 typedef SG::auxid_set_t auxid_set_t;
00055
00057 ShallowAuxContainer( bool standalone = false );
00059 ShallowAuxContainer( const ShallowAuxContainer& parent );
00061 ShallowAuxContainer( const DataLink< SG::IConstAuxStore >& parent,
00062 bool standalone = false );
00064 ~ShallowAuxContainer();
00065
00067 ShallowAuxContainer& operator= ( const ShallowAuxContainer& rhs );
00068
00070 const DataLink< SG::IConstAuxStore >& parent() const;
00072 void setParent( const DataLink< SG::IConstAuxStore >& link );
00073
00075 bool shallowIO() const;
00077 void setShallowIO( bool value );
00078
00081
00083 virtual SG::IAuxStore* getStore() const;
00085 virtual void setStore( SG::IAuxStore* store );
00087 virtual AuxStoreType getStoreType() const { return AST_ContainerStore; }
00088
00090
00093
00095 virtual const void* getData( auxid_t auxid ) const;
00096
00098 virtual const auxid_set_t& getAuxIDs() const;
00099
00101 virtual void* getDecoration (auxid_t auxid, size_t size, size_t capacity);
00103 virtual void lock();
00105 virtual void clearDecorations();
00107 virtual size_t size() const;
00109
00112
00114 virtual void* getData( auxid_t auxid, size_t size,
00115 size_t capacity );
00116
00118 virtual const auxid_set_t& getWritableAuxIDs() const;
00119
00121 virtual void resize( size_t size );
00123 virtual void reserve( size_t size );
00125 virtual void shift( size_t pos, ptrdiff_t offs );
00126
00128
00131
00133 virtual const void* getIOData( auxid_t auxid ) const;
00134
00136 virtual const std::type_info* getIOType( auxid_t auxid ) const;
00137
00139 virtual const auxid_set_t& getDynamicAuxIDs() const;
00140
00142 virtual void selectAux( const std::set< std::string >& attributes );
00143
00145 virtual const auxid_set_t& getSelectedAuxIDs() const;
00146
00148
00151
00153 const char* name() const;
00155 void setName( const char* name );
00156
00158
00159 private:
00161 AuxSelection m_selection;
00162
00164 SG::IAuxStore* m_store;
00166 SG::IAuxStoreIO* m_storeIO;
00168 bool m_ownsStore;
00170 bool m_locked;
00171
00173 DataLink< SG::IConstAuxStore > m_parentLink;
00175 mutable SG::IAuxStoreIO* m_parentIO;
00177 bool m_shallowIO;
00178
00180 mutable size_t m_tick;
00181
00183 typedef AthContainers_detail::mutex mutex_t;
00184 typedef AthContainers_detail::lock_guard<mutex_t> guard_t;
00185 mutable mutex_t m_mutex;
00186
00188 struct TSAuxidSet
00189 {
00190 size_t m_tick;
00191 auxid_set_t m_set;
00192 TSAuxidSet (size_t tick, const auxid_set_t& set)
00193 : m_tick (tick), m_set (set) {}
00194 TSAuxidSet ()
00195 : m_tick (0) {}
00196 };
00197 mutable AthContainers_detail::thread_specific_ptr<TSAuxidSet> m_tsAuxids;
00198
00200 std::string m_name;
00201
00202 };
00203
00204 }
00205
00206
00207 #include "xAODCore/CLASS_DEF.h"
00208 CLASS_DEF( xAOD::ShallowAuxContainer, 1111823638, 1 )
00209
00210
00211 #include "xAODCore/BaseInfo.h"
00212 SG_BASES3( xAOD::ShallowAuxContainer, SG::IAuxStore, SG::IAuxStoreIO,
00213 SG::IAuxStoreHolder );
00214
00215 #endif // XAODCORE_SHALLOWAUXCONTAINER_H