| The Gaudi Framework v32r1 (f65d50dc)

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
SharedObjectsContainer< TYPE > Class Template Reference

Very simple class to represent the container of objects which are not owned by this container. More...

`#include <GaudiKernel/SharedObjectsContainer.h>`

Inheritance diagram for SharedObjectsContainer< TYPE >:
[legend]
Collaboration diagram for SharedObjectsContainer< TYPE >:
[legend]

## Public Types
typedef std::vector< const TYPE * > | ConstVector
| the actual container type More...
typedef ConstVector::value_type | value_type
| various types (to make STL happy) More...
typedef ConstVector::size_type | size_type
typedef ConstVector::reference | reference
typedef ConstVector::const_reference | const_reference
typedef ConstVector::iterator | iterator
typedef ConstVector::const_iterator | const_iterator
typedef ConstVector::reverse_iterator | reverse_iterator
typedef ConstVector::const_reverse_iterator | const_reverse_iterator
Public Types inherited from ObjectContainerBase
typedef size_t | size_type
| size_type, to conform the STL container interface More...

## Public Member Functions
| SharedObjectsContainer ()=default
| SharedObjectsContainer (SharedObjectsContainer &&)=default
SharedObjectsContainer & | operator= (SharedObjectsContainer &&)=default
| SharedObjectsContainer (const ConstVector &data)
| SharedObjectsContainer (ConstVector &&data)
template<class DATA >
| SharedObjectsContainer (DATA first, DATA last)
| the templated constructor from the pair of iterators More...
template<class DATA , class PREDICATE >
| SharedObjectsContainer (DATA first, DATA last, const PREDICATE &cut)
| the templated constructor from the pair of iterators and the predicate. More...
const CLID & | clID () const override
| Retrieve the unique class ID (virtual) More...
const ConstVector & | data () const
| get the access to the underlying container (const) More...
| operator const ConstVector & () const
| cast to the underlying container More...
size_type | size () const
| get the actual size of the container More...
bool | empty () const
| empty container? More...
void | push_back (const TYPE *object)
| insert one object into the container More...
void | insert (const TYPE *object)
| insert one object into the container More...
template<class DATA >
void | insert (DATA first, DATA last)
| add the sequence of objects into the container More...
template<class DATA , class PREDICATE >
void | insert (DATA first, DATA last, const PREDICATE &cut)
| add the sequence of 'good'objects into the container More...
template<class OUTPUT , class PREDICATE >
OUTPUT | get (const PREDICATE &cut, OUTPUT output) const
| get from the container all objects which satisfy the certain criteria More...
void | erase (iterator i)
| erase the object by iterator More...
template<class PREDICATE >
void | erase (const PREDICATE &cut)
| erase the objects which satisfy the criteria More...
bool | erase (const TYPE *object)
| erase the first occurance of the certain element More...
reference | operator[] (size_type index)
| index access More...
const_reference | operator[] (size_type index) const
| index access (const-version) More...
reference | operator() (size_type index)
| 'functional'-access More...
const_reference | operator() (size_type index) const
| 'functional'-access (const version) More...
reference | at (size_type index)
| checked access More...
const_reference | at (size_type index) const
| checked access (const-version) More...
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
reverse_iterator | rbegin ()
reverse_iterator | rend ()
const_reverse_iterator | rbegin () const
const_reverse_iterator | rend () const
reference | front ()
| the first element (only for non-empty vectors) More...
const_reference | front () const
| the first element (only for non-empty vectors) (const-version) More...
reference | back ()
| the last element (only for non-empty vectors) More...
const_reference | back () const
| the last element (only for non-empty vectors) (const-version) More...
bool | operator== (const SharedObjectsContainer &right) const
| equal content with other container ? More...
bool | operator== (const ConstVector &right) const
| equal content with corresponding vector ? More...
bool | operator< (const SharedObjectsContainer &right) const
| comparisons with other container More...
bool | operator< (const ConstVector &right) const
| comparisons with corresponding vector More...
long | index (const ContainedObject *object) const override
| Distance of a given object from the beginning of its container. More...
const ContainedObject * | containedObject (long index) const override
| Pointer to an object of a given distance. More...
ContainedObject * | containedObject (long index) override
size_type | numberOfObjects () const override
| Number of objects in the container. More...
long | add (ContainedObject *object) override
| Virtual functions (forwards to the concrete container definitions) Add an object to the container. More...
long | remove (ContainedObject *value) override
| Release object from the container (the pointer will be removed from the container, but the object itself will remain alive). More...
Public Member Functions inherited from DataObject
| DataObject ()
| Standard Constructor. More...
| DataObject (const DataObject &rhs)
| Copy Constructor. More...
DataObject & | operator= (const DataObject &rhs)
| Assignment Operator. More...
| DataObject (DataObject &&rhs)
| Move Constructor. More...
DataObject & | operator= (DataObject &&rhs)
| Move Assignment Operator. More...
virtual | ~DataObject ()
| Standard Destructor. More...
virtual unsigned long | addRef ()
| Add reference to object. More...
virtual unsigned long | release ()
| release reference to object More...
const std::string & | name () const
| Retreive DataObject name. It is the name when registered in the store. More...
virtual StatusCode | update ()
| Provide empty placeholder for internal object reconfiguration callback. More...
void | setRegistry (IRegistry *pRegistry)
| Set pointer to Registry. More...
IRegistry * | registry () const
| Get pointer to Registry. More...
LinkManager * | linkMgr () const
| Retrieve Link manager. More...
unsigned char | version () const
| Retrieve version number of this object representation. More...
void | setVersion (unsigned char vsn)
| Set version number of this object representation. More...
unsigned long | refCount () const
| Return the refcount. More...
virtual std::ostream & | fillStream (std::ostream &s) const
| Fill the output stream (ASCII) More...

