gaps-online-software 0.10
online software for the TOF system for the GAPS experiment
Loading...
Searching...
No Matches
parsers.h
1#ifndef GAPSPARSERS_H_INCLUDED
2#define GAPSPARSERS_H_INCLUDED
3
4#include "tof_typedefs.h"
5
6namespace Gaps {
7
8 template<typename T>
9 Vec<T> slice(const Vec<T>& vec, usize start, usize end) {
10 if (start >= vec.size()) {
11 return Vec<T>(); // Return an empty vector if start is out of range
12 }
13 end = std::min(end, vec.size()); // Clamp the end index to the vector size
14 return Vec<T>(vec.begin() + start, vec.begin() + end);
15 }
16
17 bool parse_bool(const Vec<u8> &bytestream,
18 usize &pos);
19
21 u8 parse_u8(const Vec<u8> &bytestream,
22 usize &pos);
23
25 u16 parse_u16(const Vec<u8> &bytestream,
26 usize &pos);
27
32 f32 parse_f16(const Vec<u8> &bytestream,
33 usize &pos);
34
36 u32 parse_u32(const Vec<u8> &bytestream,
37 usize &pos);
38
40 u64 parse_u64(const Vec<u8> &bytestream,
41 usize &pos);
42
44 i32 parse_i32(const Vec<u8> &bytestream,
45 usize &pos);
46
48 f32 parse_f32(const Vec<u8> &bytestream,
49 usize &pos);
50
52 f64 parse_f64(const Vec<u8> &bytestream,
53 usize &pos);
54
55
60 std::string parse_string(const Vec<u8> &bytestream,
61 usize &pos);
62}
63#endif
‍**
Definition caraspace.hpp:8
i32 parse_i32(const Vec< u8 > &bytestream, usize &pos)
get a signed 32bit int from a vector of bytes, advancing pos by 4
f64 parse_f64(const Vec< u8 > &bytestream, usize &pos)
get a signed long float (64) from a vector of bytes, advancing pos by 8
u16 parse_u16(const Vec< u8 > &bytestream, usize &pos)
get an unsigned short from a vector of bytes, advancing pos by 2
f32 parse_f32(const Vec< u8 > &bytestream, usize &pos)
get a signed float32 from a vector of bytes, advancning pos by 4
u64 parse_u64(const Vec< u8 > &bytestream, usize &pos)
get an unsigned long64 from a vector of bytes, advancing pos by 8
std::string parse_string(const Vec< u8 > &bytestream, usize &pos)
u32 parse_u32(const Vec< u8 > &bytestream, usize &pos)
get an unsigned 32bit int from a vector of bytes, advancing pos by 4
f32 parse_f16(const Vec< u8 > &bytestream, usize &pos)
u8 parse_u8(const Vec< u8 > &bytestream, usize &pos)
get an unsigned char from a vector of bytes, advancing pos by 1