CGEM BOSS 6.6.5.f
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.
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ RelTable() [1/4]

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

Definition at line 33 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

33{}

◆ RelTable() [2/4]

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

Definition at line 124 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

124 {
125
126 m_relations = rels;
127
128 }

◆ RelTable() [3/4]

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

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

33{}

◆ RelTable() [4/4]

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

Member Function Documentation

◆ addDupRel() [1/2]

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 131 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

131 {
132 // Purpose and Method: This routine add a new relation to the collection, even
133 // if there is a already a relation between the same two objects
134 // Inputs: rel is a pointer to the relation to be added.
135
136 bindRelationFirst(rel);
137 bindRelationSecond(rel);
138 m_relations->push_back(rel);
139 }

◆ addDupRel() [2/2]

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/2]

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 143 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

143 {
144 // Purpose and Method: This routine add a relation to the table if it doesn't
145 // contain a relation between the same two objects, otherwise it appends the info
146 // vector to the exsisting relation
147 // Inputs: rel is a pointer to the relation to be added.
148 // Outputs: a boolean value which is true if the realtion has been added to the
149 // table and false it it is a duplicate and thus has not been added.
150 // In the latter case the user has to delete the relation
151
152 if (bindRelationNoDup(rel))
153 {
154 bindRelationSecond(rel);
155 m_relations->push_back(rel);
156 return true;
157 }
158 return false;
159 }

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

◆ addRelation() [2/2]

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/2]

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 230 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

230 {
231 // Purpose: This method change the first data pointer of a relation with the
232 // one given by the user
233
234 removeFirst(rel);
235 removeSecond(rel);
236 m_relations->remove(rel);
237 rel->setFirst(pobj);
238 addRelation(rel);
239 }

Referenced by main().

◆ changeFirst() [2/2]

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/2]

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 243 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

243 {
244 // Purpose: This method change the second data pointer of a relation with the
245 // one given by the user
246
247 removeFirst(rel);
248 removeSecond(rel);
249 m_relations->remove(rel);
250 rel->setSecond(pobj);
251 addRelation(rel);
252 }

Referenced by main().

◆ changeSecond() [2/2]

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/2]

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 218 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

218 {
219 // Purpose: This method remove the given relation from the table
220
221 removeFirst(rel);
222 removeSecond(rel);
223
224 m_relations->remove(rel);
225 delete rel;
226 }

Referenced by main().

◆ erase() [2/2]

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/2]

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

Returns the pointer to the collection of relations.

Definition at line 263 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

263 {
264
265 return m_relations;
266
267 }

◆ getAllRelations() [2/2]

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/2]

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 163 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

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

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

◆ getRelByFirst() [2/2]

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/2]

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 191 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

191 {
192 // Purpose and Method: This routine finds all relations having pobj in the
193 // second field.
194 // Inputs: pobj is a pointer to the object to be searched in the second field
195 // Outputs: A pointer to a vector of Relation* including pobj
196 std::vector< Relation<T1,T2>* > rels;
197 if (!m_relations->size()) return rels;
198 SmartRef< Relation<T1,T2> > r = m_relations->front();
199 while (pobj != r->getSecond() && r->m_second.getFirst())
200 {
201 r = r->m_second.getFirst();
202 }
203
204 if (pobj == r->getSecond())
205 {
206 rels.push_back(r);
207 while (r->m_second.getSame())
208 {
209 rels.push_back(r->m_second.getSame());
210 r = r->m_second.getSame();
211 }
212 }
213 return rels;
214 }

Referenced by main().

◆ getRelBySecond() [2/2]

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/2]

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

Initialize the internal pointer to an ObjectList of relations.

Definition at line 38 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

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

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

◆ init() [2/2]

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

Initialize the internal pointer to an ObjectList of relations.

Definition at line 38 of file InstallArea/include/RelTable/RelTable/RelTable.h.

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

◆ size() [1/2]

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

This method returns the number of relations in the table.

Definition at line 256 of file Event/RelTable/RelTable-00-00-02/RelTable/RelTable.h.

256 {
257 // Purpose: This method returns the total number of relations contained in the
258 // collection
259 return m_relations->size();
260 }

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

◆ size() [2/2]

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: