BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event::RelTable< T1, T2 > Class Template Reference

#include <RelTable.h>

Public Member Functions

 RelTable ()
 RelTable (ObjectList< Relation< T1, T2 > > *rels)
void init ()
 Initialize the internal pointer to an ObjectList of relations.
void addDupRel (Relation< T1, T2 > *rel)
bool addRelation (Relation< T1, T2 > *rel)
std::vector< Relation< T1, T2 > * > getRelByFirst (const T1 *pobj) const
std::vector< Relation< T1, T2 > * > getRelBySecond (const T2 *pobj) const
void erase (Relation< T1, T2 > *rel)
void changeFirst (Relation< T1, T2 > *rel, T1 *pobj)
void changeSecond (Relation< T1, T2 > *rel, T2 *pobj)
unsigned long size () const
 This method returns the number of relations in the table.
ObjectList< Relation< T1, T2 > > * getAllRelations () const
 Returns the pointer to the collection of relations.
 RelTable ()
 RelTable (ObjectList< Relation< T1, T2 > > *rels)
void init ()
 Initialize the internal pointer to an ObjectList of relations.
void addDupRel (Relation< T1, T2 > *rel)
bool addRelation (Relation< T1, T2 > *rel)
std::vector< Relation< T1, T2 > * > getRelByFirst (const T1 *pobj) const
std::vector< Relation< T1, T2 > * > getRelBySecond (const T2 *pobj) const
void erase (Relation< T1, T2 > *rel)
void changeFirst (Relation< T1, T2 > *rel, T1 *pobj)
void changeSecond (Relation< T1, T2 > *rel, T2 *pobj)
unsigned long size () const
 This method returns the number of relations in the table.
ObjectList< Relation< T1, T2 > > * getAllRelations () const
 Returns the pointer to the collection of relations.
 RelTable ()
 RelTable (ObjectList< Relation< T1, T2 > > *rels)
void init ()
 Initialize the internal pointer to an ObjectList of relations.
void addDupRel (Relation< T1, T2 > *rel)
bool addRelation (Relation< T1, T2 > *rel)
std::vector< Relation< T1, T2 > * > getRelByFirst (const T1 *pobj) const
std::vector< Relation< T1, T2 > * > getRelBySecond (const T2 *pobj) const
void erase (Relation< T1, T2 > *rel)
void changeFirst (Relation< T1, T2 > *rel, T1 *pobj)
void changeSecond (Relation< T1, T2 > *rel, T2 *pobj)
unsigned long size () const
 This method returns the number of relations in the table.
ObjectList< Relation< T1, T2 > > * getAllRelations () const
 Returns the pointer to the collection of relations.

Detailed Description

template<class T1, class T2>
class Event::RelTable< T1, T2 >

Definition at line 26 of file InstallArea/x86_64-el9-gcc13-opt/include/RelTable/RelTable.h.

Constructor & Destructor Documentation

◆ RelTable() [1/6]

template<class T1, class T2>
Event::RelTable< T1, T2 >::RelTable ( )
inline

Definition at line 29 of file Event/RelTable/include/RelTable/RelTable.h.

29{}

◆ RelTable() [2/6]

template<class T1, class T2>
RelTable::RelTable ( ObjectList< Relation< T1, T2 > > * rels)
inline

◆ RelTable() [3/6]

template<class T1, class T2>
Event::RelTable< T1, T2 >::RelTable ( )
inline

◆ RelTable() [4/6]

template<class T1, class T2>
Event::RelTable< T1, T2 >::RelTable ( ObjectList< Relation< T1, T2 > > * rels)

◆ RelTable() [5/6]

template<class T1, class T2>
Event::RelTable< T1, T2 >::RelTable ( )
inline

◆ RelTable() [6/6]

template<class T1, class T2>
Event::RelTable< T1, T2 >::RelTable ( ObjectList< Relation< T1, T2 > > * rels)

Member Function Documentation

◆ addDupRel() [1/3]

template<class T1, class T2>
void RelTable::addDupRel ( Relation< T1, T2 > * rel)

The following method add a new Relation to the table, even if there is already a relation with the same two objects (they could have different infos vector)

