Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
SG::ConstAuxElement Class Reference

Const part of AuxElement. More...

#include <AuxElement.h>

Inheritance diagram for SG::ConstAuxElement:
Collaboration diagram for SG::ConstAuxElement:

Public Types

using TypelessConstAccessor = SG::TypelessConstAccessor
 Helper class to provide const generic access to aux data. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
using ConstAccessor = SG::ConstAccessor< T, ALLOC >
 Helper class to provide type-safe access to aux data. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
using Decorator = SG::Decorator< T, ALLOC >
 class to provide type-safe access to aux data. More...
 

Public Member Functions

 ConstAuxElement ()
 Default constructor. More...
 
 ConstAuxElement (const SG::AuxVectorData *container, size_t index)
 Constructor with explicit container / index. More...
 
 ConstAuxElement (const ConstAuxElement &other)
 Copy Constructor. More...
 
ConstAuxElementoperator= (const ConstAuxElement &other)=delete
 No assignment to a const element. More...
 
 ~ConstAuxElement ()
 Destructor. More...
 
const SG::AuxVectorDatacontainer () const
 Return the container holding this element. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor< T, ALLOC >::const_reference_type auxdata (const std::string &name) const
 Fetch an aux data variable, as a const reference. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor< T, ALLOC >::const_reference_type auxdata (const std::string &name, const std::string &clsname) const
 Fetch an aux data variable, as a const reference. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor< T, ALLOC >::const_reference_type auxdataConst (const std::string &name) const
 Fetch an aux data variable, as a const reference. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor< T, ALLOC >::const_reference_type auxdataConst (const std::string &name, const std::string &clsname) const
 Fetch an aux data variable, as a const reference. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED bool isAvailable (const std::string &name, const std::string &clsname="") const
 Check if an aux variable is available for reading. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED bool isAvailableWritableAsDecoration (const std::string &name, const std::string &clsname="") const
 Check if an aux variable is available for writing as a decoration. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED Decorator< T, ALLOC >::reference_type auxdecor (const std::string &name) const
 Fetch an aux decoration, as a non-const reference. More...
 
template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED Decorator< T, ALLOC >::reference_type auxdecor (const std::string &name, const std::string &clsname) const
 Fetch an aux decoration, as a non-const reference. More...
 
const SG::auxid_set_tgetAuxIDs () const
 Return a set of identifiers for existing data items for this object. More...
 
const SG::auxid_set_tgetDecorIDs () const
 Return a set of identifiers for decorations for this object. More...
 
size_t index () const
 Return the index of this element within its container. More...
 
size_t index () const
 Return the index of this element within its container. More...
 

Protected Member Functions

bool noPrivateData () const
 True if this element has no private data. More...
 
bool havePrivateData () const
 True if this element currently has private data. More...
 
bool hadPrivateData () const
 True if this element had private data before it was added to its current container. More...
 

Private Types

enum  PrivateStoreState : uint8_t { PrivateStoreState::NO_PRIVATE = 0, PrivateStoreState::HAVE_PRIVATE = 1, PrivateStoreState::HAD_PRIVATE = 2 }
 The current private data state. More...
 

Private Member Functions

void releasePrivateStoreForDtor ()
 Out-of-line portion of destructor. More...
 
void setIndex (size_t index, const SG::AuxVectorData *container)
 Set the index/container for this element. More...
 
bool setIndexPrivate (size_t index, const SG::AuxVectorData *container)
 Set the index/container for this element. More...
 
void setNoPrivateData ()
 Record that this element does not have private data. More...
 
void setHavePrivateData ()
 Record that this element currently has private data. More...
 
void setHadPrivateData ()
 Record that this element used to have private data. More...
 

Private Attributes

const SG::AuxVectorDatam_container
 The container of which this object is an element. More...
 
size_t m_index
 The index of this element within its container. More...
 
PrivateStoreState m_privateStoreState
 

Friends

class AuxElement
 
class SG::AuxVectorBase
 

Detailed Description

Const part of AuxElement.

This base class factors out the const portions of AuxElement (which see for a complete description).

Definition at line 69 of file AuxElement.h.

Member Typedef Documentation

◆ ConstAccessor

