forked from AIDASoft/podio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExampleWithVectorMemberConst.h
81 lines (55 loc) · 2.09 KB
/
ExampleWithVectorMemberConst.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
#ifndef ConstExampleWithVectorMember_H
#define ConstExampleWithVectorMember_H
#include "ExampleWithVectorMemberData.h"
#include <vector>
#include <vector>
#include "podio/ObjectID.h"
//forward declarations
#include "ExampleWithVectorMemberObj.h"
class ExampleWithVectorMemberObj;
class ExampleWithVectorMember;
class ExampleWithVectorMemberCollection;
class ExampleWithVectorMemberCollectionIterator;
/** @class ConstExampleWithVectorMember
* Type with a vector member
* @author: B. Hegner
*/
class ConstExampleWithVectorMember {
friend ExampleWithVectorMember;
friend ExampleWithVectorMemberCollection;
friend ExampleWithVectorMemberCollectionIterator;
public:
/// default constructor
ConstExampleWithVectorMember();
/// constructor from existing ExampleWithVectorMemberObj
ConstExampleWithVectorMember(ExampleWithVectorMemberObj* obj);
/// copy constructor
ConstExampleWithVectorMember(const ConstExampleWithVectorMember& other);
/// copy-assignment operator
ConstExampleWithVectorMember& operator=(const ConstExampleWithVectorMember& other);
/// support cloning (deep-copy)
ConstExampleWithVectorMember clone() const;
/// destructor
~ConstExampleWithVectorMember();
public:
unsigned int count_size() const;
int count(unsigned int) const;
std::vector<int>::const_iterator count_begin() const;
std::vector<int>::const_iterator count_end() const;
/// check whether the object is actually available
bool isAvailable() const;
/// disconnect from ExampleWithVectorMemberObj instance
void unlink(){m_obj = nullptr;}
bool operator==(const ConstExampleWithVectorMember& other) const {
return (m_obj==other.m_obj);
}
bool operator==(const ExampleWithVectorMember& other) const;
// less comparison operator, so that objects can be e.g. stored in sets.
// friend bool operator< (const ExampleWithVectorMember& p1,
// const ExampleWithVectorMember& p2 );
bool operator<(const ConstExampleWithVectorMember& other) const { return m_obj < other.m_obj ; }
const podio::ObjectID getObjectID() const;
private:
ExampleWithVectorMemberObj* m_obj;
};
#endif