F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
21  init(FwEnumStoreType instance)
22  {
23  // Initialize base class
25 
26  // Connect input port FatalReceive
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_FatalReceive_InputPorts());
30  port++
31  ) {
32  this->m_FatalReceive_InputPort[port].init();
33  this->m_FatalReceive_InputPort[port].addCallComp(
34  this,
35  m_p_FatalReceive_in
36  );
37  this->m_FatalReceive_InputPort[port].setPortNum(port);
38 
39 #if FW_OBJECT_NAMES == 1
40  Fw::ObjectName portName;
41  portName.format(
42  "%s_FatalReceive_InputPort[%" PRI_PlatformIntType "]",
43  this->m_objName.toChar(),
44  port
45  );
46  this->m_FatalReceive_InputPort[port].setObjName(portName.toChar());
47 #endif
48  }
49  }
50 
51  // ----------------------------------------------------------------------
52  // Getters for typed input ports
53  // ----------------------------------------------------------------------
54 
57  {
58  FW_ASSERT(
59  portNum < this->getNum_FatalReceive_InputPorts(),
60  static_cast<FwAssertArgType>(portNum)
61  );
62 
63  return &this->m_FatalReceive_InputPort[portNum];
64  }
65 
66  // ----------------------------------------------------------------------
67  // Component construction and destruction
68  // ----------------------------------------------------------------------
69 
71  FatalHandlerComponentBase(const char* compName) :
72  Fw::PassiveComponentBase(compName)
73  {
74 
75  }
76 
79  {
80 
81  }
82 
83  // ----------------------------------------------------------------------
84  // Getters for numbers of typed input ports
85  // ----------------------------------------------------------------------
86 
89  {
90  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_FatalReceive_InputPort));
91  }
92 
93  // ----------------------------------------------------------------------
94  // Port handler base-class functions for typed input ports
95  //
96  // Call these functions directly to bypass the corresponding ports
97  // ----------------------------------------------------------------------
98 
101  FwIndexType portNum,
102  FwEventIdType Id
103  )
104  {
105  // Make sure port number is valid
106  FW_ASSERT(
107  portNum < this->getNum_FatalReceive_InputPorts(),
108  static_cast<FwAssertArgType>(portNum)
109  );
110 
111  // Call handler function
112  this->FatalReceive_handler(
113  portNum,
114  Id
115  );
116  }
117 
118  // ----------------------------------------------------------------------
119  // Calls for messages received on typed input ports
120  // ----------------------------------------------------------------------
121 
122  void FatalHandlerComponentBase ::
123  m_p_FatalReceive_in(
124  Fw::PassiveComponentBase* callComp,
125  FwIndexType portNum,
126  FwEventIdType Id
127  )
128  {
129  FW_ASSERT(callComp);
130  FatalHandlerComponentBase* compPtr = static_cast<FatalHandlerComponentBase*>(callComp);
131  compPtr->FatalReceive_handlerBase(
132  portNum,
133  Id
134  );
135  }
136 
137 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
#define PRI_PlatformIntType
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
U32 FwEventIdType
Definition: FpConfig.h:103
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
void setPortNum(NATIVE_INT_TYPE portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:27
const char * toChar() const
Definition: ObjectName.hpp:50
void format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:56
Auto-generated base for FatalHandler component.
Svc::InputFatalEventPort * get_FatalReceive_InputPort(FwIndexType portNum)
void FatalReceive_handlerBase(FwIndexType portNum, FwEventIdType Id)
Handler base-class function for input port FatalReceive.
virtual void FatalReceive_handler(FwIndexType portNum, FwEventIdType Id)=0
Handler for input port FatalReceive.
FatalHandlerComponentBase(const char *compName="")
Construct FatalHandlerComponentBase object.
FwIndexType getNum_FatalReceive_InputPorts() const
virtual ~FatalHandlerComponentBase()
Destroy FatalHandlerComponentBase object.
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.