ATLAS Offline Software
Loading...
Searching...
No Matches
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
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 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.
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 130 of file IThinningHdlr.h.

Member Typedef Documentation

◆ Vector_t

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

Definition at line 132 of file IThinningHdlr.h.

Constructor & Destructor Documentation

◆ StdThinningHdlr()

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

Definition at line 140 of file IThinningHdlr.h.

140 :
142 m_backup ( const_cast<Container&>(c).begin(),
143 const_cast<Container&>(c).end() ),
144 m_container( const_cast<Container&>(c) )
145 {}
Handle DataProxy holding std::vector<T> This class defines a (type-safe) protocol to pack and unpack ...
const Vector_t m_backup
Vector holding the pointers to the elements of std::vector<T>, before any thinning took place.

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

151 {
152 typedef typename Vector_t::iterator Iter;
153 // move non NULL pointers at the begin of the vector,
154 // preserving relative order...
156 m_container.end(),
158 // nicely truncate our container: removes the NULL elements
159 m_container.resize( std::distance( m_container.begin(), itr ) );
160 }
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::StdThinningHdlr< Container >::remove ( const std::size_t idx)
inlinevirtual

remove an element from the proxied DataVector

Implements Athena::IThinningHdlr.

Definition at line 147 of file IThinningHdlr.h.

148 { 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 162 of file IThinningHdlr.h.

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

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

◆ m_container

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

Definition at line 137 of file IThinningHdlr.h.


The documentation for this class was generated from the following file: