F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FatalHandlerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FatalHandlerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FatalHandler component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26 #if !FW_DIRECT_PORT_CALLS
27  // Connect input port FatalReceive
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_FatalReceive_InputPorts());
31  port++
32  ) {
33  this->m_FatalReceive_InputPort[port].init();
34  this->m_FatalReceive_InputPort[port].addCallComp(
35  this,
36  m_p_FatalReceive_in
37  );
38  this->m_FatalReceive_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_FatalReceive_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_FatalReceive_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51  }
52 
53 #if !FW_DIRECT_PORT_CALLS
54 
55  // ----------------------------------------------------------------------
56  // Getters for typed input ports
57  // ----------------------------------------------------------------------
58 
61  {
62  FW_ASSERT(
63  (0 <= portNum) && (portNum < this->getNum_FatalReceive_InputPorts()),
64  static_cast<FwAssertArgType>(portNum)
65  );
66 
67  return &this->m_FatalReceive_InputPort[portNum];
68  }
69 
70 #endif
71 
72  // ----------------------------------------------------------------------
73  // Component construction and destruction
74  // ----------------------------------------------------------------------
75 
77  FatalHandlerComponentBase(const char* compName) :
78  Fw::PassiveComponentBase(compName)
79  {
80 
81  }
82 
85  {
86 
87  }
88 
89  // ----------------------------------------------------------------------
90  // Port handler base-class functions for typed input ports
91  //
92  // Call these functions directly to bypass the corresponding ports
93  // ----------------------------------------------------------------------
94 
97  FwIndexType portNum,
98  FwEventIdType Id
99  )
100  {
101  // Make sure port number is valid
102  FW_ASSERT(
103  (0 <= portNum) && (portNum < this->getNum_FatalReceive_InputPorts()),
104  static_cast<FwAssertArgType>(portNum)
105  );
106 
107  // Call handler function
108  this->FatalReceive_handler(
109  portNum,
110  Id
111  );
112  }
113 
114  // ----------------------------------------------------------------------
115  // Calls for messages received on typed input ports
116  // ----------------------------------------------------------------------
117 
118  void FatalHandlerComponentBase ::
119  m_p_FatalReceive_in(
120  Fw::PassiveComponentBase* callComp,
121  FwIndexType portNum,
122  FwEventIdType Id
123  )
124  {
125  FW_ASSERT(callComp);
126  FatalHandlerComponentBase* compPtr = static_cast<FatalHandlerComponentBase*>(callComp);
127  compPtr->FatalReceive_handlerBase(
128  portNum,
129  Id
130  );
131  }
132 
133 }
virtual ~FatalHandlerComponentBase()
Destroy FatalHandlerComponentBase object.
Svc::InputFatalEventPort * get_FatalReceive_InputPort(FwIndexType portNum)
I32 FwEnumStoreType
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
static constexpr FwIndexType getNum_FatalReceive_InputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIdType FwEventIdType
The type of an event identifier.
Auto-generated base for FatalHandler component.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void setPortNum(FwIndexType portNum)
void init()
Initialization function.
PlatformIndexType FwIndexType
RateGroupDivider component implementation.
virtual void FatalReceive_handler(FwIndexType portNum, FwEventIdType Id)=0
Handler for input port FatalReceive.
Implementation of malloc based allocator.
FatalHandlerComponentBase(const char *compName="")
Construct FatalHandlerComponentBase object.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void FatalReceive_handlerBase(FwIndexType portNum, FwEventIdType Id)
Handler base-class function for input port FatalReceive.