F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
ComSplitterComponentAc.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title ComSplitterComponentAc.cpp
3// \author Generated by fpp-to-cpp
4// \brief cpp file for ComSplitter 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
14namespace Svc {
15
16 // ----------------------------------------------------------------------
17 // Component initialization
18 // ----------------------------------------------------------------------
19
20 void ComSplitterComponentBase ::
21 init(FwEnumStoreType instance)
22 {
23 // Initialize base class
25
26 // Connect input port comIn
27 for (
28 FwIndexType port = 0;
29 port < static_cast<FwIndexType>(this->getNum_comIn_InputPorts());
30 port++
31 ) {
32 this->m_comIn_InputPort[port].init();
33 this->m_comIn_InputPort[port].addCallComp(
34 this,
35 m_p_comIn_in
36 );
37 this->m_comIn_InputPort[port].setPortNum(port);
38
39#if FW_OBJECT_NAMES == 1
40 Fw::ObjectName portName;
41 portName.format(
42 "%s_comIn_InputPort[%" PRI_PlatformIntType "]",
43 this->m_objName.toChar(),
44 port
45 );
46 this->m_comIn_InputPort[port].setObjName(portName.toChar());
47#endif
48 }
49
50 // Connect output port comOut
51 for (
52 FwIndexType port = 0;
53 port < static_cast<FwIndexType>(this->getNum_comOut_OutputPorts());
54 port++
55 ) {
56 this->m_comOut_OutputPort[port].init();
57
58#if FW_OBJECT_NAMES == 1
59 Fw::ObjectName portName;
60 portName.format(
61 "%s_comOut_OutputPort[%" PRI_PlatformIntType "]",
62 this->m_objName.toChar(),
63 port
64 );
65 this->m_comOut_OutputPort[port].setObjName(portName.toChar());
66#endif
67 }
68 }
69
70 // ----------------------------------------------------------------------
71 // Getters for typed input ports
72 // ----------------------------------------------------------------------
73
74 Fw::InputComPort* ComSplitterComponentBase ::
75 get_comIn_InputPort(FwIndexType portNum)
76 {
78 portNum < this->getNum_comIn_InputPorts(),
79 static_cast<FwAssertArgType>(portNum)
80 );
81
82 return &this->m_comIn_InputPort[portNum];
83 }
84
85 // ----------------------------------------------------------------------
86 // Connect typed input ports to typed output ports
87 // ----------------------------------------------------------------------
88
89 void ComSplitterComponentBase ::
90 set_comOut_OutputPort(
91 FwIndexType portNum,
93 )
94 {
96 portNum < this->getNum_comOut_OutputPorts(),
97 static_cast<FwAssertArgType>(portNum)
98 );
99
100 this->m_comOut_OutputPort[portNum].addCallPort(port);
101 }
102
103#if FW_PORT_SERIALIZATION
104
105 // ----------------------------------------------------------------------
106 // Connect serial input ports to typed output ports
107 // ----------------------------------------------------------------------
108
109 void ComSplitterComponentBase ::
110 set_comOut_OutputPort(
111 FwIndexType portNum,
112 Fw::InputSerializePort* port
113 )
114 {
115 FW_ASSERT(
116 portNum < this->getNum_comOut_OutputPorts(),
117 static_cast<FwAssertArgType>(portNum)
118 );
119
120 this->m_comOut_OutputPort[portNum].registerSerialPort(port);
121 }
122
123#endif
124
125 // ----------------------------------------------------------------------
126 // Component construction and destruction
127 // ----------------------------------------------------------------------
128
129 ComSplitterComponentBase ::
130 ComSplitterComponentBase(const char* compName) :
131 Fw::PassiveComponentBase(compName)
132 {
133
134 }
135
136 ComSplitterComponentBase ::
137 ~ComSplitterComponentBase()
138 {
139
140 }
141
142 // ----------------------------------------------------------------------
143 // Getters for numbers of typed input ports
144 // ----------------------------------------------------------------------
145
146 FwIndexType ComSplitterComponentBase ::
147 getNum_comIn_InputPorts() const
148 {
149 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_comIn_InputPort));
150 }
151
152 // ----------------------------------------------------------------------
153 // Getters for numbers of typed output ports
154 // ----------------------------------------------------------------------
155
156 FwIndexType ComSplitterComponentBase ::
157 getNum_comOut_OutputPorts() const
158 {
159 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_comOut_OutputPort));
160 }
161
162 // ----------------------------------------------------------------------
163 // Connection status queries for typed output ports
164 // ----------------------------------------------------------------------
165
166 bool ComSplitterComponentBase ::
167 isConnected_comOut_OutputPort(FwIndexType portNum)
168 {
169 FW_ASSERT(
170 portNum < this->getNum_comOut_OutputPorts(),
171 static_cast<FwAssertArgType>(portNum)
172 );
173
174 return this->m_comOut_OutputPort[portNum].isConnected();
175 }
176
177 // ----------------------------------------------------------------------
178 // Port handler base-class functions for typed input ports
179 //
180 // Call these functions directly to bypass the corresponding ports
181 // ----------------------------------------------------------------------
182
183 void ComSplitterComponentBase ::
184 comIn_handlerBase(
185 FwIndexType portNum,
186 Fw::ComBuffer& data,
187 U32 context
188 )
189 {
190 // Make sure port number is valid
191 FW_ASSERT(
192 portNum < this->getNum_comIn_InputPorts(),
193 static_cast<FwAssertArgType>(portNum)
194 );
195
196 // Call handler function
197 this->comIn_handler(
198 portNum,
199 data,
200 context
201 );
202 }
203
204 // ----------------------------------------------------------------------
205 // Invocation functions for typed output ports
206 // ----------------------------------------------------------------------
207
208 void ComSplitterComponentBase ::
209 comOut_out(
210 FwIndexType portNum,
211 Fw::ComBuffer& data,
212 U32 context
213 )
214 {
215 FW_ASSERT(
216 portNum < this->getNum_comOut_OutputPorts(),
217 static_cast<FwAssertArgType>(portNum)
218 );
219 this->m_comOut_OutputPort[portNum].invoke(
220 data,
221 context
222 );
223 }
224
225 // ----------------------------------------------------------------------
226 // Calls for messages received on typed input ports
227 // ----------------------------------------------------------------------
228
229 void ComSplitterComponentBase ::
230 m_p_comIn_in(
231 Fw::PassiveComponentBase* callComp,
232 FwIndexType portNum,
233 Fw::ComBuffer& data,
234 U32 context
235 )
236 {
237 FW_ASSERT(callComp);
238 ComSplitterComponentBase* compPtr = static_cast<ComSplitterComponentBase*>(callComp);
239 compPtr->comIn_handlerBase(
240 portNum,
241 data,
242 context
243 );
244 }
245
246}
#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
PlatformIndexType FwIndexType
Definition FpConfig.h:25
void init()
Object initializer.
Definition ObjBase.cpp:27
const char * toChar() const
void format(const CHAR *formatString,...)
write formatted string to buffer
Auto-generated base for ComSplitter component.
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.