ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
Executive.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/*
17Executive header file
18
19Author: Alex Reynolds
20*/
21#ifndef EXECUTIVE_H
22#define EXECUTIVE_H
23
24#include "data_management/GraphTreeObject.h"
25#include "architecture/EventLogger.h"
26#include "architecture/TimeManager.h"
27#include "architecture/Scheduler.h"
28#include "core/clockwerkerrors.h"
29
30namespace clockwerk {
31
32 /// @brief Central control mechanism to run simulations and software
33 ///
34 /// The executive is a generic base class for operating embedded,
35 /// simulation, and other software models. It contains reference
36 /// objects to the following:
37 /// - Event logger - A method for controlling output to screen/file for debugging
38 /// - Scheduler - An implementation of the scheduling class to set run parameters
39 ///
40 /// The executive class is designed to resolve into specific derived
41 /// class implementations, but does not have to be. It is perfectly
42 /// possible to build an entire executive out of the base class here.
43 class Executive : public GraphTreeObject {
44 public:
45 /// / @brief Constructor for the executive
46 Executive() {_schedule = nullptr; _time = nullptr;}
47 virtual ~Executive() {}
48
49 /// / @brief Function to execute startup for the executive and its kids
50 /// / @return Error code corresponding to success/failure
51 virtual int startup() {if(_schedule!=nullptr) {return _schedule->startup();} else {return ERROR_NULLPTR;}}
52
53 /// / @brief Function to execute step for the executive and its kids
54 /// / @return Error code corresponding to success/failure
55 virtual int step() {if(_schedule!=nullptr) {return _schedule->step();} else {return ERROR_NULLPTR;}}
56
57 /// / @brief Function to execute run for the executive and its kids
58 /// / @return Error code corresponding to success/failure
59 virtual int run() {if(_schedule!=nullptr) {return _schedule->run(); } else {return ERROR_NULLPTR;}}
60
61 /// / @brief This function shadows the schedule's terminate call
62 /// / for ease of use
63 virtual void terminate() {_schedule->terminate();}
64
65 /// / @brief This function shadows the scheduler's isTerminated call
66 /// / for ease of use
67 virtual bool isTerminated() {return _schedule->isTerminated();}
68
69 /// / @brief Function to set the scheduler for the executive
70 void schedule(Scheduler* sched) {_schedule = sched;}
71
72 /// / @brief Getter for the schedule. Returns pointer to schedule
73 clockwerk::Scheduler* schedule() {return _schedule;}
74
75 /// / @brief Getter for the event logger. Returns pointer to event logger
76 clockwerk::EventLogger* eventLog() {return &event_logger;}
77
78 /// / @brief Getter for a pointer to the time manager.
79 /// / @note Returns nullpointer if time is unused
80 clockwerk::TimeManager* time() {return _time;}
81 void time(TimeManager* mgr) {_time = mgr;}
82 protected:
83 /// Scheduler to execute everything
84 clockwerk::Scheduler* _schedule;
85
86 /// Event logger for debugging and key events
88
89 /// Time manager -- tracked as a pointer because executive does
90 /// not depend on time, but we want access for the majority of
91 /// applications
93 };
94
95}
96
97#endif
Class to handle event and debug logging.
Definition EventLogger.h:64
Central control mechanism to run simulations and software.
Definition Executive.h:43
TimeManager * _time
Time manager – tracked as a pointer because executive does not depend on time, but we want access for...
Definition Executive.h:92
Executive()
/
Definition Executive.h:46
clockwerk::TimeManager * time()
/
Definition Executive.h:80
virtual void terminate()
/
Definition Executive.h:63
virtual int step()
/
Definition Executive.h:55
clockwerk::Scheduler * schedule()
/
Definition Executive.h:73
clockwerk::Scheduler * _schedule
Scheduler to execute everything.
Definition Executive.h:84
virtual int startup()
/
Definition Executive.h:51
clockwerk::EventLogger * eventLog()
/
Definition Executive.h:76
EventLogger event_logger
Event logger for debugging and key events.
Definition Executive.h:87
virtual int run()
/
Definition Executive.h:59
void schedule(Scheduler *sched)
/
Definition Executive.h:70
virtual bool isTerminated()
/
Definition Executive.h:67
Base class for object organization.
Definition GraphTreeObject.h:87
Base class implementation of the scheduler.
Definition Scheduler.h:48
virtual int startup()
Function to start and configure the scheduler.
Definition Scheduler.h:59
virtual bool isTerminated()
Function to indicate whether the scheduler is terminated.
Definition Scheduler.h:87
virtual int run()
Function to run the scheduler until pre-determined end conditions identified/calculated by the schedu...
Definition Scheduler.h:69
virtual void terminate()
Function to set the scheduler for termination.
Definition Scheduler.h:81
virtual int step(const clockwerk::Time &step_size=clockwerk::Time(0, 999999999+1))
Function to step the scheduler by a single step.
Definition Scheduler.h:63
The time manager class is a class to manage various time variables. It maintains 4 times – base time,...
Definition TimeManager.h:38
#define ERROR_NULLPTR
Definition clockwerkerrors.h:57