## Static Public Member Functions
static const CLID & | classID ()
| Retrieve the unuqie class ID (static) More...
Static Public Member Functions inherited from DataObject
static const CLID & | classID ()
| Retrieve reference to class definition structure (static access) More...

## Private Attributes
ConstVector | m_data

## Additional Inherited Members
Protected Member Functions inherited from ObjectContainerBase
| ObjectContainerBase ()=default
| Constructor. More...
| ObjectContainerBase (ObjectContainerBase &&)=default
ObjectContainerBase & | operator= (ObjectContainerBase &&)=default

## Detailed Description

### template<class TYPE>
class SharedObjectsContainer< TYPE >

Very simple class to represent the container of objects which are not owned by this container.

This concept seem to be very useful for LHCb HLT, DaVinci, tracking, alignments.

Warning
  the container is not persistable (on-purpose)

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl

Date
  2008-07-23

Definition at line 29 of file SharedObjectsContainer.h.

## Member Typedef Documentation

## ◆ const_iterator

template<class TYPE >

typedef ConstVector::const_iterator SharedObjectsContainer< TYPE >::const_iterator

Definition at line 40 of file SharedObjectsContainer.h.

## ◆ const_reference

template<class TYPE >

typedef ConstVector::const_reference SharedObjectsContainer< TYPE >::const_reference

Definition at line 38 of file SharedObjectsContainer.h.

## ◆ const_reverse_iterator

template<class TYPE >

typedef ConstVector::const_reverse_iterator SharedObjectsContainer< TYPE >::const_reverse_iterator

Definition at line 42 of file SharedObjectsContainer.h.

## ◆ ConstVector

template<class TYPE >

typedef std::vector<const TYPE*> SharedObjectsContainer< TYPE >::ConstVector

the actual container type

Definition at line 33 of file SharedObjectsContainer.h.

## ◆ iterator

template<class TYPE >

typedef ConstVector::iterator SharedObjectsContainer< TYPE >::iterator

Definition at line 39 of file SharedObjectsContainer.h.

## ◆ reference

template<class TYPE >

typedef ConstVector::reference SharedObjectsContainer< TYPE >::reference

Definition at line 37 of file SharedObjectsContainer.h.

