F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
GenericHubComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title GenericHubComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for GenericHub 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 
15 namespace Svc {
16 
17  // ----------------------------------------------------------------------
18  // Component initialization
19  // ----------------------------------------------------------------------
20 
22  init(NATIVE_INT_TYPE instance)
23  {
24  // Initialize base class
26 
27  // Connect input port LogRecv
28  for (
29  PlatformIntType port = 0;
30  port < static_cast<PlatformIntType>(this->getNum_LogRecv_InputPorts());
31  port++
32  ) {
33  this->m_LogRecv_InputPort[port].init();
34  this->m_LogRecv_InputPort[port].addCallComp(
35  this,
36  m_p_LogRecv_in
37  );
38  this->m_LogRecv_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  // The port name consists of this->m_objName and some extra info.
42  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
43  // However, the compiler may assume that this->m_objName fills
44  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
45  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
46  // bytes to cover the extra info.
47  char portName[2*FW_OBJ_NAME_MAX_SIZE];
48  (void) snprintf(
49  portName,
50  sizeof(portName),
51  "%s_LogRecv_InputPort[%" PRI_PlatformIntType "]",
52  this->m_objName,
53  port
54  );
55  this->m_LogRecv_InputPort[port].setObjName(portName);
56 #endif
57  }
58 
59  // Connect input port TlmRecv
60  for (
61  PlatformIntType port = 0;
62  port < static_cast<PlatformIntType>(this->getNum_TlmRecv_InputPorts());
63  port++
64  ) {
65  this->m_TlmRecv_InputPort[port].init();
66  this->m_TlmRecv_InputPort[port].addCallComp(
67  this,
68  m_p_TlmRecv_in
69  );
70  this->m_TlmRecv_InputPort[port].setPortNum(port);
71 
72 #if FW_OBJECT_NAMES == 1
73  // The port name consists of this->m_objName and some extra info.
74  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
75  // However, the compiler may assume that this->m_objName fills
76  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
77  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
78  // bytes to cover the extra info.
79  char portName[2*FW_OBJ_NAME_MAX_SIZE];
80  (void) snprintf(
81  portName,
82  sizeof(portName),
83  "%s_TlmRecv_InputPort[%" PRI_PlatformIntType "]",
84  this->m_objName,
85  port
86  );
87  this->m_TlmRecv_InputPort[port].setObjName(portName);
88 #endif
89  }
90 
91  // Connect input port buffersIn
92  for (
93  PlatformIntType port = 0;
94  port < static_cast<PlatformIntType>(this->getNum_buffersIn_InputPorts());
95  port++
96  ) {
97  this->m_buffersIn_InputPort[port].init();
98  this->m_buffersIn_InputPort[port].addCallComp(
99  this,
100  m_p_buffersIn_in
101  );
102  this->m_buffersIn_InputPort[port].setPortNum(port);
103 
104 #if FW_OBJECT_NAMES == 1
105  // The port name consists of this->m_objName and some extra info.
106  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
107  // However, the compiler may assume that this->m_objName fills
108  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
109  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
110  // bytes to cover the extra info.
111  char portName[2*FW_OBJ_NAME_MAX_SIZE];
112  (void) snprintf(
113  portName,
114  sizeof(portName),
115  "%s_buffersIn_InputPort[%" PRI_PlatformIntType "]",
116  this->m_objName,
117  port
118  );
119  this->m_buffersIn_InputPort[port].setObjName(portName);
120 #endif
121  }
122 
123  // Connect input port dataIn
124  for (
125  PlatformIntType port = 0;
126  port < static_cast<PlatformIntType>(this->getNum_dataIn_InputPorts());
127  port++
128  ) {
129  this->m_dataIn_InputPort[port].init();
130  this->m_dataIn_InputPort[port].addCallComp(
131  this,
132  m_p_dataIn_in
133  );
134  this->m_dataIn_InputPort[port].setPortNum(port);
135 
136 #if FW_OBJECT_NAMES == 1
137  // The port name consists of this->m_objName and some extra info.
138  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
139  // However, the compiler may assume that this->m_objName fills
140  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
141  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
142  // bytes to cover the extra info.
143  char portName[2*FW_OBJ_NAME_MAX_SIZE];
144  (void) snprintf(
145  portName,
146  sizeof(portName),
147  "%s_dataIn_InputPort[%" PRI_PlatformIntType "]",
148  this->m_objName,
149  port
150  );
151  this->m_dataIn_InputPort[port].setObjName(portName);
152 #endif
153  }
154 
155  // Connect input port portIn
156  for (
157  PlatformIntType port = 0;
158  port < static_cast<PlatformIntType>(this->getNum_portIn_InputPorts());
159  port++
160  ) {
161  this->m_portIn_InputPort[port].init();
162  this->m_portIn_InputPort[port].addCallComp(
163  this,
164  m_p_portIn_in
165  );
166  this->m_portIn_InputPort[port].setPortNum(port);
167 
168 #if FW_OBJECT_NAMES == 1
169  // The port name consists of this->m_objName and some extra info.
170  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
171  // However, the compiler may assume that this->m_objName fills
172  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
173  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
174  // bytes to cover the extra info.
175  char portName[2*FW_OBJ_NAME_MAX_SIZE];
176  (void) snprintf(
177  portName,
178  sizeof(portName),
179  "%s_portIn_InputPort[%" PRI_PlatformIntType "]",
180  this->m_objName,
181  port
182  );
183  this->m_portIn_InputPort[port].setObjName(portName);
184 #endif
185  }
186 
187  // Connect output port LogSend
188  for (
189  PlatformIntType port = 0;
190  port < static_cast<PlatformIntType>(this->getNum_LogSend_OutputPorts());
191  port++
192  ) {
193  this->m_LogSend_OutputPort[port].init();
194 
195 #if FW_OBJECT_NAMES == 1
196  // The port name consists of this->m_objName and some extra info.
197  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
198  // However, the compiler may assume that this->m_objName fills
199  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
200  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
201  // bytes to cover the extra info.
202  char portName[2*FW_OBJ_NAME_MAX_SIZE];
203  (void) snprintf(
204  portName,
205  sizeof(portName),
206  "%s_LogSend_OutputPort[%" PRI_PlatformIntType "]",
207  this->m_objName,
208  port
209  );
210  this->m_LogSend_OutputPort[port].setObjName(portName);
211 #endif
212  }
213 
214  // Connect output port TlmSend
215  for (
216  PlatformIntType port = 0;
217  port < static_cast<PlatformIntType>(this->getNum_TlmSend_OutputPorts());
218  port++
219  ) {
220  this->m_TlmSend_OutputPort[port].init();
221 
222 #if FW_OBJECT_NAMES == 1
223  // The port name consists of this->m_objName and some extra info.
224  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
225  // However, the compiler may assume that this->m_objName fills
226  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
227  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
228  // bytes to cover the extra info.
229  char portName[2*FW_OBJ_NAME_MAX_SIZE];
230  (void) snprintf(
231  portName,
232  sizeof(portName),
233  "%s_TlmSend_OutputPort[%" PRI_PlatformIntType "]",
234  this->m_objName,
235  port
236  );
237  this->m_TlmSend_OutputPort[port].setObjName(portName);
238 #endif
239  }
240 
241  // Connect output port bufferDeallocate
242  for (
243  PlatformIntType port = 0;
244  port < static_cast<PlatformIntType>(this->getNum_bufferDeallocate_OutputPorts());
245  port++
246  ) {
247  this->m_bufferDeallocate_OutputPort[port].init();
248 
249 #if FW_OBJECT_NAMES == 1
250  // The port name consists of this->m_objName and some extra info.
251  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
252  // However, the compiler may assume that this->m_objName fills
253  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
254  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
255  // bytes to cover the extra info.
256  char portName[2*FW_OBJ_NAME_MAX_SIZE];
257  (void) snprintf(
258  portName,
259  sizeof(portName),
260  "%s_bufferDeallocate_OutputPort[%" PRI_PlatformIntType "]",
261  this->m_objName,
262  port
263  );
264  this->m_bufferDeallocate_OutputPort[port].setObjName(portName);
265 #endif
266  }
267 
268  // Connect output port buffersOut
269  for (
270  PlatformIntType port = 0;
271  port < static_cast<PlatformIntType>(this->getNum_buffersOut_OutputPorts());
272  port++
273  ) {
274  this->m_buffersOut_OutputPort[port].init();
275 
276 #if FW_OBJECT_NAMES == 1
277  // The port name consists of this->m_objName and some extra info.
278  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
279  // However, the compiler may assume that this->m_objName fills
280  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
281  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
282  // bytes to cover the extra info.
283  char portName[2*FW_OBJ_NAME_MAX_SIZE];
284  (void) snprintf(
285  portName,
286  sizeof(portName),
287  "%s_buffersOut_OutputPort[%" PRI_PlatformIntType "]",
288  this->m_objName,
289  port
290  );
291  this->m_buffersOut_OutputPort[port].setObjName(portName);
292 #endif
293  }
294 
295  // Connect output port dataInDeallocate
296  for (
297  PlatformIntType port = 0;
298  port < static_cast<PlatformIntType>(this->getNum_dataInDeallocate_OutputPorts());
299  port++
300  ) {
301  this->m_dataInDeallocate_OutputPort[port].init();
302 
303 #if FW_OBJECT_NAMES == 1
304  // The port name consists of this->m_objName and some extra info.
305  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
306  // However, the compiler may assume that this->m_objName fills
307  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
308  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
309  // bytes to cover the extra info.
310  char portName[2*FW_OBJ_NAME_MAX_SIZE];
311  (void) snprintf(
312  portName,
313  sizeof(portName),
314  "%s_dataInDeallocate_OutputPort[%" PRI_PlatformIntType "]",
315  this->m_objName,
316  port
317  );
318  this->m_dataInDeallocate_OutputPort[port].setObjName(portName);
319 #endif
320  }
321 
322  // Connect output port dataOut
323  for (
324  PlatformIntType port = 0;
325  port < static_cast<PlatformIntType>(this->getNum_dataOut_OutputPorts());
326  port++
327  ) {
328  this->m_dataOut_OutputPort[port].init();
329 
330 #if FW_OBJECT_NAMES == 1
331  // The port name consists of this->m_objName and some extra info.
332  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
333  // However, the compiler may assume that this->m_objName fills
334  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
335  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
336  // bytes to cover the extra info.
337  char portName[2*FW_OBJ_NAME_MAX_SIZE];
338  (void) snprintf(
339  portName,
340  sizeof(portName),
341  "%s_dataOut_OutputPort[%" PRI_PlatformIntType "]",
342  this->m_objName,
343  port
344  );
345  this->m_dataOut_OutputPort[port].setObjName(portName);
346 #endif
347  }
348 
349  // Connect output port dataOutAllocate
350  for (
351  PlatformIntType port = 0;
352  port < static_cast<PlatformIntType>(this->getNum_dataOutAllocate_OutputPorts());
353  port++
354  ) {
355  this->m_dataOutAllocate_OutputPort[port].init();
356 
357 #if FW_OBJECT_NAMES == 1
358  // The port name consists of this->m_objName and some extra info.
359  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
360  // However, the compiler may assume that this->m_objName fills
361  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
362  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
363  // bytes to cover the extra info.
364  char portName[2*FW_OBJ_NAME_MAX_SIZE];
365  (void) snprintf(
366  portName,
367  sizeof(portName),
368  "%s_dataOutAllocate_OutputPort[%" PRI_PlatformIntType "]",
369  this->m_objName,
370  port
371  );
372  this->m_dataOutAllocate_OutputPort[port].setObjName(portName);
373 #endif
374  }
375 
376  // Connect output port portOut
377  for (
378  PlatformIntType port = 0;
379  port < static_cast<PlatformIntType>(this->getNum_portOut_OutputPorts());
380  port++
381  ) {
382  this->m_portOut_OutputPort[port].init();
383 
384 #if FW_OBJECT_NAMES == 1
385  // The port name consists of this->m_objName and some extra info.
386  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
387  // However, the compiler may assume that this->m_objName fills
388  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
389  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
390  // bytes to cover the extra info.
391  char portName[2*FW_OBJ_NAME_MAX_SIZE];
392  (void) snprintf(
393  portName,
394  sizeof(portName),
395  "%s_portOut_OutputPort[%" PRI_PlatformIntType "]",
396  this->m_objName,
397  port
398  );
399  this->m_portOut_OutputPort[port].setObjName(portName);
400 #endif
401  }
402  }
403 
404  // ----------------------------------------------------------------------
405  // Getters for typed input ports
406  // ----------------------------------------------------------------------
407 
410  {
411  FW_ASSERT(
412  portNum < this->getNum_LogRecv_InputPorts(),
413  static_cast<FwAssertArgType>(portNum)
414  );
415 
416  return &this->m_LogRecv_InputPort[portNum];
417  }
418 
421  {
422  FW_ASSERT(
423  portNum < this->getNum_TlmRecv_InputPorts(),
424  static_cast<FwAssertArgType>(portNum)
425  );
426 
427  return &this->m_TlmRecv_InputPort[portNum];
428  }
429 
432  {
433  FW_ASSERT(
434  portNum < this->getNum_buffersIn_InputPorts(),
435  static_cast<FwAssertArgType>(portNum)
436  );
437 
438  return &this->m_buffersIn_InputPort[portNum];
439  }
440 
443  {
444  FW_ASSERT(
445  portNum < this->getNum_dataIn_InputPorts(),
446  static_cast<FwAssertArgType>(portNum)
447  );
448 
449  return &this->m_dataIn_InputPort[portNum];
450  }
451 
452  // ----------------------------------------------------------------------
453  // Getters for serial input ports
454  // ----------------------------------------------------------------------
455 
456  Fw::InputSerializePort* GenericHubComponentBase ::
458  {
459  FW_ASSERT(
460  portNum < this->getNum_portIn_InputPorts(),
461  static_cast<FwAssertArgType>(portNum)
462  );
463 
464  return &this->m_portIn_InputPort[portNum];
465  }
466 
467  // ----------------------------------------------------------------------
468  // Connect typed input ports to typed output ports
469  // ----------------------------------------------------------------------
470 
473  NATIVE_INT_TYPE portNum,
474  Fw::InputLogPort* port
475  )
476  {
477  FW_ASSERT(
478  portNum < this->getNum_LogSend_OutputPorts(),
479  static_cast<FwAssertArgType>(portNum)
480  );
481 
482  this->m_LogSend_OutputPort[portNum].addCallPort(port);
483  }
484 
487  NATIVE_INT_TYPE portNum,
488  Fw::InputTlmPort* port
489  )
490  {
491  FW_ASSERT(
492  portNum < this->getNum_TlmSend_OutputPorts(),
493  static_cast<FwAssertArgType>(portNum)
494  );
495 
496  this->m_TlmSend_OutputPort[portNum].addCallPort(port);
497  }
498 
501  NATIVE_INT_TYPE portNum,
503  )
504  {
505  FW_ASSERT(
506  portNum < this->getNum_bufferDeallocate_OutputPorts(),
507  static_cast<FwAssertArgType>(portNum)
508  );
509 
510  this->m_bufferDeallocate_OutputPort[portNum].addCallPort(port);
511  }
512 
515  NATIVE_INT_TYPE portNum,
517  )
518  {
519  FW_ASSERT(
520  portNum < this->getNum_buffersOut_OutputPorts(),
521  static_cast<FwAssertArgType>(portNum)
522  );
523 
524  this->m_buffersOut_OutputPort[portNum].addCallPort(port);
525  }
526 
529  NATIVE_INT_TYPE portNum,
531  )
532  {
533  FW_ASSERT(
534  portNum < this->getNum_dataInDeallocate_OutputPorts(),
535  static_cast<FwAssertArgType>(portNum)
536  );
537 
538  this->m_dataInDeallocate_OutputPort[portNum].addCallPort(port);
539  }
540 
543  NATIVE_INT_TYPE portNum,
545  )
546  {
547  FW_ASSERT(
548  portNum < this->getNum_dataOut_OutputPorts(),
549  static_cast<FwAssertArgType>(portNum)
550  );
551 
552  this->m_dataOut_OutputPort[portNum].addCallPort(port);
553  }
554 
557  NATIVE_INT_TYPE portNum,
559  )
560  {
561  FW_ASSERT(
562  portNum < this->getNum_dataOutAllocate_OutputPorts(),
563  static_cast<FwAssertArgType>(portNum)
564  );
565 
566  this->m_dataOutAllocate_OutputPort[portNum].addCallPort(port);
567  }
568 
569 #if FW_PORT_SERIALIZATION
570 
571  // ----------------------------------------------------------------------
572  // Connect serial input ports to typed output ports
573  // ----------------------------------------------------------------------
574 
577  NATIVE_INT_TYPE portNum,
578  Fw::InputSerializePort* port
579  )
580  {
581  FW_ASSERT(
582  portNum < this->getNum_LogSend_OutputPorts(),
583  static_cast<FwAssertArgType>(portNum)
584  );
585 
586  this->m_LogSend_OutputPort[portNum].registerSerialPort(port);
587  }
588 
591  NATIVE_INT_TYPE portNum,
592  Fw::InputSerializePort* port
593  )
594  {
595  FW_ASSERT(
596  portNum < this->getNum_TlmSend_OutputPorts(),
597  static_cast<FwAssertArgType>(portNum)
598  );
599 
600  this->m_TlmSend_OutputPort[portNum].registerSerialPort(port);
601  }
602 
605  NATIVE_INT_TYPE portNum,
606  Fw::InputSerializePort* port
607  )
608  {
609  FW_ASSERT(
610  portNum < this->getNum_bufferDeallocate_OutputPorts(),
611  static_cast<FwAssertArgType>(portNum)
612  );
613 
614  this->m_bufferDeallocate_OutputPort[portNum].registerSerialPort(port);
615  }
616 
619  NATIVE_INT_TYPE portNum,
620  Fw::InputSerializePort* port
621  )
622  {
623  FW_ASSERT(
624  portNum < this->getNum_buffersOut_OutputPorts(),
625  static_cast<FwAssertArgType>(portNum)
626  );
627 
628  this->m_buffersOut_OutputPort[portNum].registerSerialPort(port);
629  }
630 
633  NATIVE_INT_TYPE portNum,
634  Fw::InputSerializePort* port
635  )
636  {
637  FW_ASSERT(
638  portNum < this->getNum_dataInDeallocate_OutputPorts(),
639  static_cast<FwAssertArgType>(portNum)
640  );
641 
642  this->m_dataInDeallocate_OutputPort[portNum].registerSerialPort(port);
643  }
644 
647  NATIVE_INT_TYPE portNum,
648  Fw::InputSerializePort* port
649  )
650  {
651  FW_ASSERT(
652  portNum < this->getNum_dataOut_OutputPorts(),
653  static_cast<FwAssertArgType>(portNum)
654  );
655 
656  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
657  }
658 
659 #endif
660 
661 #if FW_PORT_SERIALIZATION
662 
663  // ----------------------------------------------------------------------
664  // Connect serial input ports to serial output ports
665  // ----------------------------------------------------------------------
666 
667  void GenericHubComponentBase ::
668  set_portOut_OutputPort(
669  NATIVE_INT_TYPE portNum,
670  Fw::InputPortBase* port
671  )
672  {
673  FW_ASSERT(
674  portNum < this->getNum_portOut_OutputPorts(),
675  static_cast<FwAssertArgType>(portNum)
676  );
677 
678  this->m_portOut_OutputPort[portNum].registerSerialPort(port);
679  }
680 
681 #endif
682 
683  // ----------------------------------------------------------------------
684  // Component construction and destruction
685  // ----------------------------------------------------------------------
686 
688  GenericHubComponentBase(const char* compName) :
689  Fw::PassiveComponentBase(compName)
690  {
691 
692  }
693 
696  {
697 
698  }
699 
700  // ----------------------------------------------------------------------
701  // Getters for numbers of typed input ports
702  // ----------------------------------------------------------------------
703 
706  {
707  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogRecv_InputPort));
708  }
709 
712  {
713  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_TlmRecv_InputPort));
714  }
715 
718  {
719  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_buffersIn_InputPort));
720  }
721 
724  {
725  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dataIn_InputPort));
726  }
727 
728  // ----------------------------------------------------------------------
729  // Getters for numbers of serial input ports
730  // ----------------------------------------------------------------------
731 
734  {
735  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_portIn_InputPort));
736  }
737 
738  // ----------------------------------------------------------------------
739  // Getters for numbers of typed output ports
740  // ----------------------------------------------------------------------
741 
744  {
745  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogSend_OutputPort));
746  }
747 
750  {
751  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_TlmSend_OutputPort));
752  }
753 
756  {
757  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferDeallocate_OutputPort));
758  }
759 
762  {
763  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_buffersOut_OutputPort));
764  }
765 
768  {
769  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dataInDeallocate_OutputPort));
770  }
771 
774  {
775  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dataOut_OutputPort));
776  }
777 
780  {
781  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dataOutAllocate_OutputPort));
782  }
783 
784  // ----------------------------------------------------------------------
785  // Getters for numbers of serial output ports
786  // ----------------------------------------------------------------------
787 
790  {
791  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_portOut_OutputPort));
792  }
793 
794  // ----------------------------------------------------------------------
795  // Connection status queries for typed output ports
796  // ----------------------------------------------------------------------
797 
800  {
801  FW_ASSERT(
802  portNum < this->getNum_LogSend_OutputPorts(),
803  static_cast<FwAssertArgType>(portNum)
804  );
805 
806  return this->m_LogSend_OutputPort[portNum].isConnected();
807  }
808 
811  {
812  FW_ASSERT(
813  portNum < this->getNum_TlmSend_OutputPorts(),
814  static_cast<FwAssertArgType>(portNum)
815  );
816 
817  return this->m_TlmSend_OutputPort[portNum].isConnected();
818  }
819 
822  {
823  FW_ASSERT(
824  portNum < this->getNum_bufferDeallocate_OutputPorts(),
825  static_cast<FwAssertArgType>(portNum)
826  );
827 
828  return this->m_bufferDeallocate_OutputPort[portNum].isConnected();
829  }
830 
833  {
834  FW_ASSERT(
835  portNum < this->getNum_buffersOut_OutputPorts(),
836  static_cast<FwAssertArgType>(portNum)
837  );
838 
839  return this->m_buffersOut_OutputPort[portNum].isConnected();
840  }
841 
844  {
845  FW_ASSERT(
846  portNum < this->getNum_dataInDeallocate_OutputPorts(),
847  static_cast<FwAssertArgType>(portNum)
848  );
849 
850  return this->m_dataInDeallocate_OutputPort[portNum].isConnected();
851  }
852 
855  {
856  FW_ASSERT(
857  portNum < this->getNum_dataOut_OutputPorts(),
858  static_cast<FwAssertArgType>(portNum)
859  );
860 
861  return this->m_dataOut_OutputPort[portNum].isConnected();
862  }
863 
866  {
867  FW_ASSERT(
868  portNum < this->getNum_dataOutAllocate_OutputPorts(),
869  static_cast<FwAssertArgType>(portNum)
870  );
871 
872  return this->m_dataOutAllocate_OutputPort[portNum].isConnected();
873  }
874 
875  // ----------------------------------------------------------------------
876  // Connection status queries for serial output ports
877  // ----------------------------------------------------------------------
878 
881  {
882  FW_ASSERT(
883  portNum < this->getNum_portOut_OutputPorts(),
884  static_cast<FwAssertArgType>(portNum)
885  );
886 
887  return this->m_portOut_OutputPort[portNum].isConnected();
888  }
889 
890  // ----------------------------------------------------------------------
891  // Port handler base-class functions for typed input ports
892  //
893  // Call these functions directly to bypass the corresponding ports
894  // ----------------------------------------------------------------------
895 
898  NATIVE_INT_TYPE portNum,
899  FwEventIdType id,
900  Fw::Time& timeTag,
901  const Fw::LogSeverity& severity,
902  Fw::LogBuffer& args
903  )
904  {
905  // Make sure port number is valid
906  FW_ASSERT(
907  portNum < this->getNum_LogRecv_InputPorts(),
908  static_cast<FwAssertArgType>(portNum)
909  );
910 
911  // Call handler function
912  this->LogRecv_handler(
913  portNum,
914  id,
915  timeTag,
916  severity,
917  args
918  );
919  }
920 
923  NATIVE_INT_TYPE portNum,
924  FwChanIdType id,
925  Fw::Time& timeTag,
926  Fw::TlmBuffer& val
927  )
928  {
929  // Make sure port number is valid
930  FW_ASSERT(
931  portNum < this->getNum_TlmRecv_InputPorts(),
932  static_cast<FwAssertArgType>(portNum)
933  );
934 
935  // Call handler function
936  this->TlmRecv_handler(
937  portNum,
938  id,
939  timeTag,
940  val
941  );
942  }
943 
946  NATIVE_INT_TYPE portNum,
947  Fw::Buffer& fwBuffer
948  )
949  {
950  // Make sure port number is valid
951  FW_ASSERT(
952  portNum < this->getNum_buffersIn_InputPorts(),
953  static_cast<FwAssertArgType>(portNum)
954  );
955 
956  // Call handler function
957  this->buffersIn_handler(
958  portNum,
959  fwBuffer
960  );
961  }
962 
965  NATIVE_INT_TYPE portNum,
966  Fw::Buffer& fwBuffer
967  )
968  {
969  // Make sure port number is valid
970  FW_ASSERT(
971  portNum < this->getNum_dataIn_InputPorts(),
972  static_cast<FwAssertArgType>(portNum)
973  );
974 
975  // Call handler function
976  this->dataIn_handler(
977  portNum,
978  fwBuffer
979  );
980  }
981 
982  // ----------------------------------------------------------------------
983  // Port handler base-class functions for serial input ports
984  //
985  // Call these functions directly to bypass the corresponding ports
986  // ----------------------------------------------------------------------
987 
990  NATIVE_INT_TYPE portNum,
992  )
993  {
994  // Make sure port number is valid
995  FW_ASSERT(
996  portNum < this->getNum_portIn_InputPorts(),
997  static_cast<FwAssertArgType>(portNum)
998  );
999 
1000  // Call handler function
1001  this->portIn_handler(
1002  portNum,
1003  buffer
1004  );
1005  }
1006 
1007  // ----------------------------------------------------------------------
1008  // Invocation functions for typed output ports
1009  // ----------------------------------------------------------------------
1010 
1012  LogSend_out(
1013  NATIVE_INT_TYPE portNum,
1014  FwEventIdType id,
1015  Fw::Time& timeTag,
1016  const Fw::LogSeverity& severity,
1017  Fw::LogBuffer& args
1018  )
1019  {
1020  FW_ASSERT(
1021  portNum < this->getNum_LogSend_OutputPorts(),
1022  static_cast<FwAssertArgType>(portNum)
1023  );
1024  this->m_LogSend_OutputPort[portNum].invoke(
1025  id,
1026  timeTag,
1027  severity,
1028  args
1029  );
1030  }
1031 
1033  TlmSend_out(
1034  NATIVE_INT_TYPE portNum,
1035  FwChanIdType id,
1036  Fw::Time& timeTag,
1037  Fw::TlmBuffer& val
1038  )
1039  {
1040  FW_ASSERT(
1041  portNum < this->getNum_TlmSend_OutputPorts(),
1042  static_cast<FwAssertArgType>(portNum)
1043  );
1044  this->m_TlmSend_OutputPort[portNum].invoke(
1045  id,
1046  timeTag,
1047  val
1048  );
1049  }
1050 
1053  NATIVE_INT_TYPE portNum,
1054  Fw::Buffer& fwBuffer
1055  )
1056  {
1057  FW_ASSERT(
1058  portNum < this->getNum_bufferDeallocate_OutputPorts(),
1059  static_cast<FwAssertArgType>(portNum)
1060  );
1061  this->m_bufferDeallocate_OutputPort[portNum].invoke(
1062  fwBuffer
1063  );
1064  }
1065 
1068  NATIVE_INT_TYPE portNum,
1069  Fw::Buffer& fwBuffer
1070  )
1071  {
1072  FW_ASSERT(
1073  portNum < this->getNum_buffersOut_OutputPorts(),
1074  static_cast<FwAssertArgType>(portNum)
1075  );
1076  this->m_buffersOut_OutputPort[portNum].invoke(
1077  fwBuffer
1078  );
1079  }
1080 
1083  NATIVE_INT_TYPE portNum,
1084  Fw::Buffer& fwBuffer
1085  )
1086  {
1087  FW_ASSERT(
1088  portNum < this->getNum_dataInDeallocate_OutputPorts(),
1089  static_cast<FwAssertArgType>(portNum)
1090  );
1091  this->m_dataInDeallocate_OutputPort[portNum].invoke(
1092  fwBuffer
1093  );
1094  }
1095 
1097  dataOut_out(
1098  NATIVE_INT_TYPE portNum,
1099  Fw::Buffer& fwBuffer
1100  )
1101  {
1102  FW_ASSERT(
1103  portNum < this->getNum_dataOut_OutputPorts(),
1104  static_cast<FwAssertArgType>(portNum)
1105  );
1106  this->m_dataOut_OutputPort[portNum].invoke(
1107  fwBuffer
1108  );
1109  }
1110 
1113  NATIVE_INT_TYPE portNum,
1114  U32 size
1115  )
1116  {
1117  FW_ASSERT(
1118  portNum < this->getNum_dataOutAllocate_OutputPorts(),
1119  static_cast<FwAssertArgType>(portNum)
1120  );
1121  return this->m_dataOutAllocate_OutputPort[portNum].invoke(
1122  size
1123  );
1124  }
1125 
1126  // ----------------------------------------------------------------------
1127  // Invocation functions for serial output ports
1128  // ----------------------------------------------------------------------
1129 
1131  portOut_out(
1132  NATIVE_INT_TYPE portNum,
1133  Fw::SerializeBufferBase& buffer
1134  )
1135  {
1136  FW_ASSERT(
1137  portNum < this->getNum_portOut_OutputPorts(),
1138  static_cast<FwAssertArgType>(portNum)
1139  );
1140  return this->m_portOut_OutputPort[portNum].invokeSerial(
1141  buffer
1142  );
1143  }
1144 
1145  // ----------------------------------------------------------------------
1146  // Calls for messages received on typed input ports
1147  // ----------------------------------------------------------------------
1148 
1149  void GenericHubComponentBase ::
1150  m_p_LogRecv_in(
1151  Fw::PassiveComponentBase* callComp,
1152  NATIVE_INT_TYPE portNum,
1153  FwEventIdType id,
1154  Fw::Time& timeTag,
1155  const Fw::LogSeverity& severity,
1156  Fw::LogBuffer& args
1157  )
1158  {
1159  FW_ASSERT(callComp);
1160  GenericHubComponentBase* compPtr = static_cast<GenericHubComponentBase*>(callComp);
1161  compPtr->LogRecv_handlerBase(
1162  portNum,
1163  id,
1164  timeTag,
1165  severity,
1166  args
1167  );
1168  }
1169 
1170  void GenericHubComponentBase ::
1171  m_p_TlmRecv_in(
1172  Fw::PassiveComponentBase* callComp,
1173  NATIVE_INT_TYPE portNum,
1174  FwChanIdType id,
1175  Fw::Time& timeTag,
1176  Fw::TlmBuffer& val
1177  )
1178  {
1179  FW_ASSERT(callComp);
1180  GenericHubComponentBase* compPtr = static_cast<GenericHubComponentBase*>(callComp);
1181  compPtr->TlmRecv_handlerBase(
1182  portNum,
1183  id,
1184  timeTag,
1185  val
1186  );
1187  }
1188 
1189  void GenericHubComponentBase ::
1190  m_p_buffersIn_in(
1191  Fw::PassiveComponentBase* callComp,
1192  NATIVE_INT_TYPE portNum,
1193  Fw::Buffer& fwBuffer
1194  )
1195  {
1196  FW_ASSERT(callComp);
1197  GenericHubComponentBase* compPtr = static_cast<GenericHubComponentBase*>(callComp);
1198  compPtr->buffersIn_handlerBase(
1199  portNum,
1200  fwBuffer
1201  );
1202  }
1203 
1204  void GenericHubComponentBase ::
1205  m_p_dataIn_in(
1206  Fw::PassiveComponentBase* callComp,
1207  NATIVE_INT_TYPE portNum,
1208  Fw::Buffer& fwBuffer
1209  )
1210  {
1211  FW_ASSERT(callComp);
1212  GenericHubComponentBase* compPtr = static_cast<GenericHubComponentBase*>(callComp);
1213  compPtr->dataIn_handlerBase(
1214  portNum,
1215  fwBuffer
1216  );
1217  }
1218 
1219  // ----------------------------------------------------------------------
1220  // Calls for messages received on serial input ports
1221  // ----------------------------------------------------------------------
1222 
1223 #if FW_PORT_SERIALIZATION
1224 
1225  void GenericHubComponentBase ::
1226  m_p_portIn_in(
1227  Fw::PassiveComponentBase* callComp,
1228  NATIVE_INT_TYPE portNum,
1229  Fw::SerializeBufferBase& buffer
1230  )
1231  {
1232  FW_ASSERT(callComp);
1233  GenericHubComponentBase* compPtr = static_cast<GenericHubComponentBase*>(callComp);
1234  compPtr->portIn_handlerBase(
1235  portNum,
1236  buffer
1237  );
1238  }
1239 
1240 #endif
1241 
1242 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
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 FwChanIdType
Definition: FpConfig.h:59
U32 FwEventIdType
Definition: FpConfig.h:62
#define FW_OBJ_NAME_MAX_SIZE
Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80.
Definition: FpConfig.h:184
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: LogPortAc.cpp:62
void init()
Initialization function.
Definition: LogPortAc.cpp:56
void setPortNum(NATIVE_INT_TYPE portNum)
void init()
Initialization function.
Definition: TlmPortAc.cpp:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TlmPortAc.cpp:62
Enum representing event severity.
void init()
Object initializer.
Definition: ObjBase.cpp:27
void init()
Initialization function.
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
Fw::Buffer invoke(U32 size)
Invoke a port interface.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Buffer &fwBuffer)
Invoke a port interface.
void init()
Initialization function.
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Invoke a port interface.
Definition: LogPortAc.cpp:170
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected()
Definition: PortBase.cpp:41
Definition: Time.hpp:9
Auto-generated base for GenericHub component.
void TlmRecv_handlerBase(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
void dataInDeallocate_out(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Invoke output port dataInDeallocate.
void dataIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port dataIn.
NATIVE_INT_TYPE getNum_dataIn_InputPorts() const
bool isConnected_dataOut_OutputPort(NATIVE_INT_TYPE portNum)
void set_buffersOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferSendPort *port)
Connect port to buffersOut[portNum].
virtual void dataIn_handler(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)=0
Handler for input port dataIn.
virtual void buffersIn_handler(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)=0
Handler for input port buffersIn.
bool isConnected_TlmSend_OutputPort(NATIVE_INT_TYPE portNum)
void bufferDeallocate_out(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferDeallocate.
void set_bufferDeallocate_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
NATIVE_INT_TYPE getNum_TlmSend_OutputPorts() const
NATIVE_INT_TYPE getNum_buffersIn_InputPorts() const
bool isConnected_dataOutAllocate_OutputPort(NATIVE_INT_TYPE portNum)
void TlmSend_out(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke output port TlmSend.
void set_LogSend_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputLogPort *port)
Connect port to LogSend[portNum].
void LogRecv_handlerBase(NATIVE_INT_TYPE portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Handler base-class function for input port LogRecv.
NATIVE_INT_TYPE getNum_dataInDeallocate_OutputPorts() const
NATIVE_INT_TYPE getNum_TlmRecv_InputPorts() const
Fw::SerializeStatus portOut_out(NATIVE_INT_TYPE portNum, Fw::SerializeBufferBase &buffer)
Invoke output port portOut.
virtual void LogRecv_handler(NATIVE_INT_TYPE portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)=0
Handler for input port LogRecv.
NATIVE_INT_TYPE getNum_dataOutAllocate_OutputPorts() const
bool isConnected_portOut_OutputPort(NATIVE_INT_TYPE portNum)
virtual void portIn_handler(NATIVE_INT_TYPE portNum, Fw::SerializeBufferBase &buffer)=0
Handler for input port portIn.
void buffersOut_out(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Invoke output port buffersOut.
void buffersIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port buffersIn.
NATIVE_INT_TYPE getNum_portOut_OutputPorts() const
void LogSend_out(NATIVE_INT_TYPE portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Invoke output port LogSend.
void set_dataOutAllocate_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferGetPort *port)
Connect port to dataOutAllocate[portNum].
Fw::InputBufferSendPort * get_dataIn_InputPort(NATIVE_INT_TYPE portNum)
bool isConnected_buffersOut_OutputPort(NATIVE_INT_TYPE portNum)
virtual ~GenericHubComponentBase()
Destroy GenericHubComponentBase object.
bool isConnected_LogSend_OutputPort(NATIVE_INT_TYPE portNum)
void portIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::SerializeBufferBase &buffer)
Handler base-class function for input port portIn.
NATIVE_INT_TYPE getNum_LogRecv_InputPorts() const
Fw::InputLogPort * get_LogRecv_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_portIn_InputPorts() const
Fw::InputBufferSendPort * get_buffersIn_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_LogSend_OutputPorts() const
void dataOut_out(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Invoke output port dataOut.
Fw::InputSerializePort * get_portIn_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_bufferDeallocate_OutputPorts() const
bool isConnected_bufferDeallocate_OutputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_buffersOut_OutputPorts() const
virtual void TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
void set_dataInDeallocate_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferSendPort *port)
Connect port to dataInDeallocate[portNum].
NATIVE_INT_TYPE getNum_dataOut_OutputPorts() const
GenericHubComponentBase(const char *compName="")
Construct GenericHubComponentBase object.
void set_dataOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferSendPort *port)
Connect port to dataOut[portNum].
Fw::Buffer dataOutAllocate_out(NATIVE_INT_TYPE portNum, U32 size)
Invoke output port dataOutAllocate.
Fw::InputTlmPort * get_TlmRecv_InputPort(NATIVE_INT_TYPE portNum)
bool isConnected_dataInDeallocate_OutputPort(NATIVE_INT_TYPE portNum)
void set_TlmSend_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTlmPort *port)
Connect port to TlmSend[portNum].
SerializeStatus
forward declaration for string