ATLAS Offline Software
Loading...
Searching...
No Matches
Athena::DvThinningHdlr< Container > Class Template Reference

Handle DataProxy holding 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
void commit ()
 pack the proxied collection This is needed in order to keep element link indices consistent and T/P converters unchanged.
void rollback ()
 unpack the proxied DataVector ie: restore it as it was before any thinning took place
virtual bool isMapping () const
 publish the type of underlying indexing (mapping or sequencing)

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.
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 {}
Handle DataProxy holding DataVector.
const PtrVector m_backup
Vector holding the pointers to the elements of DataVector, before any thinning took place.
Container::PtrVector PtrVector

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...
106 m_container.end(),
108 // nicely truncate our container: removes the NULL elements
109 m_container.resize( std::distance( m_container.begin(), itr ) );
110 }
DataModel_detail::iterator< DVL > stable_partition(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of stable_partition for DataVector/List.

◆ 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: