00001
00002
00003 #ifndef XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_H
00004 #define XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_H
00005
00006
00007 #include <vector>
00008 #include <map>
00009 #include <string>
00010
00011
00012 #include "AthContainersInterfaces/IAuxStore.h"
00013 #include "AthContainers/tools/threading.h"
00014 #ifndef XAOD_STANDALONE
00015 # include "AthenaKernel/ILockable.h"
00016 #endif
00017
00018
00019 namespace SG {
00020 class IAuxTypeVector;
00021 }
00022
00024 namespace xAOD {
00025
00039 class ByteStreamAuxContainer_v1
00040 : public SG::IAuxStore
00041 #ifndef XAOD_STANDALONE
00042 , public ILockable
00043 #endif
00044 {
00045
00046 public:
00048 typedef SG::auxid_t auxid_t;
00050 typedef SG::auxid_set_t auxid_set_t;
00051
00053 ByteStreamAuxContainer_v1();
00055 ByteStreamAuxContainer_v1( const ByteStreamAuxContainer_v1& parent );
00057 ~ByteStreamAuxContainer_v1();
00058
00060 ByteStreamAuxContainer_v1&
00061 operator=( const ByteStreamAuxContainer_v1& rhs );
00062
00065
00067 virtual const void* getData( auxid_t auxid ) const;
00068
00070 virtual const auxid_set_t& getAuxIDs() const;
00071
00073 virtual void* getDecoration (auxid_t auxid, size_t size, size_t capacity);
00074
00076 virtual void lock();
00077
00079 virtual void clearDecorations();
00080
00082 virtual size_t size() const;
00083
00085
00088
00090 virtual void* getData( auxid_t auxid, size_t size,
00091 size_t capacity );
00092
00094 virtual const auxid_set_t& getWritableAuxIDs() const;
00095
00097 virtual void resize( size_t size );
00099 virtual void reserve( size_t size );
00101 virtual void shift( size_t pos, ptrdiff_t offs );
00102
00104
00106 void reset();
00107
00110
00112 const char* name() const;
00114 void setName( const char* name );
00115
00117
00118 protected:
00120 template< typename T >
00121 void regAuxVar( const std::string& name,
00122 std::vector< T >& vec );
00123
00124 private:
00127 template< typename T >
00128 void* getData1( auxid_t auxid,
00129 std::map< std::string, std::vector< T > >& pers,
00130 size_t size, size_t capacity, bool quiet,
00131 bool forDecor) const;
00132
00133 void* getData1( auxid_t auxid,
00134 size_t size, size_t capacity, bool quiet,
00135 bool forDecor ) const;
00136
00139
00141 mutable std::map< std::string, std::vector< int > > m_int;
00143 mutable std::map< std::string, std::vector< float > > m_float;
00145 mutable std::map< std::string, std::vector< std::vector< int > > > m_vecInt;
00147 mutable std::map< std::string, std::vector< std::vector< float > > > m_vecFloat;
00148
00150
00153
00155 mutable auxid_set_t m_auxids;
00157 std::vector< SG::IAuxTypeVector* > m_staticVecs;
00159 mutable std::vector< SG::IAuxTypeVector* > m_dynamicVecs;
00161 bool m_locked;
00163 std::vector<bool> m_isDecoration;
00164
00166 mutable size_t m_tick;
00167
00169 typedef AthContainers_detail::mutex mutex_t;
00170 typedef AthContainers_detail::lock_guard<mutex_t> guard_t;
00171 mutable mutex_t m_mutex;
00172
00174 struct TSAuxidSet
00175 {
00176 size_t m_tick;
00177 auxid_set_t m_set;
00178 TSAuxidSet (size_t tick, const auxid_set_t& set)
00179 : m_tick (tick), m_set (set) {}
00180 };
00181 mutable AthContainers_detail::thread_specific_ptr<TSAuxidSet> m_tsAuxids;
00182
00184
00186 std::string m_name;
00187
00188 };
00189
00190 }
00191
00192
00193 #include "xAODCore/BaseInfo.h"
00194 SG_BASE( xAOD::ByteStreamAuxContainer_v1, SG::IAuxStore );
00195
00198
00199
00200 #include "ByteStreamAuxContainer_v1.icc"
00201
00202 #endif // XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_H