F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BufferRepeaterComponentAc.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title BufferRepeaterComponentAc.cpp
3// \author Generated by fpp-to-cpp
4// \brief cpp file for BufferRepeater 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 // ----------------------------------------------------------------------
18 // Component initialization
19 // ----------------------------------------------------------------------
20
21 void BufferRepeaterComponentBase ::
22 init(NATIVE_INT_TYPE instance)
23 {
24 // Initialize base class
26
27 // Connect input port portIn
28 for (
29 PlatformIntType port = 0;
30 port < static_cast<PlatformIntType>(this->getNum_portIn_InputPorts());
31 port++
32 ) {
33 this->m_portIn_InputPort[port].init();
34 this->m_portIn_InputPort[port].addCallComp(
35 this,
36 m_p_portIn_in
37 );
38 this->m_portIn_InputPort[port].setPortNum(port);
39
40#if FW_OBJECT_NAMES == 1
41 char portName[120];
42 (void) snprintf(
43 portName,
44 sizeof(portName),
45 "%s_portIn_InputPort[%" PRI_PlatformIntType "]",
46 this->m_objName,
47 port
48 );
49 this->m_portIn_InputPort[port].setObjName(portName);
50#endif
51 }
52
53 // Connect output port Log
54 for (
55 PlatformIntType port = 0;
56 port < static_cast<PlatformIntType>(this->getNum_Log_OutputPorts());
57 port++
58 ) {
59 this->m_Log_OutputPort[port].init();
60
61#if FW_OBJECT_NAMES == 1
62 char portName[120];
63 (void) snprintf(
64 portName,
65 sizeof(portName),
66 "%s_Log_OutputPort[%" PRI_PlatformIntType "]",
67 this->m_objName,
68 port
69 );
70 this->m_Log_OutputPort[port].setObjName(portName);
71#endif
72 }
73
74#if FW_ENABLE_TEXT_LOGGING == 1
75 // Connect output port LogText
76 for (
77 PlatformIntType port = 0;
78 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
79 port++
80 ) {
81 this->m_LogText_OutputPort[port].init();
82
83#if FW_OBJECT_NAMES == 1
84 char portName[120];
85 (void) snprintf(
86 portName,
87 sizeof(portName),
88 "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
89 this->m_objName,
90 port
91 );
92 this->m_LogText_OutputPort[port].setObjName(portName);
93#endif
94 }
95#endif
96
97 // Connect output port Time
98 for (
99 PlatformIntType port = 0;
100 port < static_cast<PlatformIntType>(this->getNum_Time_OutputPorts());
101 port++
102 ) {
103 this->m_Time_OutputPort[port].init();
104
105#if FW_OBJECT_NAMES == 1
106 char portName[120];
107 (void) snprintf(
108 portName,
109 sizeof(portName),
110 "%s_Time_OutputPort[%" PRI_PlatformIntType "]",
111 this->m_objName,
112 port
113 );
114 this->m_Time_OutputPort[port].setObjName(portName);
115#endif
116 }
117
118 // Connect output port allocate
119 for (
120 PlatformIntType port = 0;
121 port < static_cast<PlatformIntType>(this->getNum_allocate_OutputPorts());
122 port++
123 ) {
124 this->m_allocate_OutputPort[port].init();
125
126#if FW_OBJECT_NAMES == 1
127 char portName[120];
128 (void) snprintf(
129 portName,
130 sizeof(portName),
131 "%s_allocate_OutputPort[%" PRI_PlatformIntType "]",
132 this->m_objName,
133 port
134 );
135 this->m_allocate_OutputPort[port].setObjName(portName);
136#endif
137 }
138
139 // Connect output port deallocate
140 for (
141 PlatformIntType port = 0;
142 port < static_cast<PlatformIntType>(this->getNum_deallocate_OutputPorts());
143 port++
144 ) {
145 this->m_deallocate_OutputPort[port].init();
146
147#if FW_OBJECT_NAMES == 1
148 char portName[120];
149 (void) snprintf(
150 portName,
151 sizeof(portName),
152 "%s_deallocate_OutputPort[%" PRI_PlatformIntType "]",
153 this->m_objName,
154 port
155 );
156 this->m_deallocate_OutputPort[port].setObjName(portName);
157#endif
158 }
159
160 // Connect output port portOut
161 for (
162 PlatformIntType port = 0;
163 port < static_cast<PlatformIntType>(this->getNum_portOut_OutputPorts());
164 port++
165 ) {
166 this->m_portOut_OutputPort[port].init();
167
168#if FW_OBJECT_NAMES == 1
169 char portName[120];
170 (void) snprintf(
171 portName,
172 sizeof(portName),
173 "%s_portOut_OutputPort[%" PRI_PlatformIntType "]",
174 this->m_objName,
175 port
176 );
177 this->m_portOut_OutputPort[port].setObjName(portName);
178#endif
179 }
180 }
181
182 // ----------------------------------------------------------------------
183 // Getters for typed input ports
184 // ----------------------------------------------------------------------
185
186 Fw::InputBufferSendPort* BufferRepeaterComponentBase ::
187 get_portIn_InputPort(NATIVE_INT_TYPE portNum)
188 {
189 FW_ASSERT(
190 portNum < this->getNum_portIn_InputPorts(),
191 static_cast<FwAssertArgType>(portNum)
192 );
193
194 return &this->m_portIn_InputPort[portNum];
195 }
196
197 // ----------------------------------------------------------------------
198 // Connect input ports to special output ports
199 // ----------------------------------------------------------------------
200
201 void BufferRepeaterComponentBase ::
202 set_Log_OutputPort(
203 NATIVE_INT_TYPE portNum,
204 Fw::InputLogPort* port
205 )
206 {
207 FW_ASSERT(
208 portNum < this->getNum_Log_OutputPorts(),
209 static_cast<FwAssertArgType>(portNum)
210 );
211
212 this->m_Log_OutputPort[portNum].addCallPort(port);
213 }
214
215#if FW_ENABLE_TEXT_LOGGING == 1
216
217 void BufferRepeaterComponentBase ::
218 set_LogText_OutputPort(
219 NATIVE_INT_TYPE portNum,
221 )
222 {
223 FW_ASSERT(
224 portNum < this->getNum_LogText_OutputPorts(),
225 static_cast<FwAssertArgType>(portNum)
226 );
227
228 this->m_LogText_OutputPort[portNum].addCallPort(port);
229 }
230
231#endif
232
233 void BufferRepeaterComponentBase ::
234 set_Time_OutputPort(
235 NATIVE_INT_TYPE portNum,
237 )
238 {
239 FW_ASSERT(
240 portNum < this->getNum_Time_OutputPorts(),
241 static_cast<FwAssertArgType>(portNum)
242 );
243
244 this->m_Time_OutputPort[portNum].addCallPort(port);
245 }
246
247 // ----------------------------------------------------------------------
248 // Connect typed input ports to typed output ports
249 // ----------------------------------------------------------------------
250
251 void BufferRepeaterComponentBase ::
252 set_allocate_OutputPort(
253 NATIVE_INT_TYPE portNum,
255 )
256 {
257 FW_ASSERT(
258 portNum < this->getNum_allocate_OutputPorts(),
259 static_cast<FwAssertArgType>(portNum)
260 );
261
262 this->m_allocate_OutputPort[portNum].addCallPort(port);
263 }
264
265 void BufferRepeaterComponentBase ::
266 set_deallocate_OutputPort(
267 NATIVE_INT_TYPE portNum,
269 )
270 {
271 FW_ASSERT(
272 portNum < this->getNum_deallocate_OutputPorts(),
273 static_cast<FwAssertArgType>(portNum)
274 );
275
276 this->m_deallocate_OutputPort[portNum].addCallPort(port);
277 }
278
279 void BufferRepeaterComponentBase ::
280 set_portOut_OutputPort(
281 NATIVE_INT_TYPE portNum,
283 )
284 {
285 FW_ASSERT(
286 portNum < this->getNum_portOut_OutputPorts(),
287 static_cast<FwAssertArgType>(portNum)
288 );
289
290 this->m_portOut_OutputPort[portNum].addCallPort(port);
291 }
292
293#if FW_PORT_SERIALIZATION
294
295 // ----------------------------------------------------------------------
296 // Connect serial input ports to special output ports
297 // ----------------------------------------------------------------------
298
299 void BufferRepeaterComponentBase ::
300 set_Log_OutputPort(
301 NATIVE_INT_TYPE portNum,
302 Fw::InputSerializePort* port
303 )
304 {
305 FW_ASSERT(
306 portNum < this->getNum_Log_OutputPorts(),
307 static_cast<FwAssertArgType>(portNum)
308 );
309
310 this->m_Log_OutputPort[portNum].registerSerialPort(port);
311 }
312
313#if FW_ENABLE_TEXT_LOGGING == 1
314
315 void BufferRepeaterComponentBase ::
316 set_LogText_OutputPort(
317 NATIVE_INT_TYPE portNum,
318 Fw::InputSerializePort* port
319 )
320 {
321 FW_ASSERT(
322 portNum < this->getNum_LogText_OutputPorts(),
323 static_cast<FwAssertArgType>(portNum)
324 );
325
326 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
327 }
328
329#endif
330
331 void BufferRepeaterComponentBase ::
332 set_Time_OutputPort(
333 NATIVE_INT_TYPE portNum,
334 Fw::InputSerializePort* port
335 )
336 {
337 FW_ASSERT(
338 portNum < this->getNum_Time_OutputPorts(),
339 static_cast<FwAssertArgType>(portNum)
340 );
341
342 this->m_Time_OutputPort[portNum].registerSerialPort(port);
343 }
344
345#endif
346
347#if FW_PORT_SERIALIZATION
348
349 // ----------------------------------------------------------------------
350 // Connect serial input ports to typed output ports
351 // ----------------------------------------------------------------------
352
353 void BufferRepeaterComponentBase ::
354 set_deallocate_OutputPort(
355 NATIVE_INT_TYPE portNum,
356 Fw::InputSerializePort* port
357 )
358 {
359 FW_ASSERT(
360 portNum < this->getNum_deallocate_OutputPorts(),
361 static_cast<FwAssertArgType>(portNum)
362 );
363
364 this->m_deallocate_OutputPort[portNum].registerSerialPort(port);
365 }
366
367 void BufferRepeaterComponentBase ::
368 set_portOut_OutputPort(
369 NATIVE_INT_TYPE portNum,
370 Fw::InputSerializePort* port
371 )
372 {
373 FW_ASSERT(
374 portNum < this->getNum_portOut_OutputPorts(),
375 static_cast<FwAssertArgType>(portNum)
376 );
377
378 this->m_portOut_OutputPort[portNum].registerSerialPort(port);
379 }
380
381#endif
382
383 // ----------------------------------------------------------------------
384 // Component construction and destruction
385 // ----------------------------------------------------------------------
386
387 BufferRepeaterComponentBase ::
388 BufferRepeaterComponentBase(const char* compName) :
389 Fw::PassiveComponentBase(compName)
390 {
391
392 }
393
394 BufferRepeaterComponentBase ::
395 ~BufferRepeaterComponentBase()
396 {
397
398 }
399
400 // ----------------------------------------------------------------------
401 // Getters for numbers of typed input ports
402 // ----------------------------------------------------------------------
403
404 NATIVE_INT_TYPE BufferRepeaterComponentBase ::
405 getNum_portIn_InputPorts() const
406 {
407 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_portIn_InputPort));
408 }
409
410 // ----------------------------------------------------------------------
411 // Getters for numbers of special output ports
412 // ----------------------------------------------------------------------
413
414 NATIVE_INT_TYPE BufferRepeaterComponentBase ::
415 getNum_Log_OutputPorts() const
416 {
417 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
418 }
419
420#if FW_ENABLE_TEXT_LOGGING == 1
421
422 NATIVE_INT_TYPE BufferRepeaterComponentBase ::
423 getNum_LogText_OutputPorts() const
424 {
425 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
426 }
427
428#endif
429
430 NATIVE_INT_TYPE BufferRepeaterComponentBase ::
431 getNum_Time_OutputPorts() const
432 {
433 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
434 }
435
436 // ----------------------------------------------------------------------
437 // Getters for numbers of typed output ports
438 // ----------------------------------------------------------------------
439
440 NATIVE_INT_TYPE BufferRepeaterComponentBase ::
441 getNum_allocate_OutputPorts() const
442 {
443 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_allocate_OutputPort));
444 }
445
446 NATIVE_INT_TYPE BufferRepeaterComponentBase ::
447 getNum_deallocate_OutputPorts() const
448 {
449 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_deallocate_OutputPort));
450 }
451
452 NATIVE_INT_TYPE BufferRepeaterComponentBase ::
453 getNum_portOut_OutputPorts() const
454 {
455 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_portOut_OutputPort));
456 }
457
458 // ----------------------------------------------------------------------
459 // Connection status queries for special output ports
460 // ----------------------------------------------------------------------
461
462 bool BufferRepeaterComponentBase ::
463 isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
464 {
465 FW_ASSERT(
466 portNum < this->getNum_Log_OutputPorts(),
467 static_cast<FwAssertArgType>(portNum)
468 );
469
470 return this->m_Log_OutputPort[portNum].isConnected();
471 }
472
473#if FW_ENABLE_TEXT_LOGGING == 1
474
475 bool BufferRepeaterComponentBase ::
476 isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
477 {
478 FW_ASSERT(
479 portNum < this->getNum_LogText_OutputPorts(),
480 static_cast<FwAssertArgType>(portNum)
481 );
482
483 return this->m_LogText_OutputPort[portNum].isConnected();
484 }
485
486#endif
487
488 bool BufferRepeaterComponentBase ::
489 isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
490 {
491 FW_ASSERT(
492 portNum < this->getNum_Time_OutputPorts(),
493 static_cast<FwAssertArgType>(portNum)
494 );
495
496 return this->m_Time_OutputPort[portNum].isConnected();
497 }
498
499 // ----------------------------------------------------------------------
500 // Connection status queries for typed output ports
501 // ----------------------------------------------------------------------
502
503 bool BufferRepeaterComponentBase ::
504 isConnected_allocate_OutputPort(NATIVE_INT_TYPE portNum)
505 {
506 FW_ASSERT(
507 portNum < this->getNum_allocate_OutputPorts(),
508 static_cast<FwAssertArgType>(portNum)
509 );
510
511 return this->m_allocate_OutputPort[portNum].isConnected();
512 }
513
514 bool BufferRepeaterComponentBase ::
515 isConnected_deallocate_OutputPort(NATIVE_INT_TYPE portNum)
516 {
517 FW_ASSERT(
518 portNum < this->getNum_deallocate_OutputPorts(),
519 static_cast<FwAssertArgType>(portNum)
520 );
521
522 return this->m_deallocate_OutputPort[portNum].isConnected();
523 }
524
525 bool BufferRepeaterComponentBase ::
526 isConnected_portOut_OutputPort(NATIVE_INT_TYPE portNum)
527 {
528 FW_ASSERT(
529 portNum < this->getNum_portOut_OutputPorts(),
530 static_cast<FwAssertArgType>(portNum)
531 );
532
533 return this->m_portOut_OutputPort[portNum].isConnected();
534 }
535
536 // ----------------------------------------------------------------------
537 // Port handler base-class functions for typed input ports
538 //
539 // Call these functions directly to bypass the corresponding ports
540 // ----------------------------------------------------------------------
541
542 void BufferRepeaterComponentBase ::
543 portIn_handlerBase(
544 NATIVE_INT_TYPE portNum,
545 Fw::Buffer& fwBuffer
546 )
547 {
548 // Make sure port number is valid
549 FW_ASSERT(
550 portNum < this->getNum_portIn_InputPorts(),
551 static_cast<FwAssertArgType>(portNum)
552 );
553
554 // Down call to pure virtual handler method implemented in Impl class
555 this->portIn_handler(
556 portNum,
557 fwBuffer
558 );
559 }
560
561 // ----------------------------------------------------------------------
562 // Invocation functions for typed output ports
563 // ----------------------------------------------------------------------
564
565 Fw::Buffer BufferRepeaterComponentBase ::
566 allocate_out(
567 NATIVE_INT_TYPE portNum,
568 U32 size
569 )
570 {
571 FW_ASSERT(
572 portNum < this->getNum_allocate_OutputPorts(),
573 static_cast<FwAssertArgType>(portNum)
574 );
575 return this->m_allocate_OutputPort[portNum].invoke(
576 size
577 );
578 }
579
580 void BufferRepeaterComponentBase ::
581 deallocate_out(
582 NATIVE_INT_TYPE portNum,
583 Fw::Buffer& fwBuffer
584 )
585 {
586 FW_ASSERT(
587 portNum < this->getNum_deallocate_OutputPorts(),
588 static_cast<FwAssertArgType>(portNum)
589 );
590 this->m_deallocate_OutputPort[portNum].invoke(
591 fwBuffer
592 );
593 }
594
595 void BufferRepeaterComponentBase ::
596 portOut_out(
597 NATIVE_INT_TYPE portNum,
598 Fw::Buffer& fwBuffer
599 )
600 {
601 FW_ASSERT(
602 portNum < this->getNum_portOut_OutputPorts(),
603 static_cast<FwAssertArgType>(portNum)
604 );
605 this->m_portOut_OutputPort[portNum].invoke(
606 fwBuffer
607 );
608 }
609
610 // ----------------------------------------------------------------------
611 // Event logging functions
612 // ----------------------------------------------------------------------
613
614 void BufferRepeaterComponentBase ::
615 log_WARNING_HI_AllocationSoftFailure(
616 I32 port,
617 U32 size
618 )
619 {
620 // Get the time
621 Fw::Time _logTime;
622 if (this->m_Time_OutputPort[0].isConnected()) {
623 this->m_Time_OutputPort[0].invoke(_logTime);
624 }
625
626 FwEventIdType _id = static_cast<FwEventIdType>(0);
627
628 _id = this->getIdBase() + EVENTID_ALLOCATIONSOFTFAILURE;
629
630 // Emit the event on the log port
631 if (this->m_Log_OutputPort[0].isConnected()) {
632 Fw::LogBuffer _logBuff;
634
635#if FW_AMPCS_COMPATIBLE
636 // Serialize the number of arguments
637 _status = _logBuff.serialize(static_cast<U8>(2));
638 FW_ASSERT(
639 _status == Fw::FW_SERIALIZE_OK,
640 static_cast<FwAssertArgType>(_status)
641 );
642#endif
643
644#if FW_AMPCS_COMPATIBLE
645 // Serialize the argument size
646 _status = _logBuff.serialize(
647 static_cast<U8>(sizeof(I32))
648 );
649 FW_ASSERT(
650 _status == Fw::FW_SERIALIZE_OK,
651 static_cast<FwAssertArgType>(_status)
652 );
653#endif
654 _status = _logBuff.serialize(port);
655 FW_ASSERT(
656 _status == Fw::FW_SERIALIZE_OK,
657 static_cast<FwAssertArgType>(_status)
658 );
659
660#if FW_AMPCS_COMPATIBLE
661 // Serialize the argument size
662 _status = _logBuff.serialize(
663 static_cast<U8>(sizeof(U32))
664 );
665 FW_ASSERT(
666 _status == Fw::FW_SERIALIZE_OK,
667 static_cast<FwAssertArgType>(_status)
668 );
669#endif
670 _status = _logBuff.serialize(size);
671 FW_ASSERT(
672 _status == Fw::FW_SERIALIZE_OK,
673 static_cast<FwAssertArgType>(_status)
674 );
675
676 this->m_Log_OutputPort[0].invoke(
677 _id,
678 _logTime,
680 _logBuff
681 );
682 }
683
684 // Emit the event on the text log port
685#if FW_ENABLE_TEXT_LOGGING
686 if (this->m_LogText_OutputPort[0].isConnected()) {
687#if FW_OBJECT_NAMES == 1
688 const char* _formatString =
689 "(%s) %s: Failed to allocate %" PRIi32 " byte buffer for port %" PRIu32 "";
690#else
691 const char* _formatString =
692 "%s: Failed to allocate %" PRIi32 " byte buffer for port %" PRIu32 "";
693#endif
694
695 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
696
697 (void) snprintf(
698 _textBuffer,
700 _formatString,
701#if FW_OBJECT_NAMES == 1
702 this->m_objName,
703#endif
704 "AllocationSoftFailure ",
705 port,
706 size
707 );
708
709 // Null terminate
710 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
711 Fw::TextLogString _logString = _textBuffer;
712 this->m_LogText_OutputPort[0].invoke(
713 _id,
714 _logTime,
716 _logString
717 );
718 }
719#endif
720 }
721
722 void BufferRepeaterComponentBase ::
723 log_FATAL_AllocationHardFailure(
724 I32 port,
725 U32 size
726 )
727 {
728 // Get the time
729 Fw::Time _logTime;
730 if (this->m_Time_OutputPort[0].isConnected()) {
731 this->m_Time_OutputPort[0].invoke(_logTime);
732 }
733
734 FwEventIdType _id = static_cast<FwEventIdType>(0);
735
736 _id = this->getIdBase() + EVENTID_ALLOCATIONHARDFAILURE;
737
738 // Emit the event on the log port
739 if (this->m_Log_OutputPort[0].isConnected()) {
740 Fw::LogBuffer _logBuff;
742
743#if FW_AMPCS_COMPATIBLE
744 // Serialize the number of arguments
745 _status = _logBuff.serialize(static_cast<U8>(2 + 1));
746 FW_ASSERT(
747 _status == Fw::FW_SERIALIZE_OK,
748 static_cast<FwAssertArgType>(_status)
749 );
750
751 // For FATAL, add stack size of 4 and a dummy entry. No support for stacks yet.
752 _status = _logBuff.serialize(static_cast<U8>(4));
753 FW_ASSERT(
754 _status == Fw::FW_SERIALIZE_OK,
755 static_cast<FwAssertArgType>(_status)
756 );
757
758 _status = _logBuff.serialize(static_cast<U32>(0));
759 FW_ASSERT(
760 _status == Fw::FW_SERIALIZE_OK,
761 static_cast<FwAssertArgType>(_status)
762 );
763#endif
764
765#if FW_AMPCS_COMPATIBLE
766 // Serialize the argument size
767 _status = _logBuff.serialize(
768 static_cast<U8>(sizeof(I32))
769 );
770 FW_ASSERT(
771 _status == Fw::FW_SERIALIZE_OK,
772 static_cast<FwAssertArgType>(_status)
773 );
774#endif
775 _status = _logBuff.serialize(port);
776 FW_ASSERT(
777 _status == Fw::FW_SERIALIZE_OK,
778 static_cast<FwAssertArgType>(_status)
779 );
780
781#if FW_AMPCS_COMPATIBLE
782 // Serialize the argument size
783 _status = _logBuff.serialize(
784 static_cast<U8>(sizeof(U32))
785 );
786 FW_ASSERT(
787 _status == Fw::FW_SERIALIZE_OK,
788 static_cast<FwAssertArgType>(_status)
789 );
790#endif
791 _status = _logBuff.serialize(size);
792 FW_ASSERT(
793 _status == Fw::FW_SERIALIZE_OK,
794 static_cast<FwAssertArgType>(_status)
795 );
796
797 this->m_Log_OutputPort[0].invoke(
798 _id,
799 _logTime,
801 _logBuff
802 );
803 }
804
805 // Emit the event on the text log port
806#if FW_ENABLE_TEXT_LOGGING
807 if (this->m_LogText_OutputPort[0].isConnected()) {
808#if FW_OBJECT_NAMES == 1
809 const char* _formatString =
810 "(%s) %s: Failed to allocate %" PRIi32 " byte buffer for port %" PRIu32 "";
811#else
812 const char* _formatString =
813 "%s: Failed to allocate %" PRIi32 " byte buffer for port %" PRIu32 "";
814#endif
815
816 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
817
818 (void) snprintf(
819 _textBuffer,
821 _formatString,
822#if FW_OBJECT_NAMES == 1
823 this->m_objName,
824#endif
825 "AllocationHardFailure ",
826 port,
827 size
828 );
829
830 // Null terminate
831 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
832 Fw::TextLogString _logString = _textBuffer;
833 this->m_LogText_OutputPort[0].invoke(
834 _id,
835 _logTime,
837 _logString
838 );
839 }
840#endif
841 }
842
843 // ----------------------------------------------------------------------
844 // Time
845 // ----------------------------------------------------------------------
846
847 Fw::Time BufferRepeaterComponentBase ::
848 getTime()
849 {
850 if (this->m_Time_OutputPort[0].isConnected()) {
851 Fw::Time _time;
852 this->m_Time_OutputPort[0].invoke(_time);
853 return _time;
854 }
855 else {
856 return Fw::Time(TB_NONE, 0, 0);
857 }
858 }
859
860 // ----------------------------------------------------------------------
861 // Calls for messages received on typed input ports
862 // ----------------------------------------------------------------------
863
864 void BufferRepeaterComponentBase ::
865 m_p_portIn_in(
866 Fw::PassiveComponentBase* callComp,
867 NATIVE_INT_TYPE portNum,
868 Fw::Buffer& fwBuffer
869 )
870 {
871 FW_ASSERT(callComp);
872 BufferRepeaterComponentBase* compPtr = static_cast<BufferRepeaterComponentBase*>(callComp);
873 compPtr->portIn_handlerBase(
874 portNum,
875 fwBuffer
876 );
877 }
878
879}
#define FW_ASSERT(...)
Definition Assert.hpp:7
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
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
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition FpConfig.h:39
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
U32 FwEventIdType
Definition FpConfig.h:62
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition FpConfig.h:291
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition FpConfig.h:82
Input BufferGet port.
Input BufferSend port.
@ WARNING_HI
A serious but recoverable event.
@ FATAL
A fatal non-recoverable event.
void init()
Object initializer.
Definition ObjBase.cpp:27
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Auto-generated base for BufferRepeater component.
void portIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port portIn.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.