GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TParserLibrary.h
Go to the documentation of this file.
1#ifndef TPARSERLIBRARY_H
2#define TPARSERLIBRARY_H
3
4#include <string>
5
6#include "TSingleton.h"
7#include "TRawFile.h"
8#include "TDataParser.h"
9
10class TParserLibrary : public TSingleton<TParserLibrary> {
11public:
12 friend class TSingleton<TParserLibrary>;
13
15
16 void Load(); ///< if necessary loads shared object library and sets/initializes all other functions
17
18 TRawFile* CreateRawFile(const std::string& file)
19 {
20 /// function to open library specific raw data file
21 Load();
22 return fCreateRawFile(file);
23 }
25 {
26 /// function to destroy library specific raw data file
27 Load();
28 fDestroyRawFile(file);
29 }
30
32 {
33 /// function to open library specific data parser
34 Load();
35 return fCreateDataParser();
36 }
38 {
39 /// function to destroy library specific data parser
40 Load();
41 fDestroyDataParser(parser);
42 }
43
44 std::string LibraryVersion()
45 {
46 /// returns version of shared object library loaded
47 Load();
48 return fLibraryVersion();
49 }
50
51private:
52 TParserLibrary() = default;
53 TParserLibrary(const TParserLibrary&) = default;
54 TParserLibrary(TParserLibrary&&) noexcept = default;
55 TParserLibrary& operator=(const TParserLibrary&) = default;
56 TParserLibrary& operator=(TParserLibrary&&) noexcept = default;
57
58 void* fHandle{nullptr}; ///< handle for shared object library
59
60 void (*fInitLibrary)();
61 std::string (*fLibraryVersion)();
62
63 TRawFile* (*fCreateRawFile)(const std::string&);
65
66 TDataParser* (*fCreateDataParser)();
68
69 /// \cond CLASSIMP
70 ClassDefOverride(TParserLibrary, 1) // NOLINT(readability-else-after-return)
71 /// \endcond
72};
73
74#endif
void DestroyDataParser(TDataParser *parser)
TDataParser *(* fCreateDataParser)()
std::string(* fLibraryVersion)()
void(* fInitLibrary)()
void(* fDestroyRawFile)(TRawFile *)
TParserLibrary(TParserLibrary &&) noexcept=default
void Load()
if necessary loads shared object library and sets/initializes all other functions
TParserLibrary(const TParserLibrary &)=default
void(* fDestroyDataParser)(TDataParser *)
TRawFile *(* fCreateRawFile)(const std::string &)
void DestroyRawFile(TRawFile *file)
void * fHandle
handle for shared object library
TRawFile * CreateRawFile(const std::string &file)
TDataParser * CreateDataParser()
std::string LibraryVersion()
TParserLibrary()=default
Reader for raw files.
Definition TRawFile.h:31