HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
Loading...
Searching...
No Matches
recordbuilder.h
Go to the documentation of this file.
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: recordbuilder.h
9 * Author: gavalian
10 *
11 * Created on April 11, 2017, 4:47 PM
12 */
13
14#ifndef HIPORECORDBUILDER_H
15#define HIPORECORDBUILDER_H
16
17#include <iostream>
18#include <vector>
19#include <string>
20#include <stdint.h>
21#include <stdio.h>
22#include <stdlib.h>
23#include <fstream>
24
25#include "event.h"
26#include "utils.h"
27
28namespace hipo {
29
31
32 private:
33 const int defaultNumberOfEvents = 100000;
34 const int defaultRecordSize = 8*1024*1024;
35 //std::vector< std::vector<char> > eventBuffer;
36 std::vector<char> bufferIndex;
37 std::vector<char> bufferEvents;
38 std::vector<char> bufferData;
39 std::vector<char> bufferRecord;
40
41 int bufferIndexEntries;
42 int bufferEventsPosition;
43 long bufferUserWordOne = 0;
44 long bufferUserWordTwo = 0;
45
46 int compressRecord(int src_size);
47 int getRecordLengthRounding(int bufferSize);
48
49 public:
50
51 recordbuilder(int maxEvents, int maxLength);
53 virtual ~recordbuilder(){};
54
55 bool addEvent(std::vector<char> &vec, int start, int length);
56 bool addEvent(hipo::event &evnt);
57
58 long getUserWordOne();
59 long getUserWordTwo();
60 void setUserWordOne(long userWordOne);
61 void setUserWordTwo(long userWordTwo);
62
63 int getRecordSize();
64 int getEntries();
65 std::vector<char> &getRecordBuffer(){ return bufferRecord;};
66 void reset();
67 void build();
68 };
69}
70#endif /* HIPORECORD_H */
Definition event.h:62
Definition recordbuilder.h:30
void build()
Definition recordbuilder.cpp:113
void setUserWordOne(long userWordOne)
Definition recordbuilder.cpp:105
virtual ~recordbuilder()
Definition recordbuilder.h:53
int getRecordSize()
returns the size of the record.
Definition recordbuilder.cpp:90
recordbuilder()
Default constructor sets number of max events to 100000 and the buffer size to 8MB.
Definition recordbuilder.cpp:20
void reset()
Resets the counters for number of events and sets the position for writing new events to the begining...
Definition recordbuilder.cpp:66
long getUserWordTwo()
Definition recordbuilder.cpp:100
std::vector< char > & getRecordBuffer()
Definition recordbuilder.h:65
void setUserWordTwo(long userWordTwo)
Definition recordbuilder.cpp:109
long getUserWordOne()
Definition recordbuilder.cpp:95
bool addEvent(std::vector< char > &vec, int start, int length)
add a content of a vector to the record builder buffer.
Definition recordbuilder.cpp:52
int getEntries()
Returns number of events in the record.
Definition recordbuilder.cpp:83
HIPO namespace is used for the classes that read/write files and records.
Definition bank.cpp:45