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

Handle DataProxy holding std::vector<T> This class defines a (type-safe) protocol to pack and unpack thinned DataVector. More...

#include <IThinningHdlr.h>

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

Public Member Functions

 StdThinningHdlr (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 Vector_t
 

Private Attributes

const Vector_t m_backup
 Vector holding the pointers to the elements of std::vector<T>, before any thinning took place. More...
 
Vector_tm_container
 

Detailed Description

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

Handle DataProxy holding std::vector<T> This class defines a (type-safe) protocol to pack and unpack thinned DataVector.

This is not MT-safe!

Definition at line 131 of file IThinningHdlr.h.

Member Typedef Documentation

◆ Vector_t

template<typename Container >
typedef Container Athena::StdThinningHdlr< Container >::Vector_t
private

Definition at line 133 of file IThinningHdlr.h.

Constructor & Destructor Documentation

◆ StdThinningHdlr()

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

Definition at line 141 of file IThinningHdlr.h.

141  :
143  m_backup ( const_cast<Container&>(c).begin(),
144  const_cast<Container&>(c).end() ),
145  m_container( const_cast<Container&>(c) )
146  {}

Member Function Documentation

◆ commit()

template<typename Container >
void Athena::StdThinningHdlr< 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 151 of file IThinningHdlr.h.

152  {
153  typedef typename Vector_t::iterator Iter;
154  // move non NULL pointers at the begin of the vector,
155  // preserving relative order...
156  Iter itr = std::stable_partition( m_container.begin(),
157  m_container.end(),
159  // nicely truncate our container: removes the NULL elements
160  m_container.resize( std::distance( m_container.begin(), itr ) );
161  }

◆ 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::StdThinningHdlr< Container >::remove ( const std::size_t  idx)
inlinevirtual

remove an element from the proxied DataVector

Implements Athena::IThinningHdlr.

Definition at line 148 of file IThinningHdlr.h.

149  { m_container[idx] = 0; }

◆ rollback()

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

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

Implements Athena::IThinningHdlr.

Definition at line 163 of file IThinningHdlr.h.

164  {
165  const std::size_t size = m_backup.size();
166  m_container.resize( size );
167  std::copy (m_backup.begin(), m_backup.end(),
168  m_container.begin());
169  }

Member Data Documentation

◆ m_backup

template<typename Container >
const Vector_t Athena::StdThinningHdlr< Container >::m_backup
private

Vector holding the pointers to the elements of std::vector<T>, before any thinning took place.

Definition at line 137 of file IThinningHdlr.h.

◆ m_container

template<typename Container >
Vector_t& Athena::StdThinningHdlr< Container >::m_container
private

Definition at line 138 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::StdThinningHdlr::m_container
Vector_t & m_container
Definition: IThinningHdlr.h:138
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::StdThinningHdlr::m_backup
const Vector_t m_backup
Vector holding the pointers to the elements of std::vector<T>, before any thinning took place.
Definition: IThinningHdlr.h:137
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
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