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