Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
parser.h
Go to the documentation of this file.
1#ifndef KM3NET_ADF_CONFIG_PARSER_H
2#define KM3NET_ADF_CONFIG_PARSER_H
3
4#include <map>
5#include <string>
6#include <vector>
7#include <optional>
8#include <iostream>
9
10class Parser
11{
12public:
13
14 Parser(const std::string& d, char t);
15
16 std::vector<std::string> Find(const std::string& tag);
17
18 std::string Find(const std::string& tag, size_t index,
19 std::string value = "");
20
21private:
22
24};
25
26template<typename T>
28{
29 int id;
31
32 bool operator==(const Waveform<T>& rhs) const
33 {
34 return rhs.id == id && samples == rhs.samples;
35 }
36 bool operator!=(const Waveform<T>& rhs) const
37 {
38 return !(*this == rhs);
39 }
40
41 friend std::ostream& operator<<(std::ostream& out, const Waveform<T>& waveform)
42 {
43 out << waveform.id << " " << waveform.samples.size() << " ";
44 for (const auto& sample : waveform.samples) {
45 out << sample << " ";
46 }
47 return out;
48 }
49};
50
51
52template<typename T>
53std::optional<Waveform<T>> parseWaveformSamples(const std::string& adf_waveform_line);
54
55#endif
std::vector< std::string > Find(const std::string &tag)
Definition parser.cc:23
Parser(const std::string &d, char t)
Definition parser.cc:7
std::multimap< std::string, std::string > mmap
Definition parser.h:23
std::optional< Waveform< T > > parseWaveformSamples(const std::string &adf_waveform_line)
Definition parser.cc:46
std::vector< T > samples
Definition parser.h:30
friend std::ostream & operator<<(std::ostream &out, const Waveform< T > &waveform)
Definition parser.h:41
int id
Definition parser.h:29
bool operator==(const Waveform< T > &rhs) const
Definition parser.h:32
bool operator!=(const Waveform< T > &rhs) const
Definition parser.h:36