template<class T , class ALLOC = AuxAllocator_t<T>>
using SG::ConstAuxElement::ConstAccessor = SG::ConstAccessor<T, ALLOC>

Helper class to provide type-safe access to aux data.

Definition at line 131 of file AuxElement.h.

◆ Decorator

template<class T , class ALLOC = AuxAllocator_t<T>>
using SG::ConstAuxElement::Decorator = SG::Decorator<T, ALLOC>

class to provide type-safe access to aux data.

Definition at line 135 of file AuxElement.h.

◆ TypelessConstAccessor

Helper class to provide const generic access to aux data.

Definition at line 127 of file AuxElement.h.

Member Enumeration Documentation

◆ PrivateStoreState

enum SG::IAuxElement::PrivateStoreState : uint8_t
strongprivateinherited

The current private data state.

Enumerator
NO_PRIVATE 
HAVE_PRIVATE 
HAD_PRIVATE 

Definition at line 131 of file IAuxElement.h.

132  {
133  NO_PRIVATE = 0,
134  HAVE_PRIVATE = 1,
135  HAD_PRIVATE = 2,
136  };

Constructor & Destructor Documentation

◆ ConstAuxElement() [1/3]

SG::ConstAuxElement::ConstAuxElement ( )

Default constructor.

◆ ConstAuxElement() [2/3]

SG::ConstAuxElement::ConstAuxElement ( const SG::AuxVectorData container,
size_t  index 
)

Constructor with explicit container / index.

Parameters
containerContainer of which this element will be a part.
indexIndex of this element within the container.

This does not make any changes to aux data.

◆ ConstAuxElement() [3/3]

SG::ConstAuxElement::ConstAuxElement ( const ConstAuxElement other)

Copy Constructor.

Parameters
otherObject being copied.

We do not copy the container/index — the new object is not yet in a container!

In the case of constructing an object with a private store, makePrivateStore will take care of copying the aux data.

◆ ~ConstAuxElement()

SG::ConstAuxElement::~ConstAuxElement ( )

Destructor.

Any private store is deleted.

Member Function Documentation

