F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActiveComponentBase.hpp
Go to the documentation of this file.
1 /*
2  * ActiveComponentBase.hpp
3  *
4  * Created on: Aug 14, 2012
5  * Author: tcanham
6  */
7 
8 /*
9  * Description:
10  */
11 #ifndef FW_ACTIVE_COMPONENT_BASE_HPP
12 #define FW_ACTIVE_COMPONENT_BASE_HPP
13 
15 #include <Fw/Deprecate.hpp>
16 #include <Fw/FPrimeBasicTypes.hpp>
17 #include <Os/Task.hpp>
18 
19 namespace Fw {
21  public:
24  FwSizeType cpuAffinity = Os::Task::TASK_DEFAULT,
25  FwTaskIdType identifier = static_cast<FwTaskIdType>(
27  void exit();
29  DEPRECATED(Os::Task::Status join(void** value_ptr),
30  "Switch to .join()");
31 
32  enum {
34  };
35 
36  protected:
38  enum Lifecycle {
42  DONE,
43  };
44 
45  explicit ActiveComponentBase(const char* name);
46  virtual ~ActiveComponentBase();
47  void init(FwEnumStoreType instance);
48  virtual void preamble();
50  virtual void finalizer();
52 
53 #if FW_OBJECT_TO_STRING == 1
54  virtual const char* getToStringFormatString();
55 #endif
56  private:
57  Lifecycle m_stage;
58  static void s_taskStateMachine(void*);
59  static void s_taskLoop(void*);
60 };
61 
62 } // namespace Fw
63 #endif
static constexpr FwSizeType TASK_DEFAULT
Definition: Task.hpp:41
PlatformTaskIdType FwTaskIdType
The type of task priorities used.
Lifecycle
Tracks the lifecycle of the component.
Os::Task m_task
task object for active component
PlatformSizeType FwSizeType
I32 FwEnumStoreType
message to exit active component task
void exit()
exit task in active component
Initial stage, call preamble.
void init()
Object initializer.
Definition: ObjBase.cpp:24
static constexpr FwTaskPriorityType TASK_PRIORITY_DEFAULT
Definition: Task.hpp:47
virtual void finalizer()
A function that will be called after exiting the loop.
ActiveComponentBase(const char *name)
Constructor.
PlatformTaskPriorityType FwTaskPriorityType
The type of task priorities used.
virtual void preamble()
A function that will be called before the event loop is entered.
MsgDispatchStatus dispatch()
The function that will dispatching messages.
virtual ~ActiveComponentBase()
Destructor.
Os::Task::Status join()
Join the thread.
DEPRECATED(Os::Task::Status join(void **value_ptr), "Switch to .join()")
Join to thread with discarded value_ptr.
Component is dispatching messages.
void start(FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, FwSizeType stackSize=Os::Task::TASK_DEFAULT, FwSizeType cpuAffinity=Os::Task::TASK_DEFAULT, FwTaskIdType identifier=static_cast< FwTaskIdType >(Os::Task::TASK_DEFAULT))
called by instantiator when task is to be started
Implementation of malloc based allocator.
Penultimate stage, call finalizer.