BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
Microslice.h
Go to the documentation of this file.
1// Copyright 2015 Jan de Cuveland <cmail@cuveland.de>
2/// \file
3/// \brief Defines the fles::Microslice abstract base class.
4#ifndef FLES_MICROSLICE_H
5#define FLES_MICROSLICE_H
6
8
9#include <boost/serialization/access.hpp>
10#include <fstream>
11// Note: <fstream> has to precede boost/serialization includes for non-obvious
12// reasons to avoid segfault similar to
13// http://lists.debian.org/debian-hppa/2009/11/msg00069.html
14
15namespace fles
16{
17
18/**
19 * \brief The Microslice class provides read access to the data of a microslice.
20 *
21 * This class is an abstract base class for all classes providing access to the
22 * descriptor and data contents of a single microslice.
23 */
24class Microslice
25{
26 public:
27 virtual ~Microslice() = 0;
28
29 /// Retrieve microslice descriptor reference
30 const MicrosliceDescriptor& desc() const { return *desc_ptr_; }
31
32 /// Retrieve a pointer to the microslice data
33 const uint8_t* content() const { return content_ptr_; }
34
35 /// Compute CRC-32 checksum of microslice data content
36 uint32_t compute_crc() const;
37
38 /// Compare computed CRC-32 checksum to value in header
39 bool check_crc() const;
40
41 protected:
42 Microslice() = default;
43
44 /// Construct microslice with given content.
45 Microslice(MicrosliceDescriptor* desc_ptr, uint8_t* content_ptr)
46 : desc_ptr_(desc_ptr)
47 , content_ptr_(content_ptr) {};
48
49 friend class StorableMicroslice;
50
51 /// Pointer to the microslice descriptor
53
54 /// Pointer to the microslice data content
55 uint8_t* content_ptr_;
56};
57
58} // namespace fles
59
60#endif // FLES_MICROSLICE_H
The Microslice class provides read access to the data of a microslice.
Definition Microslice.h:25
const MicrosliceDescriptor & desc() const
Retrieve microslice descriptor reference.
Definition Microslice.h:30
Microslice()=default
uint32_t compute_crc() const
Compute CRC-32 checksum of microslice data content.
bool check_crc() const
Compare computed CRC-32 checksum to value in header.
Microslice(MicrosliceDescriptor *desc_ptr, uint8_t *content_ptr)
Construct microslice with given content.
Definition Microslice.h:45
virtual ~Microslice()=0
const uint8_t * content() const
Retrieve a pointer to the microslice data.
Definition Microslice.h:33
uint8_t * content_ptr_
Pointer to the microslice data content.
Definition Microslice.h:55
MicrosliceDescriptor * desc_ptr_
Pointer to the microslice descriptor.
Definition Microslice.h:52
The StorableMicroslice class contains the data of a single microslice.
Defines the fles::MicrosliceDescriptor struct and corresponding enums.
Main FLES namespace.
Microslice descriptor struct.