◆ auxdata() [1/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor<T, ALLOC>::const_reference_type SG::ConstAuxElement::auxdata ( const std::string &  name) const

Fetch an aux data variable, as a const reference.

Parameters
nameName of the aux variable.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the Accessor or ConstAccessor classes.

◆ auxdata() [2/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor<T, ALLOC>::const_reference_type SG::ConstAuxElement::auxdata ( const std::string &  name,
const std::string &  clsname 
) const

Fetch an aux data variable, as a const reference.

Parameters
nameName of the aux variable.
clsnameThe name of the associated class. May be blank.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the Accessor or ConstAccessor classes.

◆ auxdataConst() [1/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor<T, ALLOC>::const_reference_type SG::ConstAuxElement::auxdataConst ( const std::string &  name) const

Fetch an aux data variable, as a const reference.

Parameters
nameName of the aux variable.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the ConstAccessor class.

◆ auxdataConst() [2/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED ConstAccessor<T, ALLOC>::const_reference_type SG::ConstAuxElement::auxdataConst ( const std::string &  name,
const std::string &  clsname 
) const

Fetch an aux data variable, as a const reference.

Parameters
nameName of the aux variable.
clsnameThe name of the associated class. May be blank.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the ConstAccessor class.

◆ auxdecor() [1/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED Decorator<T, ALLOC>::reference_type SG::ConstAuxElement::auxdecor ( const std::string &  name) const

Fetch an aux decoration, as a non-const reference.

Parameters
nameName of the aux variable.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the Accessor class.

If the container is locked, this will allow fetching only variables that do not yet exist (in which case they will be marked as decorations) or variables already marked as decorations.

◆ auxdecor() [2/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED Decorator<T, ALLOC>::reference_type SG::ConstAuxElement::auxdecor ( const std::string &  name,
const std::string &  clsname 
) const

Fetch an aux decoration, as a non-const reference.

Parameters
nameName of the aux variable.
clsnameThe name of the associated class. May be blank.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the Accessor class.

If the container is locked, this will allow fetching only variables that do not yet exist (in which case they will be marked as decorations) or variables already marked as decorations.

◆ container()

const SG::AuxVectorData* SG::ConstAuxElement::container ( ) const

Return the container holding this element.

◆ getAuxIDs()

const SG::auxid_set_t & SG::ConstAuxElement::getAuxIDs ( ) const

Return a set of identifiers for existing data items for this object.

If this object has a private or standalone store, then information from that will be returned. Otherwise, if this element is part of a container, then information for the container will be returned. Otherwise, return an empty set.

Definition at line 153 of file AuxElement.cxx.

154 {
155  if (havePrivateData())
156  return m_container->getConstStore()->getAuxIDs();
157  if (container())
158  return container()->getAuxIDs();
159  static const SG::auxid_set_t null_set;
160  return null_set;
161 }

◆ getDecorIDs()

const SG::auxid_set_t & SG::ConstAuxElement::getDecorIDs ( ) const

Return a set of identifiers for decorations for this object.

   If this object has a private or standalone store, then information
   from that will be returned.  Otherwise, if this element
   is part of a container, then information for the container
   will be returned.  Otherwise, return an empty set.

Definition at line 172 of file AuxElement.cxx.

173 {
174  if (havePrivateData())
176  if (container())
177  return container()->getDecorIDs();
178  static const SG::auxid_set_t null_set;
179  return null_set;
180 }

◆ hadPrivateData()

bool SG::IAuxElement::hadPrivateData ( ) const
protectedinherited

True if this element had private data before it was added to its current container.

◆ havePrivateData()

bool SG::IAuxElement::havePrivateData ( ) const
protectedinherited

True if this element currently has private data.

◆ index() [1/2]

size_t SG::IAuxElement::index ( ) const
inherited

Return the index of this element within its container.

◆ index() [2/2]

size_t SG::IAuxElement::index

Return the index of this element within its container.

Inherited from IAuxElement.

◆ isAvailable()

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED bool SG::ConstAuxElement::isAvailable ( const std::string &  name,
const std::string &  clsname = "" 
) const

Check if an aux variable is available for reading.

Parameters
nameName of the aux variable.
clsnameThe name of the associated class. May be blank.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the Accessor class.

◆ isAvailableWritableAsDecoration()

template<class T , class ALLOC = AuxAllocator_t<T>>
XAOD_AUXDATA_DEPRECATED bool SG::ConstAuxElement::isAvailableWritableAsDecoration ( const std::string &  name,
const std::string &  clsname = "" 
) const

Check if an aux variable is available for writing as a decoration.

Parameters
nameName of the aux variable.
clsnameThe name of the associated class. May be blank.

This method has to translate from the aux data name to the internal representation each time it is called. Using this method inside of loops is discouraged; instead use the Accessor class.

◆ noPrivateData()

bool SG::IAuxElement::noPrivateData ( ) const
protectedinherited

True if this element has no private data.

◆ operator=()

ConstAuxElement& SG::ConstAuxElement::operator= ( const ConstAuxElement other)
delete

No assignment to a const element.

◆ releasePrivateStoreForDtor()

void SG::ConstAuxElement::releasePrivateStoreForDtor ( )
private

Out-of-line portion of destructor.

Delete a private store if we have one.

Definition at line 80 of file AuxElement.cxx.

81 {
82  if (havePrivateData()) {
83  delete m_container;
84  }
85 }

◆ setHadPrivateData()

void SG::IAuxElement::setHadPrivateData ( )
privateinherited

Record that this element used to have private data.

◆ setHavePrivateData()

void SG::IAuxElement::setHavePrivateData ( )
privateinherited

Record that this element currently has private data.

◆ setIndex()

void SG::ConstAuxElement::setIndex ( size_t  index,
const SG::AuxVectorData container 
)
private

Set the index/container for this element.

Parameters
indexThe index of this object within the container.
containerThe container holding this object. May be null if this object is being removed from a container.

Usually this simply sets the index and container members of this object. However, in the case where this object has an associated private store, then we need to deal with releasing the store if the object is being added to a container, or making a new store if the object is being removed from a container.

◆ setIndexPrivate()

bool SG::ConstAuxElement::setIndexPrivate ( size_t  index,
const SG::AuxVectorData container 
)
private

Set the index/container for this element.

Parameters
indexThe index of this object within the container.
containerThe container holding this object. May be null if this object is being removed from a container.

This is called from setIndex when we have a private store to deal with.

Definition at line 97 of file AuxElement.cxx.

99 {
100  if (hadPrivateData()) {
101  // We had a private store, but it was released because we were added
102  // to a container.
103 
104  if (container == 0) {
105  // We're being moved out of the container. Make a new private
106  // store, copy the data, and switch to it.
107  auto privateData = new SG::AuxElementPrivateData;
108  AuxElement to (privateData, 0);
109  to.copyAux (*this);
112  m_container = privateData;
113  return true;
114  }
115  }
116  else if (havePrivateData() &&
117  typeid(*m_container) == typeid(AuxElementPrivateData))
118  {
119  // We currently have a private store.
120 
121  if (container != 0 && container != m_container) {
122  // We're being added to a container.
123  // Aux data has already been copied.
124  // Release private store.
127  delete m_container;
129  return false;
130  }
131  }
132  else {
133  // We have a standalone store.
134  throw SG::ExcBadPrivateStore ("Attempt to add/remove a standalone object "
135  "from a container.");
136  }
137 
140  return false;
141 }

◆ setNoPrivateData()

void SG::IAuxElement::setNoPrivateData ( )
privateinherited

Record that this element does not have private data.

Friends And Related Function Documentation

◆ AuxElement

friend class AuxElement
friend

Definition at line 292 of file AuxElement.h.

◆ SG::AuxVectorBase

friend class SG::AuxVectorBase
friend

Definition at line 293 of file AuxElement.h.

Member Data Documentation

◆ m_container

const SG::AuxVectorData* SG::ConstAuxElement::m_container
private

The container of which this object is an element.

Should be null if this object is not within a container, except that it may also point at a private store.

Definition at line 335 of file AuxElement.h.

◆ m_index

size_t SG::IAuxElement::m_index
privateinherited

The index of this element within its container.

Should be 0 if this object is not within a container.

Definition at line 128 of file IAuxElement.h.

◆ m_privateStoreState

PrivateStoreState SG::IAuxElement::m_privateStoreState
privateinherited

Definition at line 137 of file IAuxElement.h.


The documentation for this class was generated from the following files:
SG::AuxVectorData::getConstStore
const SG::IConstAuxStore * getConstStore() const
Return the current store, as a const interface.
SG::ConstAuxElement::AuxElement
friend class AuxElement
Definition: AuxElement.h:292
SG::AuxVectorData::getDecorIDs
const SG::auxid_set_t & getDecorIDs() const
Return a set of identifiers for decorations for this object.
Definition: AuxVectorData.cxx:215
SG::ConstAuxElement::container
const SG::AuxVectorData * container() const
Return the container holding this element.
index
Definition: index.py:1
SG::ConstAuxElement::m_container
const SG::AuxVectorData * m_container
The container of which this object is an element.
Definition: AuxElement.h:335
SG::AuxVectorData::getAuxIDs
const SG::auxid_set_t & getAuxIDs() const
Return a set of identifiers for existing data items in store associated with this object.
Definition: AuxVectorData.cxx:203
SG::IAuxElement::setHadPrivateData
void setHadPrivateData()
Record that this element used to have private data.
SG::IAuxElement::havePrivateData
bool havePrivateData() const
True if this element currently has private data.
SG::AuxElementPrivateData
Internal data container for private store.
Definition: AuxElement.cxx:46
SG::IAuxElement::setHavePrivateData
void setHavePrivateData()
Record that this element currently has private data.
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
SG::IAuxElement::setIndex
void setIndex(size_t index)
Set the index of this element within its container.
SG::ExcBadPrivateStore
Exception — Bad use of private store.
Definition: Control/AthContainers/AthContainers/exceptions.h:113
SG::IConstAuxStore::getDecorIDs
virtual const SG::auxid_set_t & getDecorIDs() const =0
Return a set of identifiers for decorations in this store.
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
SG::IAuxElement::hadPrivateData
bool hadPrivateData() const
True if this element had private data before it was added to its current container.
SG::IConstAuxStore::getAuxIDs
virtual const SG::auxid_set_t & getAuxIDs() const =0
Return a set of identifiers for existing data items in this store.