-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathCollectionData.h.jinja2
More file actions
105 lines (81 loc) · 3.29 KB
/
Copy pathCollectionData.h.jinja2
File metadata and controls
105 lines (81 loc) · 3.29 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
{% import "macros/utils.jinja2" as utils %}
// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
#ifndef {{ package_name.upper() }}_{{ class.bare_type }}_CollectionData_H
#define {{ package_name.upper() }}_{{ class.bare_type }}_CollectionData_H
// datamodel specific includes
#include "{{ incfolder }}{{ class.bare_type }}Data.h"
#include "{{ incfolder }}{{ class.bare_type }}Obj.h"
{% for include in includes_coll_data %}
{{ include }}
{% endfor %}
// podio specific includes
#include "podio/CollectionBuffers.h"
#include "podio/ICollectionProvider.h"
#include <deque>
#include <memory>
// include pmr
#include <memory_resource>
{{ utils.namespace_open(class.namespace) }}
using {{ class.bare_type }}ObjPointerContainer = std::deque<{{ class.bare_type }}Obj*>;
using {{ class.bare_type }}DataContainer = std::pmr::vector<{{ class.bare_type }}Data>;
/**
* Class encapsulating everything related to storage of data that is needed by a
* collection.
*/
{% with class_type = class.bare_type + 'CollectionData' %}
class {{ class.bare_type }}CollectionData {
public:
/**
* The Objs of this collection
*/
{{ class.bare_type }}ObjPointerContainer entries{};
/**
* Default constructor setting up the necessary buffers
*/
{{ class_type }}();
/**
* Constructor from existing I/O buffers
*/
{{ class_type }}(podio::CollectionReadBuffers buffers, bool isSubsetColl);
/**
* Non copy-able, move-only class
*/
{{ class_type }}(const {{ class_type }}&) = delete;
{{ class_type }}& operator=(const {{ class_type }}&) = delete;
{{ class_type }}({{ class_type }}&& other) = default;
{{ class_type }}& operator=({{ class_type }}&& other) = default;
/**
* Deconstructor
*/
~{{ class_type }}() = default;
void clear(bool isSubsetColl);
podio::CollectionWriteBuffers getCollectionBuffers(bool isSubsetColl);
void prepareForWrite(bool isSubsetColl);
void prepareAfterRead(int collectionID);
void makeSubsetCollection();
{% if OneToManyRelations or VectorMembers %}
void createRelations({{ class.bare_type }}Obj* obj);
{% endif %}
bool setReferences(const podio::ICollectionProvider* collectionProvider, bool isSubsetColl);
private:
// members to handle 1-to-N-relations
{% for relation in OneToManyRelations %}
podio::UVecPtr<{{ relation.namespace }}::{{ relation.bare_type }}> m_rel_{{ relation.name }}; ///< Relation buffer for read / write
std::vector<podio::UVecPtr<{{ relation.namespace }}::{{ relation.bare_type }}>> m_rel_{{ relation.name }}_tmp{}; ///< Relation buffer for internal book-keeping
{% endfor %}
{% for relation in OneToOneRelations %}
podio::UVecPtr<{{ relation.namespace }}::{{ relation.bare_type }}> m_rel_{{ relation.name }}{nullptr}; ///< Relation buffer for read / write
{% endfor %}
// members to handle vector members
{% for member in VectorMembers %}
podio::UVecPtr<{{ member.full_type }}> m_vec_{{ member.name }}{nullptr}; /// combined vector of all objects in collection
std::vector<podio::UVecPtr<{{ member.full_type }}>> m_vecs_{{ member.name }}{}; /// pointers to individual member vectors
{% endfor %}
// I/O related buffers
podio::CollRefCollection m_refCollections{};
podio::VectorMembersInfo m_vecmem_info{};
std::unique_ptr<{{ class.bare_type }}DataContainer> m_data{nullptr};
};
{% endwith %}
{{ utils.namespace_close(class.namespace) }}
#endif