ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
LogManager.h
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. 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, LLC.
15******************************************************************************/
16/*
17Log Manager header file
18
19Author: Alex Reynolds
20*/
21#ifndef LOG_MANAGER_H
22#define LOG_MANAGER_H
23
24#include <vector>
25
26#include "core/macros.h"
27#include "architecture/Tasks.h"
28#include "monitors/RateMonitor.h"
29#include "data_management/GraphTreeObject.h"
30#include "logging/SimLogger.h"
31#include "events/LogEvent.h"
32#include "architecture/Executive.h"
33#include "architecture/Time.h"
34
35namespace modelspace {
36
37 /// @brief Class to manage logs
38 ///
39 /// This is the header for the log manager, which is responsible
40 /// for adding logs to the simulation and ensuring they are executed
41 /// in accordance with their rate or triggers.
42 class LogManager : public clockwerk::GraphTreeObject {
43 public:
44 /// @brief Constructor for the log manager
45 LogManager(clockwerk::Executive &executive) : exc(executive) {}
46
47 /// @brief Destructor for the log manager. Frees memory allocated
48 /// internally to logging events and monitors
49 ~LogManager();
50
51 /// @brief Overloaded function to register and set up a logger
52 /// @param log The logger to add to the sim
53 /// @param rate The rate, as a Time object, at which the logger should log
54 void addLog(clockwerk::SimLogger &log, const clockwerk::Time &rate);
55
56 /// @brief Overloaded function to register and set up a logger
57 /// @param log The logger to add to the sim
58 /// @param rate The rate, in Hz, at which the logger should log
59 void addLog(clockwerk::SimLogger &log, unsigned int rate);
60
61 /// @brief Overloaded function to register and set up a logger
62 /// @param log The logger to add to the sim
63 /// @param monitor The monitor which triggers the logger
64 void addLog(clockwerk::SimLogger &log, clockwerk::Monitor &monitor);
65
66 /// @brief Function to set output directory for all logs
67 /// @param directory Directory to set as base
68 /// @note Can be overwritten if individual log out dir is set
69 void outDir(const std::string &directory) {_output_directory = directory;}
70
71 clockwerk::Executive& exc;
72 protected:
73 /// Output directory
74 std::string _output_directory = "";
75
76 /// List of logging events
77 std::vector<LogEvent*> _log_events;
78
79 /// List of rate monitors established in the log manager
80 std::vector<RateMonitor*> _monitors;
81 };
82
83}
84
85#endif
Central control mechanism to run simulations and software.
Definition Executive.h:43
Base class for object organization.
Definition GraphTreeObject.h:87
Base class implementation of the monitor.
Definition Tasks.h:212
Class for logging data to a file.
Definition SimLogger.h:67
Wrapper to manage and convert time as timespce.
Definition Time.h:45
Class to execute logging.
Definition LogEvent.h:38
Class to manage logs.
Definition LogManager.h:42
std::vector< LogEvent * > _log_events
List of logging events.
Definition LogManager.h:77
void outDir(const std::string &directory)
Function to set output directory for all logs.
Definition LogManager.h:69
std::vector< RateMonitor * > _monitors
List of rate monitors established in the log manager.
Definition LogManager.h:80
void addLog(clockwerk::SimLogger &log, unsigned int rate)
Overloaded function to register and set up a logger.
Definition LogManager.cpp:62
std::string _output_directory
Output directory.
Definition LogManager.h:74
LogManager(clockwerk::Executive &executive)
Constructor for the log manager.
Definition LogManager.h:45
~LogManager()
Destructor for the log manager. Frees memory allocated internally to logging events and monitors.
Definition LogManager.cpp:24
void addLog(clockwerk::SimLogger &log, const clockwerk::Time &rate)
Overloaded function to register and set up a logger.
Definition LogManager.cpp:36
void addLog(clockwerk::SimLogger &log, clockwerk::Monitor &monitor)
Overloaded function to register and set up a logger.
Definition LogManager.cpp:92
Monitor to trigger at a particular rate.
Definition RateMonitor.h:42
Class to propagate CR3BP dynamics in characteristic units.
Definition ConfigurationWriter.cpp:18