ATLAS Offline Software
Public Member Functions | Private Types | Private Attributes | List of all members
Athena::DvThinningHdlr< Container > Class Template Reference

Handle DataProxy holding DataVector. This class defines a (type-safe) protocol to pack and unpack thinned DataVector. More...

#include <IThinningHdlr.h>

Inheritance diagram for Athena::DvThinningHdlr< Container >:
Collaboration diagram for Athena::DvThinningHdlr< Container >:

Public Member Functions

 DvThinningHdlr (const Container &c)
 
void remove (const std::size_t idx)
 remove an element from the proxied DataVector More...
 
void commit ()
 pack the proxied collection This is needed in order to keep element link indices consistent and T/P converters unchanged. More...
 
void rollback ()
 unpack the proxied DataVector ie: restore it as it was before any thinning took place More...
 
virtual bool isMapping () const
 publish the type of underlying indexing (mapping or sequencing) More...
 

Private Types

typedef Container::PtrVector PtrVector
 

Private Attributes

const PtrVector m_backup
 Vector holding the pointers to the elements of DataVector, before any thinning took place. More...
 
PtrVectorm_container
 

Detailed Description

template<typename Container>
class Athena::DvThinningHdlr< Container >

Handle DataProxy holding DataVector. This class defines a (type-safe) protocol to pack and unpack thinned DataVector.

This is not MT-safe!

Definition at line 81 of file IThinningHdlr.h.

Member Typedef Documentation

◆ PtrVector

template<typename Container >
typedef Container::PtrVector Athena::DvThinningHdlr< Container >::PtrVector
private

Definition at line 83 of file IThinningHdlr.h.

Constructor & Destructor Documentation

◆ DvThinningHdlr()

template<typename Container >
Athena::DvThinningHdlr< Container >::DvThinningHdlr ( const Container c)
inline

Definition at line 91 of file IThinningHdlr.h.

91  :
93  m_backup ( const_cast<Container&>(c).begin(),
94  const_cast<Container&>(c).end() ),
95  m_container( const_cast<PtrVector&>(const_cast<Container&>(c).stdcont()) )
96  {}

Member Function Documentation

◆ commit()

template<typename Container >
void Athena::DvThinningHdlr< Container >::commit ( )
inlinevirtual

pack the proxied collection This is needed in order to keep element link indices consistent and T/P converters unchanged.

Implements Athena::IThinningHdlr.

Definition at line 101 of file IThinningHdlr.h.

102  {
103  typedef typename PtrVector::iterator Iter;
104  // move non NULL pointers at the begin of the vector,
105  // preserving relative order...
106  Iter itr = std::stable_partition( m_container.begin(),
107  m_container.end(),
109  // nicely truncate our container: removes the NULL elements
110  m_container.resize( std::distance( m_container.begin(), itr ) );
111  }

◆ isMapping()

virtual bool Athena::IThinningHdlr::isMapping ( ) const
inlinevirtualinherited

publish the type of underlying indexing (mapping or sequencing)

Reimplemented in Athena::IdcThinningHdlr< Container >.

Definition at line 58 of file IThinningHdlr.h.

58 {return false;}

◆ remove()

template<typename Container >
void Athena::DvThinningHdlr< Container >::remove ( const std::size_t  idx)
inlinevirtual

remove an element from the proxied DataVector

Implements Athena::IThinningHdlr.

Definition at line 98 of file IThinningHdlr.h.

99  { m_container[idx] = 0; }

◆ rollback()

template<typename Container >
void Athena::DvThinningHdlr< Container >::rollback ( )
inlinevirtual

unpack the proxied DataVector ie: restore it as it was before any thinning took place

Implements Athena::IThinningHdlr.

Definition at line 113 of file IThinningHdlr.h.

114  {
115  const std::size_t size = m_backup.size();
116  m_container.resize( size );
117  std::copy (m_backup.begin(), m_backup.end(),
118  m_container.begin());
119  }

Member Data Documentation

◆ m_backup

template<typename Container >
const PtrVector Athena::DvThinningHdlr< Container >::m_backup
private

Vector holding the pointers to the elements of DataVector, before any thinning took place.

Definition at line 87 of file IThinningHdlr.h.

◆ m_container

template<typename Container >
PtrVector& Athena::DvThinningHdlr< Container >::m_container
private

Definition at line 88 of file IThinningHdlr.h.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Athena::DvThinningHdlr::m_container
PtrVector & m_container
Definition: IThinningHdlr.h:88
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
Athena::detail::IsNonNullPtr
Predicate to spot non NULL pointers.
Definition: IThinningHdlr.h:65
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Container
storage of the time histories of all the cells
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
std::stable_partition
std::reverse_iterator< DataModel_detail::iterator< DVL > > stable_partition(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Predicate pred)
Specialization of stable_partition for DataVector/List.
Definition: DVL_algorithms.h:411
Athena::DvThinningHdlr::m_backup
const PtrVector m_backup
Vector holding the pointers to the elements of DataVector, before any thinning took place.
Definition: IThinningHdlr.h:87
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Athena::DvThinningHdlr::PtrVector
Container::PtrVector PtrVector
Definition: IThinningHdlr.h:83
calibdata.copy
bool copy
Definition: calibdata.py:27
Athena::IThinningHdlr
This class defines a protocol to pack and unpack thinned collections.
Definition: IThinningHdlr.h:36
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
python.compressB64.c
def c
Definition: compressB64.py:93