forked from AIDASoft/podio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIOBlock.h.jinja2
49 lines (34 loc) · 1.41 KB
/
SIOBlock.h.jinja2
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
{% import "macros/utils.jinja2" as utils %}
// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
#ifndef {{ package_name.upper() }}_{{ class.bare_type }}SIOBlock_H
#define {{ package_name.upper() }}_{{ class.bare_type }}SIOBlock_H
#include "{{ incfolder }}DatamodelDefinition.h"
#include "podio/SIOBlock.h"
#include <sio/api.h>
#include <sio/io_device.h>
#include <sio/version.h>
#include <typeindex>
#include <string>
namespace podio {
struct CollectionReadBuffers;
}
{{ utils.namespace_open(class.namespace) }}
{% with block_class = class.bare_type + 'SIOBlock' %}
class {{ block_class }}: public podio::SIOBlock {
public:
{{ block_class }}() :
SIOBlock("{{ class.bare_type }}", sio::version::encode_version({{ package_name }}::meta::schemaVersion, 0)) {
podio::SIOBlockFactory::instance().registerBlockForCollection("{{class.full_type}}", this);
}
{{ block_class }}(const std::string& name) :
SIOBlock(name, sio::version::encode_version({{ package_name }}::meta::schemaVersion, 0)) {}
// Read the collection data from the device
void read(sio::read_device& device, sio::version_type version) override;
// Write the collection data to the device
void write(sio::write_device& device) override;
SIOBlock* create(const std::string& name) const override { return new {{ block_class }}(name); }
};
static {{ block_class }} _dummy{{ block_class }};
{% endwith %}
{{ utils.namespace_close(class.namespace) }}
#endif