Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 80 of file IThinningHdlr.h.

Member Typedef Documentation

◆ PtrVector

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

Definition at line 82 of file IThinningHdlr.h.

Constructor & Destructor Documentation

◆ DvThinningHdlr()

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

Definition at line 90 of file IThinningHdlr.h.

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

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 100 of file IThinningHdlr.h.

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

◆ 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 57 of file IThinningHdlr.h.

57 {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 97 of file IThinningHdlr.h.

98  { 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 112 of file IThinningHdlr.h.

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

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 86 of file IThinningHdlr.h.

◆ m_container

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

Definition at line 87 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:87
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
Athena::detail::IsNonNullPtr
Predicate to spot non NULL pointers.
Definition: IThinningHdlr.h:64
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:86
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Athena::DvThinningHdlr::PtrVector
Container::PtrVector PtrVector
Definition: IThinningHdlr.h:82
calibdata.copy
bool copy
Definition: calibdata.py:27
Athena::IThinningHdlr
This class defines a protocol to pack and unpack thinned collections.
Definition: IThinningHdlr.h:35
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