WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
CsvLogger.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX INC 2025. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX INC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX INC.
15******************************************************************************/
16/*
17CSV Logger header file
18
19Author: Alex Reynolds
20*/
21#ifndef LOGGING_CSV_LOGGER_H
22#define LOGGING_CSV_LOGGER_H
23
24#include <fstream>
25
26#include "logging/SimLogger.h"
28
29namespace warptwin {
30
35 class CsvLogger : public clockwerk::SimLogger {
36 public:
38 CsvLogger(warpos::FlightExecutive &exec, const std::string &filename="output.csv", unsigned int buffer_size=1000);
40
43 int delimeter(const std::string &delim);
44
48 int filename(std::string name);
49
52 int close();
53
57 int setPrecision(int precision);
58
64 void logLevel(log_level_e log_level) {_local_log_level = log_level;}
65 protected:
67 int _createSetupFile();
68
70 int _writeToFile();
71
73 std::ofstream _fout;
74
76 std::string _delimeter;
77
80
82 int _precision = 20;
83
86 };
87
88}
89
90#endif
Executive derivation specifically to run flight systems.
Definition FlightExecutive.h:46
int close()
Function to close down the file – logs remaining buffered data and closes.
Definition CsvLogger.cpp:186
int _precision
The precision of logging. Default is 20 places.
Definition CsvLogger.h:82
log_level_e _local_log_level
The log level for this particular app.
Definition CsvLogger.h:85
std::ofstream _fout
Stream variable to write file to.
Definition CsvLogger.h:73
warpos::FlightExecutive & exc
Handle to executive for logging.
Definition CsvLogger.h:79
int _createSetupFile()
Function to create a CSV file for logging.
Definition CsvLogger.cpp:93
~CsvLogger()
Definition CsvLogger.h:39
int delimeter(const std::string &delim)
Function to set the delimeter.
Definition CsvLogger.cpp:75
CsvLogger(warpos::FlightExecutive &exec, const std::string &filename="output.csv", unsigned int buffer_size=1000)
Constructor for CSV logger – wraps around logger constructor.
Definition CsvLogger.cpp:29
int _writeToFile()
Function to write buffered data to CSV file.
Definition CsvLogger.cpp:136
std::string _delimeter
String to indicate delimeter – set to comma by default.
Definition CsvLogger.h:76
log_level_e logLevel()
Get the log level set for the executive.
Definition CsvLogger.h:61
void logLevel(log_level_e log_level)
Set the executive log level.
Definition CsvLogger.h:64
int setPrecision(int precision)
Function to set the precision of CSV logging.
Definition CsvLogger.cpp:84
int filename(std::string name)
Function to set CSV logger filename.
Definition CsvLogger.cpp:51
log_level_e
Log level enumerations.
Definition flighterrors.h:159
@ LOG_WARNING
Output in almost all cases.
Definition flighterrors.h:162
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22