10 #ifndef BEHAVIOUR_MANAGER_H
11 #define BEHAVIOUR_MANAGER_H
17 namespace behaviourcontrol
65 void reportError(
const std::string& msg,
bool fatal,
const std::string& funcName,
const std::string& fileName,
int line);
66 virtual void reportErrorUser(
const std::string& msg,
bool fatal,
const std::string& funcName,
const std::string& fileName,
int line) {}
68 bool hadError()
const {
return fatalErrorOccurred; }
69 bool hadWarning()
const {
return nonfatalErrorOccurred; }
71 bool fatalErrorOccurred;
72 bool nonfatalErrorOccurred;
84 template <
class LClass>
void declareLayer(LClass* layer);
87 std::vector<BehaviourLayer*> LList;
bool wasInitialised() const
Boolean flag specifying whether the manager has been initialised yet or not.
Definition: behaviour_manager.h:44
int ret_t
Used to represent an error code/function return value.
Definition: behaviour_common.h:142
virtual ret_t init()
Initialisation callback for the behaviour manager. This function is called from initialiseArchitectur...
Definition: behaviour_manager.h:47
Implements a single behaviour layer.
Definition: behaviour_layer.h:26
virtual void preStepCallback()
Callback that is invoked at the beginning of the step() function so that the user can inject code...
Definition: behaviour_manager.h:58
bool isInitialising() const
Boolean flag specifying whether the manager is currently initialising or not.
Definition: behaviour_manager.h:45
Signals successful execution of a function, with no error conditions encountered. ...
Definition: behaviour_common.h:69
void clearErrorStatus()
Reset the error status flags so that functions like initialiseArchitecture() and step() can be attemp...
Definition: behaviour_manager.cpp:243
virtual void reportErrorUser(const std::string &msg, bool fatal, const std::string &funcName, const std::string &fileName, int line)
Error handler function that is intended to be overridden by the user to process and/or display warnin...
Definition: behaviour_manager.h:66
static const index_t DEF_LLIST_CAPACITY
Default capacity of the list that stores the child behaviour layers of the manager.
Definition: behaviour_manager.h:31
const std::string name
Human-friendly string name of the behaviour manager.
Definition: behaviour_manager.h:39
const ActuatorBase * findActuator(const std::string &signalName) const
Finds an actuator within the architecture, given its string name as a lookup key. ...
Definition: behaviour_manager.cpp:261
virtual void postStepCallback()
Callback that is invoked at the end of the step() function so that the user can inject code...
Definition: behaviour_manager.h:59
std::size_t index_t
Used to represent an array or vector index (must be an unsigned type)
Definition: behaviour_common.h:140
ret_t initialiseArchitecture()
Function that should be called by the user to initialise the entire behaviour manager architecture...
Definition: behaviour_manager.cpp:61
BehaviourManager(const std::string &name=nullString)
Default constructor.
Definition: behaviour_manager.cpp:28
static const std::string DEF_MANAGER_NAME
Default behaviour manager name used to generate a unique one, in the case that no name is provided by...
Definition: behaviour_manager.h:32
bool hadError() const
Boolean flag that specifies whether an error has occurred with the architecture.
Definition: behaviour_manager.h:68
Implements a single actuator.
Definition: behaviour_actuators.h:76
bool hadWarning() const
Boolean flag that specifies whether an error or warning has occurred with the architecture.
Definition: behaviour_manager.h:69
void reportError(const std::string &msg, bool fatal, const std::string &funcName, const std::string &fileName, int line)
Function used to signal that a warning or an error has occurred. After setting the appropriate error ...
Definition: behaviour_manager.cpp:228
int cycleID() const
The numeric ID of the current step cycle of the behaviour manager. Prior to the first step this ID is...
Definition: behaviour_manager.h:56
Implements a single behaviour manager.
Definition: behaviour_manager.h:27
const std::string nullString
Used to avoid the need for null string literals throughout the code.
Definition: behaviour_common.h:148
virtual ~BehaviourManager()
Behaviour manager object destructor.
Definition: behaviour_manager.cpp:41
Implements a single sensor.
Definition: behaviour_sensors.h:76
void step()
Function that should be called by the user to execute one step of the entire behaviour manager archit...
Definition: behaviour_manager.cpp:170
Common definitions include file for the internal Behaviour Control Framework source code...
std::string toString(const std::string &linePrefix=nullString) const
Generates a multiline string representation of the architecture, summarising all of the main componen...
Definition: behaviour_manager.cpp:336
BehaviourManager * getBasePtr()
Return a pointer to the underlying BehaviourManager class object in the case of a derived behaviour m...
Definition: behaviour_manager.h:80