F´ Flight Software - C/C++ Documentation  devel
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 
14 #include <FpConfig.hpp>
16 #include <Fw/Deprecate.hpp>
17 #include <Os/Task.hpp>
18 
19 namespace Fw {
21  public:
25  Os::Task::ParamType identifier =
27  void exit();
29  DEPRECATED(Os::Task::Status join(void** value_ptr), "Switch to .join()");
30 
31  enum {
33  };
34 
35  PROTECTED:
37  enum Lifecycle {
41  DONE,
42  };
43 
44  explicit ActiveComponentBase(const char* name);
45  virtual ~ActiveComponentBase();
46  void init(NATIVE_INT_TYPE instance);
47  virtual void preamble();
49  virtual void finalizer();
51 
52 #if FW_OBJECT_TO_STRING == 1
53  virtual void toString(char* str, NATIVE_INT_TYPE size);
54 #endif
55  PRIVATE:
56  Lifecycle m_stage;
57  static void s_taskStateMachine(void*);
58  static void s_taskLoop(void*);
59 };
60 
61 } // namespace Fw
62 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
C++-compatible configuration header for fprime configuration.
Os::Task::Status join()
Join the thread.
Lifecycle
Tracks the lifecycle of the component.
@ DISPATCHING
Component is dispatching messages.
@ CREATED
Initial stage, call preamble.
@ FINALIZING
Penultimate stage, call finalizer.
@ DONE
Done, doing nothing.
Os::Task m_task
task object for active component
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
ActiveComponentBase(const char *name)
Constructor.
void start(Os::Task::ParamType priority=Os::Task::TASK_DEFAULT, Os::Task::ParamType stackSize=Os::Task::TASK_DEFAULT, Os::Task::ParamType cpuAffinity=Os::Task::TASK_DEFAULT, Os::Task::ParamType identifier=Os::Task::TASK_DEFAULT)
called by instantiator when task is to be started
void exit()
exit task in active component
virtual ~ActiveComponentBase()
Destructor.
MsgDispatchStatus dispatch()
The function that will dispatching messages.
virtual void finalizer()
A function that will be called after exiting the loop.
virtual void preamble()
A function that will be called before the event loop is entered.
DEPRECATED(Os::Task::Status join(void **value_ptr), "Switch to .join()")
Join to thread with discarded value_ptr.
void init()
Object initializer.
Definition: ObjBase.cpp:27
FwSizeType ParamType
backwards-compatible parameter type
Definition: Task.hpp:218
static constexpr FwSizeType TASK_DEFAULT
Definition: Task.hpp:28