## ◆ reverse_iterator

template<class TYPE >

typedef ConstVector::reverse_iterator SharedObjectsContainer< TYPE >::reverse_iterator

Definition at line 41 of file SharedObjectsContainer.h.

## ◆ size_type

template<class TYPE >

typedef ConstVector::size_type SharedObjectsContainer< TYPE >::size_type

Definition at line 36 of file SharedObjectsContainer.h.

## ◆ value_type

template<class TYPE >

typedef ConstVector::value_type SharedObjectsContainer< TYPE >::value_type

various types (to make STL happy)

Definition at line 35 of file SharedObjectsContainer.h.

## Constructor & Destructor Documentation

## ◆ SharedObjectsContainer() [1/6]

template<class TYPE >

SharedObjectsContainer< TYPE >::SharedObjectsContainer | ( |  | ) |
| default

## ◆ SharedObjectsContainer() [2/6]

template<class TYPE >

SharedObjectsContainer< TYPE >::SharedObjectsContainer | ( | SharedObjectsContainer< TYPE > && |  | ) |
| default

## ◆ SharedObjectsContainer() [3/6]

template<class TYPE >

SharedObjectsContainer< TYPE >::SharedObjectsContainer | ( | const ConstVector & | data | ) |
| inline

Definition at line 52 of file SharedObjectsContainer.h.

52 : m_data( data ) {}
SharedObjectsContainer::data
const ConstVector & data() const
get the access to the underlying container (const)
Definition: SharedObjectsContainer.h:108
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ SharedObjectsContainer() [4/6]

template<class TYPE >

SharedObjectsContainer< TYPE >::SharedObjectsContainer | ( | ConstVector && | data | ) |
| inline

Definition at line 53 of file SharedObjectsContainer.h.

53 : m_data( std::move( data ) ) {}
std::move
T move(T... args)
SharedObjectsContainer::data
const ConstVector & data() const
get the access to the underlying container (const)
Definition: SharedObjectsContainer.h:108
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ SharedObjectsContainer() [5/6]

template<class TYPE >
template<class DATA >

SharedObjectsContainer< TYPE >::SharedObjectsContainer | ( | DATA | first,
|  | DATA | last
| ) |  |
| inline

the templated constructor from the pair of iterators

Parameters

  first | 'begin'-iterator of the input sequence
  last | 'last'-iterator of the input sequence

Definition at line 60 of file SharedObjectsContainer.h.

60 : m_data( first, last ) {}
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ SharedObjectsContainer() [6/6]

template<class TYPE >
template<class DATA , class PREDICATE >

SharedObjectsContainer< TYPE >::SharedObjectsContainer | ( | DATA | first,
|  | DATA | last,
|  | const PREDICATE & | cut
| ) |  |
| inline

the templated constructor from the pair of iterators and the predicate.

Only the elements which satisfy the criteria goes into the container e.g. create the container only with "basic" particles:

typedef SharedObjectsContainer<LHCb::Particle> PARTICLES ;
// some sequence of someting, convertiblle to "const LHCb::Particle*":
SEQUENCE source = ... ;
PARTICLES* particles = new PARTICLES
( source.begin() ,
source.end () ,
std::mem_fun(&LHCb::Particle::isBasic) ) ;

Parameters

  first | 'begin'-iterator if the input sequence
  last | 'last'-iterator of the input sequence
  cut | pre predicate

Definition at line 85 of file SharedObjectsContainer.h.

85 {
86 insert( first, last, cut );
87 }
SharedObjectsContainer::insert
void insert(const TYPE *object)
insert one object into the container
Definition: SharedObjectsContainer.h:125

## Member Function Documentation

## ◆ add()

template<class TYPE >

long SharedObjectsContainer< TYPE >::add | ( | ContainedObject * | object | ) |
| inline override virtual

Virtual functions (forwards to the concrete container definitions) Add an object to the container.

On success the object's index is returned.

Implements ObjectContainerBase.

Definition at line 317 of file SharedObjectsContainer.h.

