forked from AIDASoft/podio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExampleWithComponent.h
93 lines (66 loc) · 2.37 KB
/
ExampleWithComponent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef ExampleWithComponent_H
#define ExampleWithComponent_H
#include "NotSoSimpleStruct.h"
#include "ExampleWithComponentData.h"
#include <vector>
#include "podio/ObjectID.h"
//forward declarations
#include "ExampleWithComponentConst.h"
#include "ExampleWithComponentObj.h"
class ExampleWithComponentCollection;
class ExampleWithComponentCollectionIterator;
class ConstExampleWithComponent;
/** @class ExampleWithComponent
* Type with one component
* @author: Benedikt Hegner
*/
class ExampleWithComponent {
friend ExampleWithComponentCollection;
friend ExampleWithComponentCollectionIterator;
friend ConstExampleWithComponent;
public:
/// default constructor
ExampleWithComponent();
ExampleWithComponent(NotSoSimpleStruct component);
/// constructor from existing ExampleWithComponentObj
ExampleWithComponent(ExampleWithComponentObj* obj);
/// copy constructor
ExampleWithComponent(const ExampleWithComponent& other);
/// copy-assignment operator
ExampleWithComponent& operator=(const ExampleWithComponent& other);
/// support cloning (deep-copy)
ExampleWithComponent clone() const;
/// destructor
~ExampleWithComponent();
/// conversion to const object
operator ConstExampleWithComponent () const;
public:
/// Access the a component
const NotSoSimpleStruct& component() const;
/// Access the member of a component
const SimpleStruct& data() const;
/// Get reference to the a component
NotSoSimpleStruct& component();
/// Set the a component
void component(class NotSoSimpleStruct value);
/// Get reference to the member of a component
SimpleStruct& data();
/// Set the member of a component
void data(class SimpleStruct value);
/// check whether the object is actually available
bool isAvailable() const;
/// disconnect from ExampleWithComponentObj instance
void unlink(){m_obj = nullptr;}
bool operator==(const ExampleWithComponent& other) const {
return (m_obj==other.m_obj);
}
bool operator==(const ConstExampleWithComponent& other) const;
// less comparison operator, so that objects can be e.g. stored in sets.
// friend bool operator< (const ExampleWithComponent& p1,
// const ExampleWithComponent& p2 );
bool operator<(const ExampleWithComponent& other) const { return m_obj < other.m_obj ; }
const podio::ObjectID getObjectID() const;
private:
ExampleWithComponentObj* m_obj;
};
#endif