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 #if !FW_DIRECT_PORT_CALLS
27  // Connect input port comStatusIn
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_comStatusIn_InputPorts());
31  port++
32  ) {
33  this->m_comStatusIn_InputPort[port].init();
34  this->m_comStatusIn_InputPort[port].addCallComp(
35  this,
36  m_p_comStatusIn_in
37  );
38  this->m_comStatusIn_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_comStatusIn_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_comStatusIn_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51 
52 #if !FW_DIRECT_PORT_CALLS
53  // Connect input port dataIn
54  for (
55  FwIndexType port = 0;
56  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
57  port++
58  ) {
59  this->m_dataIn_InputPort[port].init();
60  this->m_dataIn_InputPort[port].addCallComp(
61  this,
62  m_p_dataIn_in
63  );
64  this->m_dataIn_InputPort[port].setPortNum(port);
65 
66 #if FW_OBJECT_NAMES == 1
67  Fw::ObjectName portName;
68  portName.format(
69  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
70  this->m_objName.toChar(),
71  port
72  );
73  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
74 #endif
75  }
76 #endif
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect input port dataReturnIn
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
83  port++
84  ) {
85  this->m_dataReturnIn_InputPort[port].init();
86  this->m_dataReturnIn_InputPort[port].addCallComp(
87  this,
88  m_p_dataReturnIn_in
89  );
90  this->m_dataReturnIn_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  Fw::ObjectName portName;
94  portName.format(
95  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
96  this->m_objName.toChar(),
97  port
98  );
99  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
100 #endif
101  }
102 #endif
103 
104 #if !FW_DIRECT_PORT_CALLS
105  // Connect output port comStatusOut
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_comStatusOut_OutputPorts());
109  port++
110  ) {
111  this->m_comStatusOut_OutputPort[port].init();
112 
113 #if FW_OBJECT_NAMES == 1
114  Fw::ObjectName portName;
115  portName.format(
116  "%s_comStatusOut_OutputPort[%" PRI_FwIndexType "]",
117  this->m_objName.toChar(),
118  port
119  );
120  this->m_comStatusOut_OutputPort[port].setObjName(portName.toChar());
121 #endif
122  }
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS
126  // Connect output port dataOut
127  for (
128  FwIndexType port = 0;
129  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
130  port++
131  ) {
132  this->m_dataOut_OutputPort[port].init();
133 
134 #if FW_OBJECT_NAMES == 1
135  Fw::ObjectName portName;
136  portName.format(
137  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
138  this->m_objName.toChar(),
139  port
140  );
141  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
142 #endif
143  }
144 #endif
145 
146 #if !FW_DIRECT_PORT_CALLS
147  // Connect output port dataReturnOut
148  for (
149  FwIndexType port = 0;
150  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
151  port++
152  ) {
153  this->m_dataReturnOut_OutputPort[port].init();
154 
155 #if FW_OBJECT_NAMES == 1
156  Fw::ObjectName portName;
157  portName.format(
158  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
159  this->m_objName.toChar(),
160  port
161  );
162  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
163 #endif
164  }
165 #endif
166  }
167 
168 #if !FW_DIRECT_PORT_CALLS
169 
170  // ----------------------------------------------------------------------
171  // Getters for typed input ports
172  // ----------------------------------------------------------------------
173 
176  {
177  FW_ASSERT(
178  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
179  static_cast<FwAssertArgType>(portNum)
180  );
181 
182  return &this->m_comStatusIn_InputPort[portNum];
183  }
184 
187  {
188  FW_ASSERT(
189  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
190  static_cast<FwAssertArgType>(portNum)
191  );
192 
193  return &this->m_dataIn_InputPort[portNum];
194  }
195 
198  {
199  FW_ASSERT(
200  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
201  static_cast<FwAssertArgType>(portNum)
202  );
203 
204  return &this->m_dataReturnIn_InputPort[portNum];
205  }
206 
207 #endif
208 
209 #if !FW_DIRECT_PORT_CALLS
210 
211  // ----------------------------------------------------------------------
212  // Connect typed input ports to typed output ports
213  // ----------------------------------------------------------------------
214 
217  FwIndexType portNum,
219  )
220  {
221  FW_ASSERT(
222  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
223  static_cast<FwAssertArgType>(portNum)
224  );
225 
226  this->m_comStatusOut_OutputPort[portNum].addCallPort(port);
227  }
228 
231  FwIndexType portNum,
233  )
234  {
235  FW_ASSERT(
236  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
237  static_cast<FwAssertArgType>(portNum)
238  );
239 
240  this->m_dataOut_OutputPort[portNum].addCallPort(port);
241  }
242 
245  FwIndexType portNum,
247  )
248  {
249  FW_ASSERT(
250  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
251  static_cast<FwAssertArgType>(portNum)
252  );
253 
254  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
255  }
256 
257 #endif
258 
259 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
260 
261  // ----------------------------------------------------------------------
262  // Connect serial input ports to typed output ports
263  // ----------------------------------------------------------------------
264 
267  FwIndexType portNum,
268  Fw::InputSerializePort* port
269  )
270  {
271  FW_ASSERT(
272  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
273  static_cast<FwAssertArgType>(portNum)
274  );
275 
276  this->m_comStatusOut_OutputPort[portNum].registerSerialPort(port);
277  }
278 
281  FwIndexType portNum,
282  Fw::InputSerializePort* port
283  )
284  {
285  FW_ASSERT(
286  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
287  static_cast<FwAssertArgType>(portNum)
288  );
289 
290  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
291  }
292 
295  FwIndexType portNum,
296  Fw::InputSerializePort* port
297  )
298  {
299  FW_ASSERT(
300  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
301  static_cast<FwAssertArgType>(portNum)
302  );
303 
304  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
305  }
306 
307 #endif
308 
309  // ----------------------------------------------------------------------
310  // Component construction and destruction
311  // ----------------------------------------------------------------------
312 
314  ComRetryComponentBase(const char* compName) :
315  Fw::PassiveComponentBase(compName)
316  {
317 
318  }
319 
322  {
323 
324  }
325 
326 #if !FW_DIRECT_PORT_CALLS
327 
328  // ----------------------------------------------------------------------
329  // Connection status queries for typed output ports
330  // ----------------------------------------------------------------------
331 
334  {
335  FW_ASSERT(
336  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
337  static_cast<FwAssertArgType>(portNum)
338  );
339 
340  return this->m_comStatusOut_OutputPort[portNum].isConnected();
341  }
342 
345  {
346  FW_ASSERT(
347  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
348  static_cast<FwAssertArgType>(portNum)
349  );
350 
351  return this->m_dataOut_OutputPort[portNum].isConnected();
352  }
353 
356  {
357  FW_ASSERT(
358  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
359  static_cast<FwAssertArgType>(portNum)
360  );
361 
362  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
363  }
364 
365 #endif
366 
367  // ----------------------------------------------------------------------
368  // Port handler base-class functions for typed input ports
369  //
370  // Call these functions directly to bypass the corresponding ports
371  // ----------------------------------------------------------------------
372 
375  FwIndexType portNum,
376  Fw::Success& condition
377  )
378  {
379  // Make sure port number is valid
380  FW_ASSERT(
381  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
382  static_cast<FwAssertArgType>(portNum)
383  );
384 
385  // Call handler function
386  this->comStatusIn_handler(
387  portNum,
388  condition
389  );
390  }
391 
394  FwIndexType portNum,
395  Fw::Buffer& data,
396  const ComCfg::FrameContext& context
397  )
398  {
399  // Make sure port number is valid
400  FW_ASSERT(
401  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
402  static_cast<FwAssertArgType>(portNum)
403  );
404 
405  // Call handler function
406  this->dataIn_handler(
407  portNum,
408  data,
409  context
410  );
411  }
412 
415  FwIndexType portNum,
416  Fw::Buffer& data,
417  const ComCfg::FrameContext& context
418  )
419  {
420  // Make sure port number is valid
421  FW_ASSERT(
422  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
423  static_cast<FwAssertArgType>(portNum)
424  );
425 
426  // Call handler function
427  this->dataReturnIn_handler(
428  portNum,
429  data,
430  context
431  );
432  }
433 
434 #if !FW_DIRECT_PORT_CALLS
435 
436  // ----------------------------------------------------------------------
437  // Invocation functions for typed output ports
438  // ----------------------------------------------------------------------
439 
442  FwIndexType portNum,
443  Fw::Success& condition
444  ) const
445  {
446  FW_ASSERT(
447  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
448  static_cast<FwAssertArgType>(portNum)
449  );
450 
451  FW_ASSERT(
452  this->m_comStatusOut_OutputPort[portNum].isConnected(),
453  static_cast<FwAssertArgType>(portNum)
454  );
455  this->m_comStatusOut_OutputPort[portNum].invoke(
456  condition
457  );
458  }
459 
462  FwIndexType portNum,
463  Fw::Buffer& data,
464  const ComCfg::FrameContext& context
465  ) const
466  {
467  FW_ASSERT(
468  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
469  static_cast<FwAssertArgType>(portNum)
470  );
471 
472  FW_ASSERT(
473  this->m_dataOut_OutputPort[portNum].isConnected(),
474  static_cast<FwAssertArgType>(portNum)
475  );
476  this->m_dataOut_OutputPort[portNum].invoke(
477  data,
478  context
479  );
480  }
481 
484  FwIndexType portNum,
485  Fw::Buffer& data,
486  const ComCfg::FrameContext& context
487  ) const
488  {
489  FW_ASSERT(
490  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
491  static_cast<FwAssertArgType>(portNum)
492  );
493 
494  FW_ASSERT(
495  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
496  static_cast<FwAssertArgType>(portNum)
497  );
498  this->m_dataReturnOut_OutputPort[portNum].invoke(
499  data,
500  context
501  );
502  }
503 
504 #endif
505 
506  // ----------------------------------------------------------------------
507  // Calls for messages received on typed input ports
508  // ----------------------------------------------------------------------
509 
510  void ComRetryComponentBase ::
511  m_p_comStatusIn_in(
512  Fw::PassiveComponentBase* callComp,
513  FwIndexType portNum,
514  Fw::Success& condition
515  )
516  {
517  FW_ASSERT(callComp);
518  ComRetryComponentBase* compPtr = static_cast<ComRetryComponentBase*>(callComp);
519  compPtr->comStatusIn_handlerBase(
520  portNum,
521  condition
522  );
523  }
524 
525  void ComRetryComponentBase ::
526  m_p_dataIn_in(
527  Fw::PassiveComponentBase* callComp,
528  FwIndexType portNum,
529  Fw::Buffer& data,
530  const ComCfg::FrameContext& context
531  )
532  {
533  FW_ASSERT(callComp);
534  ComRetryComponentBase* compPtr = static_cast<ComRetryComponentBase*>(callComp);
535  compPtr->dataIn_handlerBase(
536  portNum,
537  data,
538  context
539  );
540  }
541 
542  void ComRetryComponentBase ::
543  m_p_dataReturnIn_in(
544  Fw::PassiveComponentBase* callComp,
545  FwIndexType portNum,
546  Fw::Buffer& data,
547  const ComCfg::FrameContext& context
548  )
549  {
550  FW_ASSERT(callComp);
551  ComRetryComponentBase* compPtr = static_cast<ComRetryComponentBase*>(callComp);
552  compPtr->dataReturnIn_handlerBase(
553  portNum,
554  data,
555  context
556  );
557  }
558 
559 }
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_comStatusOut_OutputPort(FwIndexType portNum) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
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 dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
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.
void invoke(Fw::Success &condition) const
Invoke a port connection.
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
void init()
Initialization function.
const char * toChar() const
Convert to a C-style char*.
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.
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
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
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)
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
Implementation of malloc based allocator.
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 comStatusOut_out(FwIndexType portNum, Fw::Success &condition) const
Invoke output port comStatusOut.
void init()
Initialization function.