Belle II Software light-2406-ragdoll
RelationIndexContainer< FROM, TO > Class Template Reference

Class to store a bidirectional index between two StoreArrays. More...

#include <RelationIndexContainer.h>

Inheritance diagram for RelationIndexContainer< FROM, TO >:
Collaboration diagram for RelationIndexContainer< FROM, TO >:

Classes

struct  Element
 Element type for the index. More...
 

Public Types

typedef boost::multi_index::multi_index_container< Element, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::member< Element, const FROM *, &Element::from > >, boost::multi_index::ordered_non_unique< boost::multi_index::member< Element, const TO *, &Element::to > > > > ElementIndex
 Boost MultiIndex container to keep the bidirectional index.
 

Public Member Functions

 operator bool () const
 Returns true if relation is valid.
 
const ElementIndexindex () const
 Get the index.
 
ElementIndexindex ()
 Get the index.
 
AccessorParams getAccessorParams () const
 Get the AccessorParams of the underlying relation.
 
const AccessorParamsgetFromAccessorParams () const
 Get the AccessorParams of the StoreArray the relation points from.
 
const AccessorParamsgetToAccessorParams () const
 Get the AccessorParams of the StoreArray the relation points to.
 

Protected Member Functions

 RelationIndexContainer (const RelationArray &relArray)
 Constructor to create a new IndexContainer.
 
 RelationIndexContainer (const RelationIndexContainer &)=delete
 Restrict copies.
 
RelationIndexContaineroperator= (const RelationIndexContainer &)=delete
 Restrict copies.
 
void rebuild (bool force=false)
 Rebuild the index.
 
virtual void clear () override
 Clear the index (at the end of an event)
 

Protected Attributes

ElementIndex m_index
 Instance of the index.
 
RelationArray m_storeRel
 the underlying relation.
 
AccessorParams m_storeFrom
 AccessorParams of the StoreArray the relation points from.
 
AccessorParams m_storeTo
 AccessorParams of the StoreArray the relation points to.
 
bool m_valid
 Indicate wether the relation is valid.
 

Friends

class RelationIndexManager
 Allow the RelationIndexManager to create instances.
 

Detailed Description

template<class FROM, class TO>
class Belle2::RelationIndexContainer< FROM, TO >

Class to store a bidirectional index between two StoreArrays.

This class provides a bidirectional access to a given Relation to ease use of Relations for the normal user. There is no support for changing or adding Relations. All instances of this class will be managed and created by the RelationIndexManager.

This class is only used internally, users should use RelationsObject/RelationsInterface to access/add relations.

Definition at line 50 of file RelationIndexContainer.h.

Member Typedef Documentation

◆ ElementIndex

typedef boost::multi_index::multi_index_container< Element, boost::multi_index::indexed_by < boost::multi_index::ordered_non_unique < boost::multi_index::member<Element, const FROM*, &Element::from> >, boost::multi_index::ordered_non_unique < boost::multi_index::member<Element, const TO*, &Element::to> > > > ElementIndex

Boost MultiIndex container to keep the bidirectional index.

All the heavy lifting is done by this class

Definition at line 91 of file RelationIndexContainer.h.

Constructor & Destructor Documentation

◆ RelationIndexContainer()

RelationIndexContainer ( const RelationArray relArray)
inlineexplicitprotected

Constructor to create a new IndexContainer.

Parameters
relArrayRelationArray to build the relation for

Definition at line 115 of file RelationIndexContainer.h.

115 : m_storeRel(relArray), m_valid(false)
116 {
117 rebuild(true);
118 }
RelationArray m_storeRel
the underlying relation.
bool m_valid
Indicate wether the relation is valid.
void rebuild(bool force=false)
Rebuild the index.

Member Function Documentation

◆ clear()

virtual void clear ( )
inlineoverrideprotectedvirtual

Clear the index (at the end of an event)

Implements RelationIndexBase.

Definition at line 134 of file RelationIndexContainer.h.

134{ m_index.clear(); }
ElementIndex m_index
Instance of the index.

◆ getAccessorParams()

AccessorParams getAccessorParams ( ) const
inline

Get the AccessorParams of the underlying relation.

Definition at line 102 of file RelationIndexContainer.h.

102{ return m_storeRel.getAccessorParams(); }
AccessorParams getAccessorParams() const
Return pair of name and durability under which stored object is saved.

◆ getFromAccessorParams()

const AccessorParams & getFromAccessorParams ( ) const
inline

Get the AccessorParams of the StoreArray the relation points from.

Definition at line 105 of file RelationIndexContainer.h.

105{ return m_storeFrom; }
AccessorParams m_storeFrom
AccessorParams of the StoreArray the relation points from.

◆ getToAccessorParams()

const AccessorParams & getToAccessorParams ( ) const
inline

Get the AccessorParams of the StoreArray the relation points to.

Definition at line 108 of file RelationIndexContainer.h.

108{ return m_storeTo; }
AccessorParams m_storeTo
AccessorParams of the StoreArray the relation points to.

◆ index() [1/2]

ElementIndex & index ( )
inline

Get the index.

Definition at line 99 of file RelationIndexContainer.h.

99{ return m_index; }

◆ index() [2/2]

const ElementIndex & index ( ) const
inline

Get the index.

Definition at line 97 of file RelationIndexContainer.h.

97{ return m_index; }

◆ operator bool()

operator bool ( ) const
inline

Returns true if relation is valid.

Definition at line 94 of file RelationIndexContainer.h.

94{ return m_valid; }

Friends And Related Function Documentation

◆ RelationIndexManager

friend class RelationIndexManager
friend

Allow the RelationIndexManager to create instances.

Definition at line 152 of file RelationIndexContainer.h.

Member Data Documentation

◆ m_index

ElementIndex m_index
protected

Instance of the index.

Definition at line 137 of file RelationIndexContainer.h.

◆ m_storeFrom

AccessorParams m_storeFrom
protected

AccessorParams of the StoreArray the relation points from.

Definition at line 143 of file RelationIndexContainer.h.

◆ m_storeRel

RelationArray m_storeRel
protected

the underlying relation.

Definition at line 140 of file RelationIndexContainer.h.

◆ m_storeTo

AccessorParams m_storeTo
protected

AccessorParams of the StoreArray the relation points to.

Definition at line 146 of file RelationIndexContainer.h.

◆ m_valid

bool m_valid
protected

Indicate wether the relation is valid.

Definition at line 149 of file RelationIndexContainer.h.


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