gaps-online-software 0.10
online software for the TOF system for the GAPS experiment
Loading...
Searching...
No Matches
caraspace.hpp
1#ifndef CARASPACE_H_INCLUDED
2#define CARASPACE_H_INCLUDED
3#include <iostream>
4#include <fstream>
5
6#include "tof_typedefs.h"
7
8namespace Gaps {
9
10 enum class CRFrameObjectType : u8 {
11 Unknown = 0,
12 TofPacket = 10,
13 TelemetryPacket = 20,
14 };
15
17 };
18
19
20 struct CRFrame {
21 static const u16 HEAD = 0xAAAA;
22 static const u16 TAIL = 0x5555;
23
24 CRFrame();
25 //std::map<std::string, usize> get_index
26 static CRFrame from_bytestream(Vec<u8> stream, usize &pos);
27
28 std::map<std::string, std::tuple<u64, CRFrameObjectType>> index;
29 Vec<u8> bytestorage;
30 std::string to_string() const;
31 private:
32 static std::map<std::string, std::tuple<u64, CRFrameObjectType>> parse_index(Vec<u8> stream, usize &pos);
33
34 //pub fn get<T : CRSerializeable + Frameable>(&self, name : String) -> Result<T, CRSerializationError> {
35
36 };
37
38 struct CRReader {
39 CRReader();
40 CRReader(std::string filename);
41 CRReader(const CRReader&) = delete;
45 void set_filename(std:: string);
46 CRFrame get_next_frame();
47 std::string get_filename() const;
52 bool is_exhausted() const;
55 bool n_packets_read() const;
56 private:
57 bool exhausted_;
58 usize n_packets_read_;
59 std::string filename_;
60 std::ifstream stream_file_;
61 };
62}
63#endif
‍**
Definition caraspace.hpp:8
Definition caraspace.hpp:16
Definition caraspace.hpp:20
Definition caraspace.hpp:38
bool is_exhausted() const
void set_filename(std::string)
bool n_packets_read() const
Definition tof_packet.h:81