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
7#include <cstdio>
8
10#include "Fw/Types/Assert.hpp"
11#if FW_ENABLE_TEXT_LOGGING
12#include "Fw/Types/String.hpp"
13#endif
14
15namespace Svc {
16
17 // ----------------------------------------------------------------------
18 // Component initialization
19 // ----------------------------------------------------------------------
20
21 void FatalHandlerComponentBase ::
22 init(NATIVE_INT_TYPE instance)
23 {
24 // Initialize base class
26
27 // Connect input port FatalReceive
28 for (
29 PlatformIntType port = 0;
30 port < static_cast<PlatformIntType>(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 char portName[120];
42 (void) snprintf(
43 portName,
44 sizeof(portName),
45 "%s_FatalReceive_InputPort[%" PRI_PlatformIntType "]",
46 this->m_objName,
47 port
48 );
49 this->m_FatalReceive_InputPort[port].setObjName(portName);
50#endif
51 }
52 }
53
54 // ----------------------------------------------------------------------
55 // Getters for typed input ports
56 // ----------------------------------------------------------------------
57
58 Svc::InputFatalEventPort* FatalHandlerComponentBase ::
59 get_FatalReceive_InputPort(NATIVE_INT_TYPE portNum)
60 {
62 portNum < this->getNum_FatalReceive_InputPorts(),
63 static_cast<FwAssertArgType>(portNum)
64 );
65
66 return &this->m_FatalReceive_InputPort[portNum];
67 }
68
69 // ----------------------------------------------------------------------
70 // Component construction and destruction
71 // ----------------------------------------------------------------------
72
73 FatalHandlerComponentBase ::
74 FatalHandlerComponentBase(const char* compName) :
75 Fw::PassiveComponentBase(compName)
76 {
77
78 }
79
80 FatalHandlerComponentBase ::
81 ~FatalHandlerComponentBase()
82 {
83
84 }
85
86 // ----------------------------------------------------------------------
87 // Getters for numbers of typed input ports
88 // ----------------------------------------------------------------------
89
90 NATIVE_INT_TYPE FatalHandlerComponentBase ::
91 getNum_FatalReceive_InputPorts() const
92 {
93 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_FatalReceive_InputPort));
94 }
95
96 // ----------------------------------------------------------------------
97 // Port handler base-class functions for typed input ports
98 //
99 // Call these functions directly to bypass the corresponding ports
100 // ----------------------------------------------------------------------
101
102 void FatalHandlerComponentBase ::
103 FatalReceive_handlerBase(
104 NATIVE_INT_TYPE portNum,
106 )
107 {
108 // Make sure port number is valid
109 FW_ASSERT(
110 portNum < this->getNum_FatalReceive_InputPorts(),
111 static_cast<FwAssertArgType>(portNum)
112 );
113
114 // Down call to pure virtual handler method implemented in Impl class
115 this->FatalReceive_handler(
116 portNum,
117 Id
118 );
119 }
120
121 // ----------------------------------------------------------------------
122 // Calls for messages received on typed input ports
123 // ----------------------------------------------------------------------
124
125 void FatalHandlerComponentBase ::
126 m_p_FatalReceive_in(
127 Fw::PassiveComponentBase* callComp,
128 NATIVE_INT_TYPE portNum,
130 )
131 {
132 FW_ASSERT(callComp);
133 FatalHandlerComponentBase* compPtr = static_cast<FatalHandlerComponentBase*>(callComp);
135 portNum,
136 Id
137 );
138 }
139
140}
#define FW_ASSERT(...)
Definition Assert.hpp:7
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:66
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
U32 FwEventIdType
Definition FpConfig.h:62
void init()
Object initializer.
Definition ObjBase.cpp:27
Auto-generated base for FatalHandler component.
void FatalReceive_handlerBase(NATIVE_INT_TYPE portNum, FwEventIdType Id)
Handler base-class function for input port FatalReceive.