Definition at line 117 of file Event/RelTable/include/RelTable/RelTable.h.

117 {
118 // Purpose and Method: This routine add a new relation to the collection, even
119 // if there is a already a relation between the same two objects
120 // Inputs: rel is a pointer to the relation to be added.
121
122 bindRelationFirst( rel );
123 bindRelationSecond( rel );
124 m_relations->push_back( rel );
125 }

◆ addDupRel() [2/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::addDupRel ( Relation< T1, T2 > * rel)

The following method add a new Relation to the table, even if there is already a relation with the same two objects (they could have different infos vector)

◆ addDupRel() [3/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::addDupRel ( Relation< T1, T2 > * rel)

The following method add a new Relation to the table, even if there is already a relation with the same two objects (they could have different infos vector)

◆ addRelation() [1/3]

template<class T1, class T2>
bool RelTable::addRelation ( Relation< T1, T2 > * rel)

The following method add a Relation to the table if it doesn't contain a relation between the same two objects, otherwise it appends the info vector to the exsisting relation

Parameters
relis a pointer to a relation between two objects
Returns
true if the relation has been added and false if it is a duplicate and has not been added (in this case the user has to delete it)

Definition at line 127 of file Event/RelTable/include/RelTable/RelTable.h.

127 {
128 // Purpose and Method: This routine add a relation to the table if it doesn't
129 // contain a relation between the same two objects, otherwise it appends the info
130 // vector to the exsisting relation
131 // Inputs: rel is a pointer to the relation to be added.
132 // Outputs: a boolean value which is true if the realtion has been added to the
133 // table and false it it is a duplicate and thus has not been added.
134 // In the latter case the user has to delete the relation
135
136 if ( bindRelationNoDup( rel ) )
137 {
138 bindRelationSecond( rel );
139 m_relations->push_back( rel );
140 return true;
141 }
142 return false;
143 }

Referenced by changeFirst(), changeSecond(), MucRecTrkExt::execute(), and main().

◆ addRelation() [2/3]

template<class T1, class T2>
bool Event::RelTable< T1, T2 >::addRelation ( Relation< T1, T2 > * rel)

The following method add a Relation to the table if it doesn't contain a relation between the same two objects, otherwise it appends the info vector to the exsisting relation

Parameters
relis a pointer to a relation between two objects
Returns
true if the relation has been added and false if it is a duplicate and has not been added (in this case the user has to delete it)

◆ addRelation() [3/3]

template<class T1, class T2>
bool Event::RelTable< T1, T2 >::addRelation ( Relation< T1, T2 > * rel)

The following method add a Relation to the table if it doesn't contain a relation between the same two objects, otherwise it appends the info vector to the exsisting relation

Parameters
relis a pointer to a relation between two objects
Returns
true if the relation has been added and false if it is a duplicate and has not been added (in this case the user has to delete it)

◆ changeFirst() [1/3]

template<class T1, class T2>
void RelTable::changeFirst ( Relation< T1, T2 > * rel,
T1 * pobj )

This method change the first data pointer of a given relation contained into the table.

Parameters
relit's a pointer to the relation to be modified
pobjis the new data value provided by the user

Definition at line 203 of file Event/RelTable/include/RelTable/RelTable.h.

203 {
204 // Purpose: This method change the first data pointer of a relation with the
205 // one given by the user
206
207 removeFirst( rel );
208 removeSecond( rel );
209 m_relations->remove( rel );
210 rel->setFirst( pobj );
211 addRelation( rel );
212 }
bool addRelation(Relation< T1, T2 > *rel)

Referenced by main().

◆ changeFirst() [2/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::changeFirst ( Relation< T1, T2 > * rel,
T1 * pobj )

This method change the first data pointer of a given relation contained into the table.

Parameters
relit's a pointer to the relation to be modified
pobjis the new data value provided by the user

◆ changeFirst() [3/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::changeFirst ( Relation< T1, T2 > * rel,
T1 * pobj )

This method change the first data pointer of a given relation contained into the table.

Parameters
relit's a pointer to the relation to be modified
pobjis the new data value provided by the user

◆ changeSecond() [1/3]

template<class T1, class T2>
void RelTable::changeSecond ( Relation< T1, T2 > * rel,
T2 * pobj )

This method change the second data pointer of a given relation contained into the table.

Parameters
relit's a pointer to the relation to be modified
pobjis the new data value provided by the user

Definition at line 215 of file Event/RelTable/include/RelTable/RelTable.h.

215 {
216 // Purpose: This method change the second data pointer of a relation with the
217 // one given by the user
218
219 removeFirst( rel );
220 removeSecond( rel );
221 m_relations->remove( rel );
222 rel->setSecond( pobj );
223 addRelation( rel );
224 }

Referenced by main().

◆ changeSecond() [2/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::changeSecond ( Relation< T1, T2 > * rel,
T2 * pobj )

This method change the second data pointer of a given relation contained into the table.

Parameters
relit's a pointer to the relation to be modified
pobjis the new data value provided by the user

◆ changeSecond() [3/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::changeSecond ( Relation< T1, T2 > * rel,
T2 * pobj )

This method change the second data pointer of a given relation contained into the table.

Parameters
relit's a pointer to the relation to be modified
pobjis the new data value provided by the user

◆ erase() [1/3]

template<class T1, class T2>
void RelTable::erase ( Relation< T1, T2 > * rel)

This method erase a particular relation from the table (keeping the integrity).

Parameters
relit's a pointer to the relation to be erased

Definition at line 192 of file Event/RelTable/include/RelTable/RelTable.h.

192 {
193 // Purpose: This method remove the given relation from the table
194
195 removeFirst( rel );
196 removeSecond( rel );
197
198 m_relations->remove( rel );
199 delete rel;
200 }

Referenced by main().

◆ erase() [2/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::erase ( Relation< T1, T2 > * rel)

This method erase a particular relation from the table (keeping the integrity).

Parameters
relit's a pointer to the relation to be erased

◆ erase() [3/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::erase ( Relation< T1, T2 > * rel)

This method erase a particular relation from the table (keeping the integrity).

Parameters
relit's a pointer to the relation to be erased

◆ getAllRelations() [1/3]

template<class T1, class T2>
ObjectList< Relation< T1, T2 > > * RelTable::getAllRelations ( ) const
inline

Returns the pointer to the collection of relations.

Definition at line 233 of file Event/RelTable/include/RelTable/RelTable.h.

233 {
234
235 return m_relations;
236 }

◆ getAllRelations() [2/3]

template<class T1, class T2>
ObjectList< Relation< T1, T2 > > * Event::RelTable< T1, T2 >::getAllRelations ( ) const

Returns the pointer to the collection of relations.

◆ getAllRelations() [3/3]

template<class T1, class T2>
ObjectList< Relation< T1, T2 > > * Event::RelTable< T1, T2 >::getAllRelations ( ) const

Returns the pointer to the collection of relations.

◆ getRelByFirst() [1/3]

template<class T1, class T2>
std::vector< Relation< T1, T2 > * > RelTable::getRelByFirst ( const T1 * pobj) const

This method search for all relations having obj in the first field.

Parameters
objit's a pointer to the object given by the user
Returns
A vector of pointers to the relations involving the given object.

Definition at line 146 of file Event/RelTable/include/RelTable/RelTable.h.

146 {
147 // Purpose and Method: This routine finds all relations having pobj in the
148 // first field.
149 // Inputs: pobj is a pointer to the object to be searched in the first field
150 // Outputs: A pointer to a vector of Relation* including pobj
151
153 if ( !m_relations->size() ) return rels;
154 SmartRef<Relation<T1, T2>> r = m_relations->front();
155 while ( pobj != r->getFirst() && r->m_first.getFirst() ) { r = r->m_first.getFirst(); }
156
157 if ( pobj == r->getFirst() )
158 {
159 rels.push_back( r );
160 while ( r->m_first.getSame() )
161 {
162 rels.push_back( r->m_first.getSame() );
163 r = r->m_first.getSame();
164 }
165 }
166 return rels;
167 }

Referenced by MucRecTrkExt::execute(), and main().

◆ getRelByFirst() [2/3]

template<class T1, class T2>
std::vector< Relation< T1, T2 > * > Event::RelTable< T1, T2 >::getRelByFirst ( const T1 * pobj) const

This method search for all relations having obj in the first field.

Parameters
objit's a pointer to the object given by the user
Returns
A vector of pointers to the relations involving the given object.

◆ getRelByFirst() [3/3]

template<class T1, class T2>
std::vector< Relation< T1, T2 > * > Event::RelTable< T1, T2 >::getRelByFirst ( const T1 * pobj) const

This method search for all relations having obj in the first field.

Parameters
objit's a pointer to the object given by the user
Returns
A vector of pointers to the relations involving the given object.

◆ getRelBySecond() [1/3]

template<class T1, class T2>
std::vector< Relation< T1, T2 > * > RelTable::getRelBySecond ( const T2 * pobj) const

This method search for all relations having pobj in the second field.

Parameters
pobjit's a pointer to the object given by the user
Returns
A vector of pointers to the relations involving the given object.

Definition at line 170 of file Event/RelTable/include/RelTable/RelTable.h.

170 {
171 // Purpose and Method: This routine finds all relations having pobj in the
172 // second field.
173 // Inputs: pobj is a pointer to the object to be searched in the second field
174 // Outputs: A pointer to a vector of Relation* including pobj
176 if ( !m_relations->size() ) return rels;
177 SmartRef<Relation<T1, T2>> r = m_relations->front();
178 while ( pobj != r->getSecond() && r->m_second.getFirst() ) { r = r->m_second.getFirst(); }
179
180 if ( pobj == r->getSecond() )
181 {
182 rels.push_back( r );
183 while ( r->m_second.getSame() )
184 {
185 rels.push_back( r->m_second.getSame() );
186 r = r->m_second.getSame();
187 }
188 }
189 return rels;
190 }

Referenced by main().

◆ getRelBySecond() [2/3]

template<class T1, class T2>
std::vector< Relation< T1, T2 > * > Event::RelTable< T1, T2 >::getRelBySecond ( const T2 * pobj) const

This method search for all relations having pobj in the second field.

Parameters
pobjit's a pointer to the object given by the user
Returns
A vector of pointers to the relations involving the given object.

◆ getRelBySecond() [3/3]

template<class T1, class T2>
std::vector< Relation< T1, T2 > * > Event::RelTable< T1, T2 >::getRelBySecond ( const T2 * pobj) const

This method search for all relations having pobj in the second field.

Parameters
pobjit's a pointer to the object given by the user
Returns
A vector of pointers to the relations involving the given object.

◆ init() [1/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::init ( )
inline

Initialize the internal pointer to an ObjectList of relations.

Definition at line 33 of file Event/RelTable/include/RelTable/RelTable.h.

33{ m_relations = new ObjectList<Relation<T1, T2>>; }

Referenced by MucRecTrkExt::execute(), and main().

◆ init() [2/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::init ( )
inline

Initialize the internal pointer to an ObjectList of relations.

Definition at line 33 of file InstallArea/x86_64-el9-gcc13-dbg/include/RelTable/RelTable.h.

33{ m_relations = new ObjectList<Relation<T1, T2>>; }

◆ init() [3/3]

template<class T1, class T2>
void Event::RelTable< T1, T2 >::init ( )
inline

Initialize the internal pointer to an ObjectList of relations.

Definition at line 33 of file InstallArea/x86_64-el9-gcc13-opt/include/RelTable/RelTable.h.

33{ m_relations = new ObjectList<Relation<T1, T2>>; }

◆ size() [1/3]

template<class T1, class T2>
unsigned long RelTable::size ( ) const
inline

This method returns the number of relations in the table.

Definition at line 226 of file Event/RelTable/include/RelTable/RelTable.h.

226 {
227 // Purpose: This method returns the total number of relations contained in the
228 // collection
229 return m_relations->size();
230 }

Referenced by MucRecTrkExt::execute(), and main().

◆ size() [2/3]

template<class T1, class T2>
unsigned long Event::RelTable< T1, T2 >::size ( ) const

This method returns the number of relations in the table.

◆ size() [3/3]

template<class T1, class T2>
unsigned long Event::RelTable< T1, T2 >::size ( ) const

This method returns the number of relations in the table.


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