|
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();
104 else if( ( auxid < m_dynamicVecs.size() ) &&
105 ( m_dynamicVecs[ auxid ] ) ) {
107 return m_dynamicVecs[ auxid ];
143 else if( ( auxid < m_dynamicVecs.size() ) &&
144 ( m_dynamicVecs[ auxid ] ) ) {
145 ret = m_dynamicVecs[ auxid ]->toPtr();
200 bool anycleared =
false;
202 if (m_dynamicVecs[auxid]) {
203 delete m_dynamicVecs[auxid];
204 m_dynamicVecs[auxid] =
nullptr;
205 m_auxids.erase( auxid );
208 const std::string
name =
r.getName( auxid );
209 const std::type_info* ti =
r.getType( auxid );
210 if (ti == &
typeid(
int))
212 else if (ti == &
typeid(
float))
213 m_float.erase (
name);
214 else if (ti == &
typeid(std::vector<int>))
215 m_vecInt.erase (
name);
216 else if (ti == &
typeid(std::vector<float>))
217 m_vecFloat.erase (
name);
242 if (
i < m_dynamicVecs.size() && m_dynamicVecs[
i]) {
243 size_t sz = m_dynamicVecs[
i]->size();
273 else if( ( auxid < m_dynamicVecs.size() ) &&
274 ( m_dynamicVecs[ auxid ] ) ) {
276 m_dynamicVecs[ auxid ]->reserve( capacity );
277 m_dynamicVecs[ auxid ]->resize(
size );
279 return m_dynamicVecs[ auxid ]->toPtr();
305 if (!
v->resize(
size ))
312 if (!
v->resize(
size ))
329 for( ; itr !=
end; ++itr ) {
330 if( *itr ) ( *itr )->reserve(
size );
334 for( ; itr !=
end; ++itr ) {
335 if( *itr ) ( *itr )->reserve(
size );
350 for( ; itr !=
end; ++itr ) {
351 if( *itr ) ( *itr )->shift(
pos, offs );
355 for( ; itr !=
end; ++itr ) {
356 if( *itr ) ( *itr )->shift(
pos, offs );
374 size_t other_size =
other.size();
381 if (
id < m_dynamicVecs.size())
382 v_dst = m_dynamicVecs[
id];
387 if (
other.getData (
id)) {
388 void* src_ptr =
other.getData (
id, other_size, other_size);
396 const void* orig = v_dst->
toPtr();
398 if (orig != v_dst->
toPtr())
406 if (!m_auxids.test(
id) &&
409 if (
other.getData (
id)) {
410 void* src_ptr =
other.getData (
id, other_size, other_size);
414 m_dynamicVecs[
id]->resize (
sz - other_size);
415 m_dynamicVecs[
id]->insertMove (
pos, src_ptr, 0, other_size,
433 m_dynamicVecs.clear();
436 #define ADD_IDS(VAR, TYP) \
437 do { typedef std::map< std::string, std::vector< TYP > > CONT; \
438 for (CONT::value_type& p : VAR) \
439 m_auxids.insert (r.getAuxID< TYP > (p.first, "", SG::AuxVarFlags::SkipNameCheck)); } while(0)
442 ADD_IDS(m_vecInt, std::vector<int>);
443 ADD_IDS(m_vecFloat, std::vector<float>);
462 template<
typename T >
465 std::map< std::string,
466 std::vector< T > >& pers,
467 size_t size,
size_t capacity,
469 bool forDecor)
const {
475 const std::string
name =
r.getName( auxid );
478 typename std::map< std::string, std::vector< T > >
::iterator itr =
480 if( itr == pers.end() ) {
484 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1::getData (const) "
485 <<
"Variable with unknown name (" <<
name <<
") requested"
494 if (
r.isLinked(auxid)) {
495 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1 doesn't implement linked variables"
501 itr = pers.insert (std::make_pair (
name, std::vector<T>())).first;
505 std::vector< T >&
var = itr->second;
508 if( m_dynamicVecs.size() <= auxid ) {
509 m_dynamicVecs.resize( auxid + 1 );
513 if( m_dynamicVecs[ auxid ] ) {
514 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1::getData "
515 <<
"Internal inconsistency detected!" << std::endl;
516 return m_dynamicVecs[ auxid ];
524 m_dynamicVecs[ auxid ]->reserve( capacity );
525 m_dynamicVecs[ auxid ]->resize(
size );
529 m_auxids.insert( auxid );
532 return m_dynamicVecs[ auxid ];
537 size_t size,
size_t capacity,
539 bool forDecor)
const {
554 typeid( std::vector< int > ) ) {
559 typeid( std::vector< float > ) ) {
565 std::cerr <<
"ERROR xAOD::ByteStreamAuxContainer_v1::getData "
566 <<
"Unknown variable type ("
568 <<
") requested" << std::endl;
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.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
Exceptions that can be thrown from AthContainers.
virtual const SG::IAuxTypeVector * getVector(auxid_t auxid) const override final
Return vector interface for one aux data item.
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
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 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.
SG::IAuxTypeVector * getVector1(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.
std::string m_name
Name of the container in memory. Set externally.