![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
20 m_int(), m_float(), m_vecInt(), m_vecFloat(),
21 m_staticVecs(), m_dynamicVecs(),
31 m_vecInt(
parent.m_vecInt ), m_vecFloat(
parent.m_vecFloat ),
33 m_auxids(
parent.m_auxids ),
36 m_dynamicVecs(), m_locked( false ),
46 for( ; itr !=
end; ++itr ) {
47 if( *itr )
delete *itr;
51 for( ; itr !=
end; ++itr ) {
52 if( *itr )
delete *itr;
63 m_float = rhs.m_float;
64 m_vecInt = rhs.m_vecInt;
65 m_vecFloat = rhs.m_vecFloat;
68 m_auxids = rhs.m_auxids;
73 for(
auto* ptr : m_dynamicVecs ) {
76 m_dynamicVecs.clear();
95 else if( ( auxid < m_dynamicVecs.size() ) &&
96 ( m_dynamicVecs[ auxid ] ) ) {
98 return m_dynamicVecs[ auxid ]->toPtr();
104 return getData1 (auxid, 0, 0,
true,
false);
127 else if( ( auxid < m_dynamicVecs.size() ) &&
128 ( m_dynamicVecs[ auxid ] ) ) {
129 ret = m_dynamicVecs[ auxid ]->toPtr();
177 bool anycleared =
false;
179 if (m_dynamicVecs[auxid]) {
180 delete m_dynamicVecs[auxid];
181 m_dynamicVecs[auxid] =
nullptr;
182 m_auxids.erase( auxid );
185 const std::string
name =
r.getName( auxid );
186 const std::type_info* ti =
r.getType( auxid );
187 if (ti == &
typeid(
int))
189 else if (ti == &
typeid(
float))
190 m_float.erase (
name);
191 else if (ti == &
typeid(std::vector<int>))
192 m_vecInt.erase (
name);
193 else if (ti == &
typeid(std::vector<float>))
194 m_vecFloat.erase (
name);
219 if (
i < m_dynamicVecs.size() && m_dynamicVecs[
i]) {
220 size_t sz = m_dynamicVecs[
i]->size();
250 else if( ( auxid < m_dynamicVecs.size() ) &&
251 ( m_dynamicVecs[ auxid ] ) ) {
253 m_dynamicVecs[ auxid ]->reserve( capacity );
254 m_dynamicVecs[ auxid ]->resize(
size );
256 return m_dynamicVecs[ auxid ]->toPtr();
278 if (!
v->resize(
size ))
285 if (!
v->resize(
size ))
302 for( ; itr !=
end; ++itr ) {
303 if( *itr ) ( *itr )->reserve(
size );
307 for( ; itr !=
end; ++itr ) {
308 if( *itr ) ( *itr )->reserve(
size );
323 for( ; itr !=
end; ++itr ) {
324 if( *itr ) ( *itr )->shift(
pos, offs );
328 for( ; itr !=
end; ++itr ) {
329 if( *itr ) ( *itr )->shift(
pos, offs );
348 size_t other_size =
other.size();
355 if (
id < m_dynamicVecs.size())
356 v_dst = m_dynamicVecs[
id];
361 if (
other.getData (
id)) {
362 void* src_ptr =
other.getData (
id, other_size, other_size);
365 reinterpret_cast<char*
>(src_ptr) + other_size*
r.getEltSize(
id),
371 const void* orig = v_dst->
toPtr();
373 if (orig != v_dst->
toPtr())
381 if (!m_auxids.test(
id) &&
384 if (
other.getData (
id)) {
385 void* src_ptr =
other.getData (
id, other_size, other_size);
389 m_dynamicVecs[
id]->resize (
sz - other_size);
390 m_dynamicVecs[
id]->insertMove (
pos, src_ptr,
reinterpret_cast<char*
>(src_ptr) + other_size*
r.getEltSize(
id),
408 m_dynamicVecs.clear();
411 #define ADD_IDS(VAR, TYP) \
412 do { typedef std::map< std::string, std::vector< TYP > > CONT; \
413 for (CONT::value_type& p : VAR) \
414 m_auxids.insert (r.getAuxID< TYP > (p.first, "", SG::AuxVarFlags::SkipNameCheck)); } while(0)
417 ADD_IDS(m_vecInt, std::vector<int>);
418 ADD_IDS(m_vecFloat, std::vector<float>);
437 template<
typename T >
440 std::map< std::string,
441 std::vector< T > >& pers,
442 size_t size,
size_t capacity,
444 bool forDecor)
const {
450 const std::string
name =
r.getName( auxid );
453 typename std::map< std::string, std::vector< T > >
::iterator itr =
455 if( itr == pers.end() ) {
459 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1::getData (const) "
460 <<
"Variable with unknown name (" <<
name <<
") requested"
469 if (
r.isLinked(auxid)) {
470 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1 doesn't implement linked variables"
476 itr = pers.insert (std::make_pair (
name, std::vector<T>())).first;
480 std::vector< T >&
var = itr->second;
483 if( m_dynamicVecs.size() <= auxid ) {
484 m_dynamicVecs.resize( auxid + 1 );
488 if( m_dynamicVecs[ auxid ] ) {
489 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1::getData "
490 <<
"Internal inconsistency detected!" << std::endl;
491 return m_dynamicVecs[ auxid ]->toPtr();
499 m_dynamicVecs[ auxid ]->reserve( capacity );
500 m_dynamicVecs[ auxid ]->resize(
size );
504 m_auxids.insert( auxid );
507 return m_dynamicVecs[ auxid ]->toPtr();
512 size_t size,
size_t capacity,
514 bool forDecor)
const {
529 typeid( std::vector< int > ) ) {
534 typeid( std::vector< float > ) ) {
540 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1::getData "
541 <<
"Unknown variable type ("
543 <<
") requested" << std::endl;
void * getData1(auxid_t auxid, std::map< std::string, std::vector< T > > &pers, size_t size, size_t capacity, bool quiet, bool forDecor) const
Function retrieving a simple dynamic variable.
JetConstituentVector::iterator iterator
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
virtual void lock() override
Lock the container.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
Exception — Attempted to modify auxiliary data in a locked store.
Exceptions that can be thrown from AthContainers.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
std::vector< SG::IAuxTypeVector * > m_staticVecs
Internal list of static managed variables.
ConcurrentBitset & clear()
Clear all bits in the set.
Handle mappings between names and auxid_t.
ByteStreamAuxContainer_v1 & operator=(const ByteStreamAuxContainer_v1 &rhs)
Assignment operator.
size_t auxid_t
Identifier for a particular aux data item.
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
SG::auxid_t auxid_t
The aux ID type definition from IConstAuxStore.
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
ConcurrentBitset & reset(bit_t bit)
Turn off one bit.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
void reset()
Function resetting the internal (cached) state of the object.
bool m_locked
Has the container been locked?
Class managing concrete vector variables.
ByteStreamAuxContainer_v1()
Default constructor.
virtual ~ByteStreamAuxContainer_v1()
Destructor.
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
AthContainers_detail::lock_guard< mutex_t > guard_t
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
const char * name() const
Get the name of the container instance.
virtual size_t size() const override
Get the size of the container.
virtual bool insertMove(size_t pos, void *beg, void *end, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
virtual bool clearDecorations() override
Clear all decorations.
void setName(const char *name)
Set the name of the container instance.
Abstract interface for manipulating vectors of arbitrary types.
Handle mappings between names and auxid_t.
A set of aux data identifiers.
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
SG::auxid_set_t m_decorations
Record which variables are decorations.
size_t size_noLock() const
Internal method: return size without taking out the lock.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
Base class for dynamic auxiliary stores saved into ByteStream.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
T getType(const char *cStr)
Return Ringer enumeration of type T identifying string type:
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
#define ADD_IDS(VAR, TYP)
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
bool test(bit_t bit) const
Test to see if a bit is set.
std::string m_name
Name of the container in memory. Set externally.