Project
Loading...
Searching...
No Matches
InputDocument.h
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
#ifndef O2_MCH_MAPPING_TEST_INPUT_DOCUMENT_H
13
#define O2_MCH_MAPPING_TEST_INPUT_DOCUMENT_H
14
15
#include <rapidjson/document.h>
16
#include <cstdio>
17
#include <rapidjson/filereadstream.h>
18
19
template
<
typename
StreamType>
20
class
InputDocument
21
{
22
public
:
23
InputDocument
(
const
char
*
filename
)
24
: mFile(fopen(
filename
,
"r"
)),
25
mReadBuffer(new
char
[65536]),
26
mStream(mFile, mReadBuffer, sizeof(mReadBuffer)),
27
mDocument()
28
{
29
mDocument.ParseStream(mStream);
30
}
31
32
rapidjson::Document&
document
() {
return
mDocument; }
33
34
virtual
~InputDocument
()
35
{
36
delete
[] mReadBuffer;
37
fclose(mFile);
38
}
39
40
private
:
41
FILE* mFile;
42
char
* mReadBuffer;
43
StreamType mStream;
44
rapidjson::Document mDocument;
45
};
46
47
using
InputWrapper
=
InputDocument<rapidjson::FileReadStream>
;
48
49
#endif
InputDocument
Definition
InputDocument.h:21
InputDocument::InputDocument
InputDocument(const char *filename)
Definition
InputDocument.h:23
InputDocument::~InputDocument
virtual ~InputDocument()
Definition
InputDocument.h:34
InputDocument::document
rapidjson::Document & document()
Definition
InputDocument.h:32
char
filename
std::string filename()
Definition
o2FairMQHeaderSizeTest.cxx:55
Detectors
MUON
MCH
Mapping
test
src
InputDocument.h
Generated on Tue Feb 25 2025 17:03:05 for Project by
1.9.8