F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ComRetryComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComRetryComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ComRetry 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  // Connect input port comStatusIn
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_comStatusIn_InputPorts());
30  port++
31  ) {
32  this->m_comStatusIn_InputPort[port].init();
33  this->m_comStatusIn_InputPort[port].addCallComp(
34  this,
35  m_p_comStatusIn_in
36  );
37  this->m_comStatusIn_InputPort[port].setPortNum(port);
38 
39 #if FW_OBJECT_NAMES == 1
40  Fw::ObjectName portName;
41  portName.format(
42  "%s_comStatusIn_InputPort[%" PRI_FwIndexType "]",
43  this->m_objName.toChar(),
44  port
45  );
46  this->m_comStatusIn_InputPort[port].setObjName(portName.toChar());
47 #endif
48  }
49 
50  // Connect input port dataIn
51  for (
52  FwIndexType port = 0;
53  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
54  port++
55  ) {
56  this->m_dataIn_InputPort[port].init();
57  this->m_dataIn_InputPort[port].addCallComp(
58  this,
59  m_p_dataIn_in
60  );
61  this->m_dataIn_InputPort[port].setPortNum(port);
62 
63 #if FW_OBJECT_NAMES == 1
64  Fw::ObjectName portName;
65  portName.format(
66  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
67  this->m_objName.toChar(),
68  port
69  );
70  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
71 #endif
72  }
73 
74  // Connect input port dataReturnIn
75  for (
76  FwIndexType port = 0;
77  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
78  port++
79  ) {
80  this->m_dataReturnIn_InputPort[port].init();
81  this->m_dataReturnIn_InputPort[port].addCallComp(
82  this,
83  m_p_dataReturnIn_in
84  );
85  this->m_dataReturnIn_InputPort[port].setPortNum(port);
86 
87 #if FW_OBJECT_NAMES == 1
88  Fw::ObjectName portName;
89  portName.format(
90  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
91  this->m_objName.toChar(),
92  port
93  );
94  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
95 #endif
96  }
97 
98  // Connect output port comStatusOut
99  for (
100  FwIndexType port = 0;
101  port < static_cast<FwIndexType>(this->getNum_comStatusOut_OutputPorts());
102  port++
103  ) {
104  this->m_comStatusOut_OutputPort[port].init();
105 
106 #if FW_OBJECT_NAMES == 1
107  Fw::ObjectName portName;
108  portName.format(
109  "%s_comStatusOut_OutputPort[%" PRI_FwIndexType "]",
110  this->m_objName.toChar(),
111  port
112  );
113  this->m_comStatusOut_OutputPort[port].setObjName(portName.toChar());
114 #endif
115  }
116 
117  // Connect output port dataOut
118  for (
119  FwIndexType port = 0;
120  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
121  port++
122  ) {
123  this->m_dataOut_OutputPort[port].init();
124 
125 #if FW_OBJECT_NAMES == 1
126  Fw::ObjectName portName;
127  portName.format(
128  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
129  this->m_objName.toChar(),
130  port
131  );
132  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
133 #endif
134  }
135 
136  // Connect output port dataReturnOut
137  for (
138  FwIndexType port = 0;
139  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
140  port++
141  ) {
142  this->m_dataReturnOut_OutputPort[port].init();
143 
144 #if FW_OBJECT_NAMES == 1
145  Fw::ObjectName portName;
146  portName.format(
147  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
148  this->m_objName.toChar(),
149  port
150  );
151  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
152 #endif
153  }
154  }
155 
156  // ----------------------------------------------------------------------
157  // Getters for typed input ports
158  // ----------------------------------------------------------------------
159 
162  {
163  FW_ASSERT(
164  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
165  static_cast<FwAssertArgType>(portNum)
166  );
167 
168  return &this->m_comStatusIn_InputPort[portNum];
169  }
170 
173  {
174  FW_ASSERT(
175  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
176  static_cast<FwAssertArgType>(portNum)
177  );
178 
179  return &this->m_dataIn_InputPort[portNum];
180  }
181 
184  {
185  FW_ASSERT(
186  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
187  static_cast<FwAssertArgType>(portNum)
188  );
189 
190  return &this->m_dataReturnIn_InputPort[portNum];
191  }
192 
193  // ----------------------------------------------------------------------
194  // Connect typed input ports to typed output ports
195  // ----------------------------------------------------------------------
196 
199  FwIndexType portNum,
201  )
202  {
203  FW_ASSERT(
204  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
205  static_cast<FwAssertArgType>(portNum)
206  );
207 
208  this->m_comStatusOut_OutputPort[portNum].addCallPort(port);
209  }
210 
213  FwIndexType portNum,
215  )
216  {
217  FW_ASSERT(
218  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
219  static_cast<FwAssertArgType>(portNum)
220  );
221 
222  this->m_dataOut_OutputPort[portNum].addCallPort(port);
223  }
224 
227  FwIndexType portNum,
229  )
230  {
231  FW_ASSERT(
232  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
233  static_cast<FwAssertArgType>(portNum)
234  );
235 
236  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
237  }
238 
239 #if FW_PORT_SERIALIZATION
240 
241  // ----------------------------------------------------------------------
242  // Connect serial input ports to typed output ports
243  // ----------------------------------------------------------------------
244 
247  FwIndexType portNum,
248  Fw::InputSerializePort* port
249  )
250  {
251  FW_ASSERT(
252  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
253  static_cast<FwAssertArgType>(portNum)
254  );
255 
256  this->m_comStatusOut_OutputPort[portNum].registerSerialPort(port);
257  }
258 
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  )
264  {
265  FW_ASSERT(
266  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
267  static_cast<FwAssertArgType>(portNum)
268  );
269 
270  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
271  }
272 
275  FwIndexType portNum,
276  Fw::InputSerializePort* port
277  )
278  {
279  FW_ASSERT(
280  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
281  static_cast<FwAssertArgType>(portNum)
282  );
283 
284  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
285  }
286 
287 #endif
288 
289  // ----------------------------------------------------------------------
290  // Component construction and destruction
291  // ----------------------------------------------------------------------
292 
294  ComRetryComponentBase(const char* compName) :
295  Fw::PassiveComponentBase(compName)
296  {
297 
298  }
299 
302  {
303 
304  }
305 
306  // ----------------------------------------------------------------------
307  // Connection status queries for typed output ports
308  // ----------------------------------------------------------------------
309 
312  {
313  FW_ASSERT(
314  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
315  static_cast<FwAssertArgType>(portNum)
316  );
317 
318  return this->m_comStatusOut_OutputPort[portNum].isConnected();
319  }
320 
323  {
324  FW_ASSERT(
325  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
326  static_cast<FwAssertArgType>(portNum)
327  );
328 
329  return this->m_dataOut_OutputPort[portNum].isConnected();
330  }
331 
334  {
335  FW_ASSERT(
336  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
337  static_cast<FwAssertArgType>(portNum)
338  );
339 
340  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
341  }
342 
343  // ----------------------------------------------------------------------
344  // Port handler base-class functions for typed input ports
345  //
346  // Call these functions directly to bypass the corresponding ports
347  // ----------------------------------------------------------------------
348 
351  FwIndexType portNum,
352  Fw::Success& condition
353  )
354  {
355  // Make sure port number is valid
356  FW_ASSERT(
357  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
358  static_cast<FwAssertArgType>(portNum)
359  );
360 
361  // Call handler function
362  this->comStatusIn_handler(
363  portNum,
364  condition
365  );
366  }
367 
370  FwIndexType portNum,
371  Fw::Buffer& data,
372  const ComCfg::FrameContext& context
373  )
374  {
375  // Make sure port number is valid
376  FW_ASSERT(
377  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
378  static_cast<FwAssertArgType>(portNum)
379  );
380 
381  // Call handler function
382  this->dataIn_handler(
383  portNum,
384  data,
385  context
386  );
387  }
388 
391  FwIndexType portNum,
392  Fw::Buffer& data,
393  const ComCfg::FrameContext& context
394  )
395  {
396  // Make sure port number is valid
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  // Call handler function
403  this->dataReturnIn_handler(
404  portNum,
405  data,
406  context
407  );
408  }
409 
410  // ----------------------------------------------------------------------
411  // Invocation functions for typed output ports
412  // ----------------------------------------------------------------------
413 
416  FwIndexType portNum,
417  Fw::Success& condition
418  )
419  {
420  FW_ASSERT(
421  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
422  static_cast<FwAssertArgType>(portNum)
423  );
424 
425  FW_ASSERT(
426  this->m_comStatusOut_OutputPort[portNum].isConnected(),
427  static_cast<FwAssertArgType>(portNum)
428  );
429  this->m_comStatusOut_OutputPort[portNum].invoke(
430  condition
431  );
432  }
433 
436  FwIndexType portNum,
437  Fw::Buffer& data,
438  const ComCfg::FrameContext& context
439  )
440  {
441  FW_ASSERT(
442  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
443  static_cast<FwAssertArgType>(portNum)
444  );
445 
446  FW_ASSERT(
447  this->m_dataOut_OutputPort[portNum].isConnected(),
448  static_cast<FwAssertArgType>(portNum)
449  );
450  this->m_dataOut_OutputPort[portNum].invoke(
451  data,
452  context
453  );
454  }
455 
458  FwIndexType portNum,
459  Fw::Buffer& data,
460  const ComCfg::FrameContext& context
461  )
462  {
463  FW_ASSERT(
464  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
465  static_cast<FwAssertArgType>(portNum)
466  );
467 
468  FW_ASSERT(
469  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
470  static_cast<FwAssertArgType>(portNum)
471  );
472  this->m_dataReturnOut_OutputPort[portNum].invoke(
473  data,
474  context
475  );
476  }
477 
478  // ----------------------------------------------------------------------
479  // Calls for messages received on typed input ports
480  // ----------------------------------------------------------------------
481 
482  void ComRetryComponentBase ::
483  m_p_comStatusIn_in(
484  Fw::PassiveComponentBase* callComp,
485  FwIndexType portNum,
486  Fw::Success& condition
487  )
488  {
489  FW_ASSERT(callComp);
490  ComRetryComponentBase* compPtr = static_cast<ComRetryComponentBase*>(callComp);
491  compPtr->comStatusIn_handlerBase(
492  portNum,
493  condition
494  );
495  }
496 
497  void ComRetryComponentBase ::
498  m_p_dataIn_in(
499  Fw::PassiveComponentBase* callComp,
500  FwIndexType portNum,
501  Fw::Buffer& data,
502  const ComCfg::FrameContext& context
503  )
504  {
505  FW_ASSERT(callComp);
506  ComRetryComponentBase* compPtr = static_cast<ComRetryComponentBase*>(callComp);
507  compPtr->dataIn_handlerBase(
508  portNum,
509  data,
510  context
511  );
512  }
513 
514  void ComRetryComponentBase ::
515  m_p_dataReturnIn_in(
516  Fw::PassiveComponentBase* callComp,
517  FwIndexType portNum,
518  Fw::Buffer& data,
519  const ComCfg::FrameContext& context
520  )
521  {
522  FW_ASSERT(callComp);
523  ComRetryComponentBase* compPtr = static_cast<ComRetryComponentBase*>(callComp);
524  compPtr->dataReturnIn_handlerBase(
525  portNum,
526  data,
527  context
528  );
529  }
530 
531 }
bool isConnected_comStatusOut_OutputPort(FwIndexType portNum)
Auto-generated base for ComRetry component.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
I32 FwEnumStoreType
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
static constexpr FwIndexType getNum_comStatusIn_InputPorts()
void addCallPort(InputSuccessConditionPort *callPort)
Register an input port.
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_dataIn_InputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
static constexpr FwIndexType getNum_dataOut_OutputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
virtual ~ComRetryComponentBase()
Destroy ComRetryComponentBase object.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(Fw::Success &condition) const
Invoke a port interface.
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port interface.
void init()
Initialization function.
bool isConnected() const
Definition: PortBase.cpp:38
#define PRI_FwIndexType
static constexpr FwIndexType getNum_comStatusOut_OutputPorts()
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void setPortNum(FwIndexType portNum)
void init()
Initialization function.
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
void comStatusIn_handlerBase(FwIndexType portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
ComRetryComponentBase(const char *compName="")
Construct ComRetryComponentBase object.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
Implementation of malloc based allocator.
void comStatusOut_out(FwIndexType portNum, Fw::Success &condition)
Invoke output port comStatusOut.
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void init()
Initialization function.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Success/Failure.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
void init()
Initialization function.