ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
TimeManager.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/*
17Time Manager class header file
18
19Author: Alex Reynolds
20*/
21#ifndef TIME_MANAGER_H
22#define TIME_MANAGER_H
23
24#include "data_management/GraphTreeObject.h"
25#include "data_management/DataIO.hpp"
26#include "architecture/EventLogger.h"
27#include "core/clockwerkerrors.h"
28#include "core/macros.h"
29#include "architecture/Time.h"
30
31namespace clockwerk {
32
33 /// The time manager class is a class to manage various time variables.
34 /// It maintains 4 times -- base time, MET,
35 /// UTC time, and GPS time. Base time is automatically set to zero
36 /// on start, and a combination of MET or GPS/UTC time can be set
37 /// and maintained via time increments and updates.
38 class TimeManager : public GraphTreeObject {
39 public:
40 /// Base constructor -- time manager should initialize to zeros and then be set
42 ~TimeManager() {};
43
44 /// @brief Function to increment all times
45 /// @param step Time object to step by
46 void stepTime(const Time& step);
47
48 /// @brief Function to increment step start and end time
49 /// @param step Time object to step by
50 void updateStep(const Time& step);
51
52 /// @brief Function to return base time by call for easy access
53 /// @note Returns the base time because it is the most default time
54 Time operator() (){return base_time();}
55
56 /// ------------------------------------------------------------------
57 /// Incrementing clocks -- these are standard clocks that begin on
58 /// start and continue incrementing as the scheduler steps forward
59 /// in time.
60 /// ------------------------------------------------------------------
61 /// This is the time at the start of a given scheduler step
62 DataIO<Time> step_start_time = DataIO<Time>(this, "step_start_time");
63 /// This is the time at the end of a given scheduler step
64 DataIO<Time> step_end_time = DataIO<Time>(this, "step_end_time");
65 /// This is the exact current time as the scheduler steps forward
66 DataIO<Time> base_time = DataIO<Time>(this, "base_time");
67
68 /// ------------------------------------------------------------------
69 /// Other time functions -- These functions return other forms of time
70 /// ------------------------------------------------------------------
71 /// @brief Function to return the wall clock time since run start
72 /// @return A time object containing the time since run start
73 virtual Time wallClockTimer() {return Time();}
74
75 /// @brief Function to return whether the wall clock timer is started
76 /// @return Whether the wall clock timer is started
77 bool wallClockIsStarted() {return _started;}
78 protected:
79 /// Pointers to our time objects
81 Time* _end_step_ptr;
82 Time* _base_time_ptr;
83
84 // Time used for wall clock calculation
85 bool _started = false;
86 Time _start;
87 Time _now;
88 };
89}
90
91#endif
Class for inter-object communication.
Definition DataIO.hpp:46
const T & operator()()
Overloaded operator to return value of DataIO object.
Definition DataIO.hpp:129
Base class for object organization.
Definition GraphTreeObject.h:87
The time manager class is a class to manage various time variables. It maintains 4 times – base time,...
Definition TimeManager.h:38
void updateStep(const Time &step)
Function to increment step start and end time.
Definition TimeManager.cpp:26
DataIO< Time > step_start_time
Definition TimeManager.h:62
DataIO< Time > base_time
This is the exact current time as the scheduler steps forward.
Definition TimeManager.h:66
TimeManager()
Base constructor – time manager should initialize to zeros and then be set.
Definition TimeManager.cpp:20
bool wallClockIsStarted()
Function to return whether the wall clock timer is started.
Definition TimeManager.h:77
DataIO< Time > step_end_time
This is the time at the end of a given scheduler step.
Definition TimeManager.h:64
void stepTime(const Time &step)
Function to increment all times.
Definition TimeManager.cpp:37
Time * _start_step_ptr
Pointers to our time objects.
Definition TimeManager.h:80
Time operator()()
Function to return base time by call for easy access.
Definition TimeManager.h:54
virtual Time wallClockTimer()
Function to return the wall clock time since run start.
Definition TimeManager.h:73
Wrapper to manage and convert time as timespce.
Definition Time.h:45
Time()
Default, copy constructors and default destructor.
Definition Time.h:48