0.4.1
Loading...
Searching...
No Matches
MatrixLogger.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9/// @file MatrixLogger.hpp
10/// @brief Data Logger for matrices
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2022-06-27
13
14#pragma once
15
19
20namespace NAV
21{
22class NodeData;
23
24/// Data Logger for PosVelAtt observations
25class MatrixLogger : public Node, public FileWriter, public CommonLog
26{
27 public:
28 /// @brief Default constructor
30 /// @brief Destructor
31 ~MatrixLogger() override;
32 /// @brief Copy constructor
33 MatrixLogger(const MatrixLogger&) = delete;
34 /// @brief Move constructor
36 /// @brief Copy assignment operator
38 /// @brief Move assignment operator
40
41 /// @brief String representation of the Class Type
42 [[nodiscard]] static std::string typeStatic();
43
44 /// @brief String representation of the Class Type
45 [[nodiscard]] std::string type() const override;
46
47 /// @brief String representation of the Class Category
48 [[nodiscard]] static std::string category();
49
50 /// @brief ImGui config window which is shown on double click
51 /// @attention Don't forget to set _hasConfig to true in the constructor of the node
52 void guiConfig() override;
53
54 /// @brief Saves the node into a json object
55 [[nodiscard]] json save() const override;
56
57 /// @brief Restores the node from a json object
58 /// @param[in] j Json object with the node state
59 void restore(const json& j) override;
60
61 /// @brief Function called by the flow executer after finishing to flush out remaining data
62 void flush() override;
63
64 private:
65 constexpr static size_t INPUT_PORT_INDEX_MATRIX = 0; ///< @brief Matrix
66
67 /// @brief Initialize the node
68 bool initialize() override;
69
70 /// @brief Deinitialize the node
71 void deinitialize() override;
72
73 /// @brief Write a matrix to the file
74 /// @param[in] insTime Time the data was received
75 /// @param[in] pinIdx Index of the pin the data is received on
76 void writeMatrix(const InsTime& insTime, size_t pinIdx);
77
78 /// Flag whether the header was written
79 bool _headerWritten = false;
80};
81
82} // namespace NAV
Common logging variables like time into run and local positions.
File Writer class.
nlohmann::json json
json namespace
Node Class.
CommonLog(const CommonLog &)=delete
Copy constructor.
FileWriter(const FileWriter &)=delete
Copy constructor.
The class is responsible for all time-related tasks.
Definition InsTime.hpp:710
void deinitialize() override
Deinitialize the node.
static std::string typeStatic()
String representation of the Class Type.
MatrixLogger()
Default constructor.
MatrixLogger & operator=(MatrixLogger &&)=delete
Move assignment operator.
static std::string category()
String representation of the Class Category.
json save() const override
Saves the node into a json object.
~MatrixLogger() override
Destructor.
void writeMatrix(const InsTime &insTime, size_t pinIdx)
Write a matrix to the file.
MatrixLogger(MatrixLogger &&)=delete
Move constructor.
bool _headerWritten
Flag whether the header was written.
void flush() override
Function called by the flow executer after finishing to flush out remaining data.
static constexpr size_t INPUT_PORT_INDEX_MATRIX
Matrix.
MatrixLogger(const MatrixLogger &)=delete
Copy constructor.
void restore(const json &j) override
Restores the node from a json object.
std::string type() const override
String representation of the Class Type.
void guiConfig() override
ImGui config window which is shown on double click.
MatrixLogger & operator=(const MatrixLogger &)=delete
Copy assignment operator.
bool initialize() override
Initialize the node.
Parent class for all data transmitted over Flow pins.
Definition NodeData.hpp:28
Node(std::string name)
Constructor.
Definition Node.cpp:30