Helios++
Helios software for LiDAR simulations
HDA_StateJSONReporter.h
1 #ifdef DATA_ANALYTICS
2 #pragma once
3 
4 #include <filems/write/comps/SimpleSyncFileStringWriter.h>
5 #include <maths/Rotation.h>
6 #include <scanner/FWFSettings.h>
7 class SurveyPlayback;
8 #include <assetloading/ScenePart.h>
9 #include <platform/PlatformSettings.h>
10 #include <scanner/ScannerSettings.h>
11 #include <platform/trajectory/TrajectorySettings.h>
12 #include <sim/comps/Leg.h>
13 
14 #include <armadillo>
15 
16 #include <string>
17 #include <vector>
18 #include <list>
19 
20 namespace helios { namespace analytics {
21 
29 class HDA_StateJSONReporter{
30 public:
31  // *** ENUMERATIONS *** //
32  // ********************** //
36  enum class EntryType{
37  VALUE, // "key": val or "key": "val" if string
38  OBJECT, // "key": {...}
39  ARRAY // "key": [...]
40  };
41 protected:
42  // *** ATTRIBUTES *** //
43  // ******************** //
47  SurveyPlayback *sp;
55 
56 public:
57  // *** CONSTRUCTION / DESTRUCTION *** //
58  // ************************************ //
66  HDA_StateJSONReporter(
67  SurveyPlayback *sp,
68  std::string const &path
69  ) :
70  sp(sp),
71  writer(path, std::ios_base::trunc)
72  {}
73  virtual ~HDA_StateJSONReporter() = default;
74 
75  // *** MAIN REPORT METHODS *** //
76  // ***************************** //
81  virtual void report();
82 
83 protected:
84  // *** SECONDARY REPORT METHODS *** //
85  // ********************************** //
89  virtual void reportSimulation();
93  virtual void reportSurvey();
97  virtual void reportFilems();
101  virtual void reportPlatform();
105  virtual void reportScanner();
109  virtual void reportDeflector();
113  virtual void reportDetector();
117  virtual void reportScene();
121  virtual void reportLegs();
122 
123  // *** UTIL METHODS *** //
124  // ********************** //
137  template <typename ValType>
138  std::string craftEntry(
139  std::string const &key,
140  ValType const &val,
141  int const depth=0,
142  bool const asString=false,
143  bool const last=false
144  );
148  std::string craftEntry(
149  std::string const &key,
150  double const &val,
151  int const depth=0,
152  bool const asString=false,
153  bool const last=false
154  );
158  std::string craftEntry(
159  std::string const &key,
160  glm::dvec3 const &u,
161  int const depth=0,
162  bool const asString=false,
163  bool const last=false
164  );
168  std::string craftEntry(
169  std::string const &key,
170  Rotation const &r,
171  int const depth=0,
172  bool const asString=false,
173  bool const last=false
174  );
178  template <typename T>
179  std::string craftEntry(
180  std::string const &key,
181  std::vector<T> const &u,
182  int const depth=0,
183  bool const asString=false,
184  bool const last=false
185  );
189  template <typename T>
190  std::string craftEntry(
191  std::string const &key,
192  std::list<T> const &u,
193  int const depth=0,
194  bool const asString=false,
195  bool const last=false
196  );
200  std::string craftEntry(
201  std::string const &key,
202  FWFSettings const &fs,
203  int const depth=0,
204  bool const asString=false,
205  bool const last=false
206  );
210  std::string craftEntry(
211  std::string const &key,
212  ScenePart const &sp,
213  int const depth=0,
214  bool const asString=false,
215  bool const last=false
216  );
221  std::string craftEntry(
222  std::string const &key,
223  arma::colvec const &centroid,
224  int const depth=0,
225  bool const asString=false,
226  bool const last=false
227  );
232  std::string craftEntry(
233  std::string const &key,
234  ScannerSettings const &ss,
235  int const depth=0,
236  bool const asString=false,
237  bool const last=false
238  );
243  std::string craftEntry(
244  std::string const &key,
245  PlatformSettings const &ps,
246  int const depth=0,
247  bool const asString=false,
248  bool const last=false
249  );
254  std::string craftEntry(
255  std::string const &key,
256  TrajectorySettings const &ts,
257  int const depth=0,
258  bool const asString=false,
259  bool const last=false
260  );
264  std::string craftEntry(
265  std::string const &key,
266  Leg const &leg,
267  int const depth=0,
268  bool const asString=false,
269  bool const last=false
270  );
271 
279  std::string openEntry(
280  std::string const &key,
281  int const depth=0,
282  EntryType const entryType=EntryType::VALUE
283  );
288  std::string openEntry(
289  int const depth=0,
290  EntryType const entryType=EntryType::VALUE
291  );
300  std::string closeEntry(
301  int const depth=0,
302  bool const last=false,
303  EntryType const entryType=EntryType::VALUE
304  );
305 };
306 
307 }}
308 #endif
Full Waveform settings.
Definition: FWFSettings.h:12
Class representing a survey leg.
Definition: Leg.h:17
Class representing platform settings.
Definition: PlatformSettings.h:16
Definition: Rotation.h:80
Scanner settings class.
Definition: ScannerSettings.h:16
Class representing a scene part.
Definition: ScenePart.h:20
Survey playback class, used to extend simulation functionalities so it can be controlled.
Definition: SurveyPlayback.h:18
Class representing trajectory settings.
Definition: TrajectorySettings.h:13
Concrete class specializing SimpleSyncFileWriter to write measurements directly to a file.
Definition: SimpleSyncFileStringWriter.h:24