HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1//******************************************************************************
2//* ██╗ ██╗██╗██████╗ ██████╗ ██╗ ██╗ ██████╗ *
3//* ██║ ██║██║██╔══██╗██╔═══██╗ ██║ ██║ ██╔═████╗ *
4//* ███████║██║██████╔╝██║ ██║ ███████║ ██║██╔██║ *
5//* ██╔══██║██║██╔═══╝ ██║ ██║ ╚════██║ ████╔╝██║ *
6//* ██║ ██║██║██║ ╚██████╔╝ ██║██╗╚██████╔╝ *
7//* ╚═╝ ╚═╝╚═╝╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═════╝ *
8//************************ Jefferson National Lab (2017) ***********************
9/*
10 * Copyright (c) 2017. Jefferson Lab (JLab). All rights reserved. Permission
11 * to use, copy, modify, and distribute this software and its documentation
12 * for educational, research, and not-for-profit purposes, without fee and
13 * without a signed licensing agreement.
14 *
15 * IN NO EVENT SHALL JLAB BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL
16 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
17 * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF JLAB HAS
18 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 *
20 * JLAB SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE. THE HIPO DATA FORMAT SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
23 * ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". JLAB HAS NO OBLIGATION TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 *
26 * This software was developed under the United States Government license.
27 * For more information contact author at gavalian@jlab.org
28 * Department of Experimental Nuclear Physics, Jefferson Lab.
29 */
30/*
31 * File: event.h
32 * Author: gavalian
33 *
34 * Created on April 12, 2017, 10:14 AM
35 */
36
37#ifndef HIPO_EVENT_H
38#define HIPO_EVENT_H
39
40#include <iostream>
41#include <vector>
42#include <cstring>
43#include <cstdint>
44#include <cstdio>
45#include <cstdlib>
46#include <map>
47#include "bank.h"
48#include "node.h"
49
50// if the library is compiled with C++11
51// support we will use unordered map which
52// is faster than standard map
53#if __cplusplus > 199711L
54#include <unordered_map>
55#endif
56
57
58namespace hipo {
59
60 //typedef std::auto_ptr<hipo::generic_node> node_pointer;
61
62 class event {
63
64 private:
65 std::vector<char> dataBuffer;
66 public:
67
68 event();
69 event(int size);
70 virtual ~event();
71
72 void show();
73 void init(std::vector<char> &buffer);
74 void init(const char *buffer, int size);
75 void getStructure(hipo::structure &str, int group, int item);
76 void getStructure4(hipo::structure &str, int group, int item);
77
78 int getTag();
79 void setTag(int tag);
80 void getStructure(hipo::bank &b);
81 void read(hipo::bank &b);
83 void override(hipo::structure &str);
84 void remove(hipo::bank &str);
85 void remove(int group, int item);
86 void replace(hipo::bank &bank);
87
88 void add(hipo::node &_n);
89 void get(hipo::node &_n, int group, int item);
90
91 std::pair<int,int> getStructurePosition(int group, int item);
92 std::pair<int,int> getStructurePosition4(int group, int item);
93
94 std::vector<char> &getEventBuffer();
95 int getSize();
96 void reset();
97 void write(hipo::node &node);
98 void read(hipo::node &node, int group, int item);
99
100 //*******************************************************************
101 //** static methods for reading structures from event structure
102 //** from the memory. It does not have to copy event into separate
103 //** buffer.
104 //*******************************************************************
105 static std::pair<int,int>
106 getStructurePosition(const char *buffer, int group, int item);
107 //static std::pair<int,int>
108 // getStructurePosition5(const char *buffer, int group, int item);
109 //static std::pair<int,int> getStructurePosition(const char *buffer, int group, int item);
110 static void
111 getStructure(const char *buffer, hipo::structure &str, int group, int item);
112 static void get(const char *buffer, hipo::node &_n, int group, int item);
113 static void
114 getStructureNoCopy(const char *buffer, hipo::structure &str, int group, int item);
115 };
116}
117
118#endif /* EVENT_H */
Definition bank.h:210
Definition event.h:62
std::vector< char > & getEventBuffer()
Definition event.cpp:325
static void getStructureNoCopy(const char *buffer, hipo::structure &str, int group, int item)
Definition event.cpp:93
event()
Definition event.cpp:43
void write(hipo::node &node)
Definition event.cpp:197
void addStructure(hipo::structure &str)
Definition event.cpp:157
void get(hipo::node &_n, int group, int item)
Definition event.cpp:205
void setTag(int tag)
Definition event.cpp:225
void read(hipo::bank &b)
Definition event.cpp:63
void getStructure(hipo::structure &str, int group, int item)
Definition event.cpp:68
std::pair< int, int > getStructurePosition(int group, int item)
Definition event.cpp:252
void init(std::vector< char > &buffer)
Definition event.cpp:230
void show()
Definition event.cpp:332
void remove(hipo::bank &str)
Definition event.cpp:132
std::pair< int, int > getStructurePosition4(int group, int item)
Definition event.cpp:270
int getSize()
Definition event.cpp:311
int getTag()
Definition event.cpp:219
void reset()
Definition event.cpp:317
void add(hipo::node &_n)
Definition event.cpp:180
virtual ~event()
void replace(hipo::bank &bank)
Definition event.cpp:119
void getStructure4(hipo::structure &str, int group, int item)
Definition event.cpp:80
Definition node.h:51
Definition bank.h:54
HIPO namespace is used for the classes that read/write files and records.
Definition bank.cpp:45