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