CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
RelKey.h
Go to the documentation of this file.
1
2#ifndef RELKEY_H
3#define RELKEY_H
4
5
6#include "GaudiKernel/SmartRef.h"
7#include <iostream>
8
9/**
10 * @class RelKey
11 *
12 * @brief This class is used to relate events data.
13 *
14 * The RelKey class is used by the Relation class to relate events data. It
15 * contains four pointers: one points to a particular event data, another
16 * points to the next relation containing the same data pointer, one another
17 * points to the previous relation and the fourth one points to the first
18 * relation not containing the same data pointer. This information is useful
19 * to efficiently search for all relations involving a particular event data
20 * or to remove a relation.
21 *
22 */
23
24
25namespace Event {
26
27template <class T1, class T2>
28class Relation;
29
30template <class T1, class T2, class T3>
31class RelKey {
32
33public:
34
35 RelKey() {}
36 RelKey(T1* obj): m_data(obj) {}
37
39
40 void setData(T1* obj) {m_data = obj;}
41 const T1* getData() const { return m_data;}
42 T1* getData() {return m_data;}
43
44 void setPrev(Relation<T2,T3>* rel) {m_prev = rel;}
45 Relation<T2,T3>* getPrev() {return m_prev;}
46
47 void setSame(Relation<T2,T3>* rel) {m_same = rel;}
48 Relation<T2,T3>* getSame() {return m_same;}
49
50 void setFirst(Relation<T2,T3>* rel) {m_first = rel;}
51 Relation<T2,T3>* getFirst() {return m_first;}
52
53 /// Fill the ASCII output stream
54 void toStream(std::ostream& s) const;
55
56private:
57
58 /// Pointer to the object to be related
59 SmartRef<T1> m_data;
60 /// Pointer to the previous relation
61 SmartRef< Relation<T2,T3> > m_prev;
62 /// Pointer to the next relation containing m_data
63 SmartRef< Relation<T2,T3> > m_same;
64 /// Pointer to the first relation which not contains m_data
65 SmartRef< Relation<T2,T3> > m_first;
66
67};
68
69
70template <class T1, class T2, class T3>
71inline void RelKey<T1,T2,T3>::toStream(std::ostream& s) const
72{
73 /// Fill the ASCII output stream
74 s << "\n Data = " << m_data
75 << "\n Previous Relation = " << m_prev
76 << "\n Next Relation = " << m_same
77 << "\n First Different Data = " << m_first;
78}
79
80}
81
82#endif // RELKEY_H
XmlRpcServer s
Definition: HelloServer.cpp:11
Relation< T2, T3 > * getSame()
Definition: RelKey.h:48
void toStream(std::ostream &s) const
Fill the ASCII output stream.
Definition: RelKey.h:71
Relation< T2, T3 > * getPrev()
Definition: RelKey.h:45
Relation< T2, T3 > * getFirst()
Definition: RelKey.h:51
T1 * getData()
Definition: RelKey.h:42
void setSame(Relation< T2, T3 > *rel)
Definition: RelKey.h:47
const T1 * getData() const
Definition: RelKey.h:41
RelKey(T1 *obj)
Definition: RelKey.h:36
void setPrev(Relation< T2, T3 > *rel)
Definition: RelKey.h:44
void setData(T1 *obj)
Definition: RelKey.h:40
void setFirst(Relation< T2, T3 > *rel)
Definition: RelKey.h:50
This class is used to relate pair of objets.
Definition: Event.h:21