317 {
318 if ( !object ) { return -1; } // RETURN
319 TYPE* _obj = dynamic_cast<TYPE*>( object );
320 if ( !_obj ) { return -1; } // RETURN
321 const size_type pos = size();
322 push_back( _obj );
323 return pos;
324 }
SharedObjectsContainer::size
size_type size() const
get the actual size of the container
Definition: SharedObjectsContainer.h:115
SharedObjectsContainer::push_back
void push_back(const TYPE *object)
insert one object into the container
Definition: SharedObjectsContainer.h:121
SharedObjectsContainer::size_type
ConstVector::size_type size_type
Definition: SharedObjectsContainer.h:36

## ◆ at() [1/2]

template<class TYPE >

reference SharedObjectsContainer< TYPE >::at | ( | size_type | index | ) |
| inline

checked access

Definition at line 252 of file SharedObjectsContainer.h.

252 { return m_data.at( index ); }
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
std::vector::at
T at(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ at() [2/2]

template<class TYPE >

const_reference SharedObjectsContainer< TYPE >::at | ( | size_type | index | ) | const
| inline

checked access (const-version)

Definition at line 254 of file SharedObjectsContainer.h.

254 { return m_data.at( index ); }
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
std::vector::at
T at(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ back() [1/2]

template<class TYPE >

reference SharedObjectsContainer< TYPE >::back | ( |  | ) |
| inline

the last element (only for non-empty vectors)

Definition at line 274 of file SharedObjectsContainer.h.

274 { return m_data.back(); }
std::vector::back
T back(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ back() [2/2]

template<class TYPE >

const_reference SharedObjectsContainer< TYPE >::back | ( |  | ) | const
| inline

the last element (only for non-empty vectors) (const-version)

Definition at line 276 of file SharedObjectsContainer.h.

276 { return m_data.back(); }
std::vector::back
T back(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ begin() [1/2]

template<class TYPE >

iterator SharedObjectsContainer< TYPE >::begin | ( |  | ) |
| inline

Definition at line 258 of file SharedObjectsContainer.h.

258 { return m_data.begin(); }
std::vector::begin
T begin(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ begin() [2/2]

template<class TYPE >

const_iterator SharedObjectsContainer< TYPE >::begin | ( |  | ) | const
| inline

Definition at line 260 of file SharedObjectsContainer.h.

260 { return m_data.begin(); }
std::vector::begin
T begin(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ classID()

template<class TYPE >

static const CLID& SharedObjectsContainer< TYPE >::classID | ( |  | ) |
| inline static

Retrieve the unuqie class ID (static)

Definition at line 94 of file SharedObjectsContainer.h.

94 {
95 static const CLID s_clid = ( ( static_cast<CLID>( -1 ) << 16 ) // 16 used and 16 empty bits
96 & !CLID_ObjectVector // not an ObjectVector
97 & !CLID_ObjectList // not an ObjectList
98 & !static_cast<CLID>( 0x00030000 ) // not a KeyedContainer/map
99 & !static_cast<CLID>( 0x00040000 ) ) // not a KeyedContainer/hashmap
100 + TYPE::classID(); // the specific CLID from the contents
101 //
102 return s_clid;
103 }
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8

## ◆ clID()

template<class TYPE >

const CLID& SharedObjectsContainer< TYPE >::clID | ( |  | ) | const
| inline override virtual

Retrieve the unique class ID (virtual)

Reimplemented from DataObject.

Definition at line 92 of file SharedObjectsContainer.h.

92 { return SharedObjectsContainer<TYPE>::classID(); }
SharedObjectsContainer::classID
static const CLID & classID()
Retrieve the unuqie class ID (static)
Definition: SharedObjectsContainer.h:94

## ◆ containedObject() [1/2]

template<class TYPE >

const ContainedObject* SharedObjectsContainer< TYPE >::containedObject | ( | long | index | ) | const
| inline override virtual

Pointer to an object of a given distance.

Parameters

  index | th eindex to be checked

Returns
  the object

Implements ObjectContainerBase.

Definition at line 303 of file SharedObjectsContainer.h.

303 {
304 if ( 0 > index || !( index < (long)size() ) ) { return nullptr; } // RETURN
305 return m_data[index];
306 }
SharedObjectsContainer::size
size_type size() const
get the actual size of the container
Definition: SharedObjectsContainer.h:115
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ containedObject() [2/2]

template<class TYPE >

ContainedObject* SharedObjectsContainer< TYPE >::containedObject | ( | long | index | ) |
| inline override virtual

Implements ObjectContainerBase.

Definition at line 307 of file SharedObjectsContainer.h.

307 {
308 if ( 0 > index || !( index < (long)size() ) ) { return nullptr; } // RETURN
309 return &const_cast<TYPE&>( *m_data[index] );
310 }
SharedObjectsContainer::size
size_type size() const
get the actual size of the container
Definition: SharedObjectsContainer.h:115
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ data()

template<class TYPE >

const ConstVector& SharedObjectsContainer< TYPE >::data | ( |  | ) | const
| inline

get the access to the underlying container (const)

Definition at line 108 of file SharedObjectsContainer.h.

108 { return m_data; }
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ empty()

template<class TYPE >

bool SharedObjectsContainer< TYPE >::empty | ( |  | ) | const
| inline

empty container?

Definition at line 117 of file SharedObjectsContainer.h.

117 { return m_data.empty(); }
std::vector::empty
T empty(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ end() [1/2]

template<class TYPE >

iterator SharedObjectsContainer< TYPE >::end | ( |  | ) |
| inline

Definition at line 259 of file SharedObjectsContainer.h.

259 { return m_data.end(); }
std::vector::end
T end(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ end() [2/2]

template<class TYPE >

const_iterator SharedObjectsContainer< TYPE >::end | ( |  | ) | const
| inline

Definition at line 261 of file SharedObjectsContainer.h.

261 { return m_data.end(); }
std::vector::end
T end(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ erase() [1/3]

template<class TYPE >

void SharedObjectsContainer< TYPE >::erase | ( | iterator | i | ) |
| inline

erase the object by iterator

Definition at line 194 of file SharedObjectsContainer.h.

194 { m_data.erase( i ); }
std::vector::erase
T erase(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ erase() [2/3]

template<class TYPE >
template<class PREDICATE >

void SharedObjectsContainer< TYPE >::erase | ( | const PREDICATE & | cut | ) |
| inline

erase the objects which satisfy the criteria

E.g. remove all particles with small transverse momentum

namespace bl = boost::lambda ;
typedef SharedObjectsContainer<LHCb::Particle> PARTICLES ;
PARTICLES* particles = ... ;
particles -> erase
( bl::bind(&LHCb::Particle::pt,bl::_1) < 1 * Gaudi::Units::GeV ) ;

See also
  std::remove_if

Parameters

  cut | predicate

Definition at line 213 of file SharedObjectsContainer.h.

213 {
214 m_data.erase( std::remove_if( begin(), end(), cut ), end() );
215 }
std::remove_if
T remove_if(T... args)
SharedObjectsContainer::begin
iterator begin()
Definition: SharedObjectsContainer.h:258
std::vector::erase
T erase(T... args)
SharedObjectsContainer::end
iterator end()
Definition: SharedObjectsContainer.h:259
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ erase() [3/3]

template<class TYPE >

bool SharedObjectsContainer< TYPE >::erase | ( | const TYPE * | object | ) |
| inline

erase the first occurance of the certain element

To remove all occurances one can use:

typedef SharedObjectsContainer<LHCb::Particle> PARTICLES ;
PARTICLES* particles = ... ;
const LHCb::Particle* B = ... ;
// remove all occurances
while ( particles -> erase ( B ) ) {} ;

Parameters

  object | the element to be removed

Returns
  true if the element is removed

Definition at line 234 of file SharedObjectsContainer.h.

234 {
235 auto i = std::find( begin(), end(), object );
236 if ( end() == i ) { return false; }
237 m_data.erase( i );
238 return true;
239 }
SharedObjectsContainer::begin
iterator begin()
Definition: SharedObjectsContainer.h:258
std::vector::erase
T erase(T... args)
SharedObjectsContainer::end
iterator end()
Definition: SharedObjectsContainer.h:259
std::find
T find(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ front() [1/2]

template<class TYPE >

reference SharedObjectsContainer< TYPE >::front | ( |  | ) |
| inline

the first element (only for non-empty vectors)

Definition at line 270 of file SharedObjectsContainer.h.

270 { return m_data.front(); }
std::vector::front
T front(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ front() [2/2]

template<class TYPE >

const_reference SharedObjectsContainer< TYPE >::front | ( |  | ) | const
| inline

the first element (only for non-empty vectors) (const-version)

Definition at line 272 of file SharedObjectsContainer.h.

272 { return m_data.front(); }
std::vector::front
T front(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ get()

template<class TYPE >
template<class OUTPUT , class PREDICATE >

OUTPUT SharedObjectsContainer< TYPE >::get | ( | const PREDICATE & | cut,
|  | OUTPUT | output
| ) |  | const
| inline

get from the container all objects which satisfy the certain criteria

E.g. get all particles with transverse momentum in excess of 1 * GeV

namespace bl = boost::lambda ;
typedef SharedObjectsContainer<LHCb::Particle> PARTICLES ;
typedef std::vector<const LHCb::Particle*> TARGET ;
PARTICLES* particles = ... ;
TARGET target ;
particles -> get
( bl::bind(&LHCb::Particle::pt,bl::_1) > 1 * Gaudi::Units::GeV ,
std::back_inserter ( target ) ) ;

Parameters

  cut | the predicate
  outptut | the output iterator

Returns
  the current position of the output itrator (almost useless)

Definition at line 190 of file SharedObjectsContainer.h.

190 {
191 return std::copy_if( begin(), end(), output, std::cref( cut ) );
192 }
std::copy_if
T copy_if(T... args)
gaudirun.output
output
Definition: gaudirun.py:484
SharedObjectsContainer::begin
iterator begin()
Definition: SharedObjectsContainer.h:258
SharedObjectsContainer::end
iterator end()
Definition: SharedObjectsContainer.h:259
std::cref
T cref(T... args)

## ◆ index()

template<class TYPE >

long SharedObjectsContainer< TYPE >::index | ( | const ContainedObject * | object | ) | const
| inline override virtual

Distance of a given object from the beginning of its container.

Parameters

  object | the object to be checked

Implements ObjectContainerBase.

Definition at line 295 of file SharedObjectsContainer.h.

295 {
296 auto _i = std::find( begin(), end(), object );
297 return end() != _i ? ( _i - begin() ) : -1; // RETURN
298 }
SharedObjectsContainer::begin
iterator begin()
Definition: SharedObjectsContainer.h:258
SharedObjectsContainer::end
iterator end()
Definition: SharedObjectsContainer.h:259
std::find
T find(T... args)

## ◆ insert() [1/3]

template<class TYPE >

void SharedObjectsContainer< TYPE >::insert | ( | const TYPE * | object | ) |
| inline

insert one object into the container

Parameters

  object | object to be added

Definition at line 125 of file SharedObjectsContainer.h.

125 { m_data.push_back( object ); }
std::vector::push_back
T push_back(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ insert() [2/3]

template<class TYPE >
template<class DATA >

void SharedObjectsContainer< TYPE >::insert | ( | DATA | first,
|  | DATA | last
| ) |  |
| inline

add the sequence of objects into the container

Parameters

  first | 'begin'-iterator for the sequnce
  last | 'end'-iterator for the sequence

Definition at line 131 of file SharedObjectsContainer.h.

131 {
132 m_data.insert( end(), first, last );
133 }
SharedObjectsContainer::end
iterator end()
Definition: SharedObjectsContainer.h:259
std::vector::insert
T insert(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ insert() [3/3]

template<class TYPE >
template<class DATA , class PREDICATE >

void SharedObjectsContainer< TYPE >::insert | ( | DATA | first,
|  | DATA | last,
|  | const PREDICATE & | cut
| ) |  |
| inline

add the sequence of 'good'objects into the container

Only the objects which satisfy the predicate go to the container, e.g. put into container only particles which transverse momentum in excess of 1 * GeV:

namespace bl = boost::lambda ;
typedef SharedObjectsContainer<LHCb::Particle> PARTICLES ;
// some sequence of someting, convertible to "const LHCb::Particle*":
SEQUENCE source = ... ;
PARTICLES* particles = ... ;
particles -> insert
( source.begin() ,
source.end () ,
bl::bind(&LHCb::Particle::pt,bl::_1) > 1 * Gaudi::Units::GeV ) ;

Parameters

  first | 'begin'-iterator for the sequnce
  last | 'end'-iterator for the sequence
  cut | the predicate to be applied

Definition at line 161 of file SharedObjectsContainer.h.

161 {
162 m_data.reserve( m_data.size() + std::distance( first, last ) );
163 std::copy_if( first, last, std::back_inserter( m_data ), std::cref( cut ) );
164 }
std::copy_if
T copy_if(T... args)
std::distance
T distance(T... args)
std::vector::size
T size(T... args)
std::cref
T cref(T... args)
std::back_inserter
T back_inserter(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340
std::vector::reserve
T reserve(T... args)

## ◆ numberOfObjects()

template<class TYPE >

size_type SharedObjectsContainer< TYPE >::numberOfObjects | ( |  | ) | const
| inline override virtual

Number of objects in the container.

Implements ObjectContainerBase.

Definition at line 312 of file SharedObjectsContainer.h.

312 { return m_data.size(); }
std::vector::size
T size(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator const ConstVector &()

template<class TYPE >

SharedObjectsContainer< TYPE >::operator const ConstVector & | ( |  | ) | const
| inline

cast to the underlying container

Definition at line 110 of file SharedObjectsContainer.h.

110 { return data(); }
SharedObjectsContainer::data
const ConstVector & data() const
get the access to the underlying container (const)
Definition: SharedObjectsContainer.h:108

## ◆ operator()() [1/2]

template<class TYPE >

reference SharedObjectsContainer< TYPE >::operator() | ( | size_type | index | ) |
| inline

'functional'-access

Definition at line 248 of file SharedObjectsContainer.h.

248 { return m_data[index]; }
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator()() [2/2]

template<class TYPE >

const_reference SharedObjectsContainer< TYPE >::operator() | ( | size_type | index | ) | const
| inline

'functional'-access (const version)

Definition at line 250 of file SharedObjectsContainer.h.

250 { return m_data[index]; }
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator<() [1/2]

template<class TYPE >

bool SharedObjectsContainer< TYPE >::operator< | ( | const SharedObjectsContainer< TYPE > & | right | ) | const
| inline

comparisons with other container

Definition at line 285 of file SharedObjectsContainer.h.

285 { return m_data < right.m_data; }
std::right
T right(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator<() [2/2]

template<class TYPE >

bool SharedObjectsContainer< TYPE >::operator< | ( | const ConstVector & | right | ) | const
| inline

comparisons with corresponding vector

Definition at line 287 of file SharedObjectsContainer.h.

287 { return m_data < right; }
std::right
T right(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator=()

template<class TYPE >

SharedObjectsContainer& SharedObjectsContainer< TYPE >::operator= | ( | SharedObjectsContainer< TYPE > && |  | ) |
| default

## ◆ operator==() [1/2]

template<class TYPE >

bool SharedObjectsContainer< TYPE >::operator== | ( | const SharedObjectsContainer< TYPE > & | right | ) | const
| inline

equal content with other container ?

Definition at line 281 of file SharedObjectsContainer.h.

281 { return &right == this || right.m_data == m_data; }
std::right
T right(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator==() [2/2]

template<class TYPE >

bool SharedObjectsContainer< TYPE >::operator== | ( | const ConstVector & | right | ) | const
| inline

equal content with corresponding vector ?

Definition at line 283 of file SharedObjectsContainer.h.

283 { return m_data == right; }
std::right
T right(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator[]() [1/2]

template<class TYPE >

reference SharedObjectsContainer< TYPE >::operator[] | ( | size_type | index | ) |
| inline

index access

Definition at line 244 of file SharedObjectsContainer.h.

244 { return m_data[index]; }
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ operator[]() [2/2]

template<class TYPE >

const_reference SharedObjectsContainer< TYPE >::operator[] | ( | size_type | index | ) | const
| inline

index access (const-version)

Definition at line 246 of file SharedObjectsContainer.h.

246 { return m_data[index]; }
SharedObjectsContainer::index
long index(const ContainedObject *object) const override
Distance of a given object from the beginning of its container.
Definition: SharedObjectsContainer.h:295
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ push_back()

template<class TYPE >

void SharedObjectsContainer< TYPE >::push_back | ( | const TYPE * | object | ) |
| inline

insert one object into the container

Parameters

  object | object to be added

Definition at line 121 of file SharedObjectsContainer.h.

121 { m_data.push_back( object ); }
std::vector::push_back
T push_back(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ rbegin() [1/2]

template<class TYPE >

reverse_iterator SharedObjectsContainer< TYPE >::rbegin | ( |  | ) |
| inline

Definition at line 262 of file SharedObjectsContainer.h.

262 { return m_data.rbegin(); }
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340
std::vector::rbegin
T rbegin(T... args)

## ◆ rbegin() [2/2]

template<class TYPE >

const_reverse_iterator SharedObjectsContainer< TYPE >::rbegin | ( |  | ) | const
| inline

Definition at line 264 of file SharedObjectsContainer.h.

264 { return m_data.rbegin(); }
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340
std::vector::rbegin
T rbegin(T... args)

## ◆ remove()

template<class TYPE >

long SharedObjectsContainer< TYPE >::remove | ( | ContainedObject * | value | ) |
| inline override virtual

Release object from the container (the pointer will be removed from the container, but the object itself will remain alive).

If the object was found it's index is returned.

Implements ObjectContainerBase.

Definition at line 329 of file SharedObjectsContainer.h.

329 {
330 auto _i = std::find( begin(), end(), value );
331 if ( end() == _i ) { return -1; } // RETURN
332 const size_type pos = _i - begin();
333 m_data.erase( _i );
334 return pos; // RETURN
335 }
SharedObjectsContainer::size_type
ConstVector::size_type size_type
Definition: SharedObjectsContainer.h:36
SharedObjectsContainer::begin
iterator begin()
Definition: SharedObjectsContainer.h:258
std::vector::erase
T erase(T... args)
SharedObjectsContainer::end
iterator end()
Definition: SharedObjectsContainer.h:259
std::find
T find(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ rend() [1/2]

template<class TYPE >

reverse_iterator SharedObjectsContainer< TYPE >::rend | ( |  | ) |
| inline

Definition at line 263 of file SharedObjectsContainer.h.

263 { return m_data.rend(); }
std::vector::rend
T rend(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ rend() [2/2]

template<class TYPE >

const_reverse_iterator SharedObjectsContainer< TYPE >::rend | ( |  | ) | const
| inline

Definition at line 265 of file SharedObjectsContainer.h.

265 { return m_data.rend(); }
std::vector::rend
T rend(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## ◆ size()

template<class TYPE >

size_type SharedObjectsContainer< TYPE >::size | ( |  | ) | const
| inline

get the actual size of the container

Definition at line 115 of file SharedObjectsContainer.h.

115 { return m_data.size(); }
std::vector::size
T size(T... args)
SharedObjectsContainer::m_data
ConstVector m_data
Definition: SharedObjectsContainer.h:340

## Member Data Documentation

## ◆ m_data

template<class TYPE >

ConstVector SharedObjectsContainer< TYPE >::m_data
| private

Definition at line 340 of file SharedObjectsContainer.h.

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

- GaudiKernel/GaudiKernel/SharedObjectsContainer.h