F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FprimeRouterComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FprimeRouterComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FprimeRouter component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26  // Connect input port cmdResponseIn
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_cmdResponseIn_InputPorts());
30  port++
31  ) {
32  this->m_cmdResponseIn_InputPort[port].init();
33  this->m_cmdResponseIn_InputPort[port].addCallComp(
34  this,
35  m_p_cmdResponseIn_in
36  );
37  this->m_cmdResponseIn_InputPort[port].setPortNum(port);
38 
39 #if FW_OBJECT_NAMES == 1
40  Fw::ObjectName portName;
41  portName.format(
42  "%s_cmdResponseIn_InputPort[%" PRI_FwIndexType "]",
43  this->m_objName.toChar(),
44  port
45  );
46  this->m_cmdResponseIn_InputPort[port].setObjName(portName.toChar());
47 #endif
48  }
49 
50  // Connect input port dataIn
51  for (
52  FwIndexType port = 0;
53  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
54  port++
55  ) {
56  this->m_dataIn_InputPort[port].init();
57  this->m_dataIn_InputPort[port].addCallComp(
58  this,
59  m_p_dataIn_in
60  );
61  this->m_dataIn_InputPort[port].setPortNum(port);
62 
63 #if FW_OBJECT_NAMES == 1
64  Fw::ObjectName portName;
65  portName.format(
66  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
67  this->m_objName.toChar(),
68  port
69  );
70  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
71 #endif
72  }
73 
74  // Connect input port fileBufferReturnIn
75  for (
76  FwIndexType port = 0;
77  port < static_cast<FwIndexType>(this->getNum_fileBufferReturnIn_InputPorts());
78  port++
79  ) {
80  this->m_fileBufferReturnIn_InputPort[port].init();
81  this->m_fileBufferReturnIn_InputPort[port].addCallComp(
82  this,
83  m_p_fileBufferReturnIn_in
84  );
85  this->m_fileBufferReturnIn_InputPort[port].setPortNum(port);
86 
87 #if FW_OBJECT_NAMES == 1
88  Fw::ObjectName portName;
89  portName.format(
90  "%s_fileBufferReturnIn_InputPort[%" PRI_FwIndexType "]",
91  this->m_objName.toChar(),
92  port
93  );
94  this->m_fileBufferReturnIn_InputPort[port].setObjName(portName.toChar());
95 #endif
96  }
97 
98  // Connect output port logOut
99  for (
100  FwIndexType port = 0;
101  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
102  port++
103  ) {
104  this->m_logOut_OutputPort[port].init();
105 
106 #if FW_OBJECT_NAMES == 1
107  Fw::ObjectName portName;
108  portName.format(
109  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
110  this->m_objName.toChar(),
111  port
112  );
113  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
114 #endif
115  }
116 
117 #if FW_ENABLE_TEXT_LOGGING == 1
118  // Connect output port logTextOut
119  for (
120  FwIndexType port = 0;
121  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
122  port++
123  ) {
124  this->m_logTextOut_OutputPort[port].init();
125 
126 #if FW_OBJECT_NAMES == 1
127  Fw::ObjectName portName;
128  portName.format(
129  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
130  this->m_objName.toChar(),
131  port
132  );
133  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
134 #endif
135  }
136 #endif
137 
138  // Connect output port timeCaller
139  for (
140  FwIndexType port = 0;
141  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
142  port++
143  ) {
144  this->m_timeCaller_OutputPort[port].init();
145 
146 #if FW_OBJECT_NAMES == 1
147  Fw::ObjectName portName;
148  portName.format(
149  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
150  this->m_objName.toChar(),
151  port
152  );
153  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
154 #endif
155  }
156 
157  // Connect output port bufferAllocate
158  for (
159  FwIndexType port = 0;
160  port < static_cast<FwIndexType>(this->getNum_bufferAllocate_OutputPorts());
161  port++
162  ) {
163  this->m_bufferAllocate_OutputPort[port].init();
164 
165 #if FW_OBJECT_NAMES == 1
166  Fw::ObjectName portName;
167  portName.format(
168  "%s_bufferAllocate_OutputPort[%" PRI_FwIndexType "]",
169  this->m_objName.toChar(),
170  port
171  );
172  this->m_bufferAllocate_OutputPort[port].setObjName(portName.toChar());
173 #endif
174  }
175 
176  // Connect output port bufferDeallocate
177  for (
178  FwIndexType port = 0;
179  port < static_cast<FwIndexType>(this->getNum_bufferDeallocate_OutputPorts());
180  port++
181  ) {
182  this->m_bufferDeallocate_OutputPort[port].init();
183 
184 #if FW_OBJECT_NAMES == 1
185  Fw::ObjectName portName;
186  portName.format(
187  "%s_bufferDeallocate_OutputPort[%" PRI_FwIndexType "]",
188  this->m_objName.toChar(),
189  port
190  );
191  this->m_bufferDeallocate_OutputPort[port].setObjName(portName.toChar());
192 #endif
193  }
194 
195  // Connect output port commandOut
196  for (
197  FwIndexType port = 0;
198  port < static_cast<FwIndexType>(this->getNum_commandOut_OutputPorts());
199  port++
200  ) {
201  this->m_commandOut_OutputPort[port].init();
202 
203 #if FW_OBJECT_NAMES == 1
204  Fw::ObjectName portName;
205  portName.format(
206  "%s_commandOut_OutputPort[%" PRI_FwIndexType "]",
207  this->m_objName.toChar(),
208  port
209  );
210  this->m_commandOut_OutputPort[port].setObjName(portName.toChar());
211 #endif
212  }
213 
214  // Connect output port dataReturnOut
215  for (
216  FwIndexType port = 0;
217  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
218  port++
219  ) {
220  this->m_dataReturnOut_OutputPort[port].init();
221 
222 #if FW_OBJECT_NAMES == 1
223  Fw::ObjectName portName;
224  portName.format(
225  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
226  this->m_objName.toChar(),
227  port
228  );
229  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
230 #endif
231  }
232 
233  // Connect output port fileOut
234  for (
235  FwIndexType port = 0;
236  port < static_cast<FwIndexType>(this->getNum_fileOut_OutputPorts());
237  port++
238  ) {
239  this->m_fileOut_OutputPort[port].init();
240 
241 #if FW_OBJECT_NAMES == 1
242  Fw::ObjectName portName;
243  portName.format(
244  "%s_fileOut_OutputPort[%" PRI_FwIndexType "]",
245  this->m_objName.toChar(),
246  port
247  );
248  this->m_fileOut_OutputPort[port].setObjName(portName.toChar());
249 #endif
250  }
251 
252  // Connect output port unknownDataOut
253  for (
254  FwIndexType port = 0;
255  port < static_cast<FwIndexType>(this->getNum_unknownDataOut_OutputPorts());
256  port++
257  ) {
258  this->m_unknownDataOut_OutputPort[port].init();
259 
260 #if FW_OBJECT_NAMES == 1
261  Fw::ObjectName portName;
262  portName.format(
263  "%s_unknownDataOut_OutputPort[%" PRI_FwIndexType "]",
264  this->m_objName.toChar(),
265  port
266  );
267  this->m_unknownDataOut_OutputPort[port].setObjName(portName.toChar());
268 #endif
269  }
270  }
271 
272  // ----------------------------------------------------------------------
273  // Getters for typed input ports
274  // ----------------------------------------------------------------------
275 
278  {
279  FW_ASSERT(
280  (0 <= portNum) && (portNum < this->getNum_cmdResponseIn_InputPorts()),
281  static_cast<FwAssertArgType>(portNum)
282  );
283 
284  return &this->m_cmdResponseIn_InputPort[portNum];
285  }
286 
289  {
290  FW_ASSERT(
291  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
292  static_cast<FwAssertArgType>(portNum)
293  );
294 
295  return &this->m_dataIn_InputPort[portNum];
296  }
297 
300  {
301  FW_ASSERT(
302  (0 <= portNum) && (portNum < this->getNum_fileBufferReturnIn_InputPorts()),
303  static_cast<FwAssertArgType>(portNum)
304  );
305 
306  return &this->m_fileBufferReturnIn_InputPort[portNum];
307  }
308 
309  // ----------------------------------------------------------------------
310  // Connect input ports to special output ports
311  // ----------------------------------------------------------------------
312 
315  FwIndexType portNum,
316  Fw::InputLogPort* port
317  )
318  {
319  FW_ASSERT(
320  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
321  static_cast<FwAssertArgType>(portNum)
322  );
323 
324  this->m_logOut_OutputPort[portNum].addCallPort(port);
325  }
326 
327 #if FW_ENABLE_TEXT_LOGGING == 1
328 
329  void FprimeRouterComponentBase ::
330  set_logTextOut_OutputPort(
331  FwIndexType portNum,
333  )
334  {
335  FW_ASSERT(
336  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
337  static_cast<FwAssertArgType>(portNum)
338  );
339 
340  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
341  }
342 
343 #endif
344 
347  FwIndexType portNum,
348  Fw::InputTimePort* port
349  )
350  {
351  FW_ASSERT(
352  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
353  static_cast<FwAssertArgType>(portNum)
354  );
355 
356  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
357  }
358 
359  // ----------------------------------------------------------------------
360  // Connect typed input ports to typed output ports
361  // ----------------------------------------------------------------------
362 
365  FwIndexType portNum,
367  )
368  {
369  FW_ASSERT(
370  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
371  static_cast<FwAssertArgType>(portNum)
372  );
373 
374  this->m_bufferAllocate_OutputPort[portNum].addCallPort(port);
375  }
376 
379  FwIndexType portNum,
381  )
382  {
383  FW_ASSERT(
384  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
385  static_cast<FwAssertArgType>(portNum)
386  );
387 
388  this->m_bufferDeallocate_OutputPort[portNum].addCallPort(port);
389  }
390 
393  FwIndexType portNum,
394  Fw::InputComPort* port
395  )
396  {
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  this->m_commandOut_OutputPort[portNum].addCallPort(port);
403  }
404 
407  FwIndexType portNum,
409  )
410  {
411  FW_ASSERT(
412  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
413  static_cast<FwAssertArgType>(portNum)
414  );
415 
416  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
417  }
418 
421  FwIndexType portNum,
423  )
424  {
425  FW_ASSERT(
426  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
427  static_cast<FwAssertArgType>(portNum)
428  );
429 
430  this->m_fileOut_OutputPort[portNum].addCallPort(port);
431  }
432 
435  FwIndexType portNum,
437  )
438  {
439  FW_ASSERT(
440  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
441  static_cast<FwAssertArgType>(portNum)
442  );
443 
444  this->m_unknownDataOut_OutputPort[portNum].addCallPort(port);
445  }
446 
447 #if FW_PORT_SERIALIZATION
448 
449  // ----------------------------------------------------------------------
450  // Connect serial input ports to special output ports
451  // ----------------------------------------------------------------------
452 
455  FwIndexType portNum,
456  Fw::InputSerializePort* port
457  )
458  {
459  FW_ASSERT(
460  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
461  static_cast<FwAssertArgType>(portNum)
462  );
463 
464  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
465  }
466 
467 #if FW_ENABLE_TEXT_LOGGING == 1
468 
469  void FprimeRouterComponentBase ::
470  set_logTextOut_OutputPort(
471  FwIndexType portNum,
472  Fw::InputSerializePort* port
473  )
474  {
475  FW_ASSERT(
476  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
481  }
482 
483 #endif
484 
487  FwIndexType portNum,
488  Fw::InputSerializePort* port
489  )
490  {
491  FW_ASSERT(
492  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
493  static_cast<FwAssertArgType>(portNum)
494  );
495 
496  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
497  }
498 
499 #endif
500 
501 #if FW_PORT_SERIALIZATION
502 
503  // ----------------------------------------------------------------------
504  // Connect serial input ports to typed output ports
505  // ----------------------------------------------------------------------
506 
509  FwIndexType portNum,
510  Fw::InputSerializePort* port
511  )
512  {
513  FW_ASSERT(
514  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
515  static_cast<FwAssertArgType>(portNum)
516  );
517 
518  this->m_bufferDeallocate_OutputPort[portNum].registerSerialPort(port);
519  }
520 
523  FwIndexType portNum,
524  Fw::InputSerializePort* port
525  )
526  {
527  FW_ASSERT(
528  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
529  static_cast<FwAssertArgType>(portNum)
530  );
531 
532  this->m_commandOut_OutputPort[portNum].registerSerialPort(port);
533  }
534 
537  FwIndexType portNum,
538  Fw::InputSerializePort* port
539  )
540  {
541  FW_ASSERT(
542  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
543  static_cast<FwAssertArgType>(portNum)
544  );
545 
546  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
547  }
548 
551  FwIndexType portNum,
552  Fw::InputSerializePort* port
553  )
554  {
555  FW_ASSERT(
556  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
557  static_cast<FwAssertArgType>(portNum)
558  );
559 
560  this->m_fileOut_OutputPort[portNum].registerSerialPort(port);
561  }
562 
565  FwIndexType portNum,
566  Fw::InputSerializePort* port
567  )
568  {
569  FW_ASSERT(
570  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
571  static_cast<FwAssertArgType>(portNum)
572  );
573 
574  this->m_unknownDataOut_OutputPort[portNum].registerSerialPort(port);
575  }
576 
577 #endif
578 
579  // ----------------------------------------------------------------------
580  // Component construction and destruction
581  // ----------------------------------------------------------------------
582 
584  FprimeRouterComponentBase(const char* compName) :
585  Fw::PassiveComponentBase(compName)
586  {
587 
588  }
589 
592  {
593 
594  }
595 
596  // ----------------------------------------------------------------------
597  // Connection status queries for special output ports
598  // ----------------------------------------------------------------------
599 
602  {
603  FW_ASSERT(
604  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
605  static_cast<FwAssertArgType>(portNum)
606  );
607 
608  return this->m_logOut_OutputPort[portNum].isConnected();
609  }
610 
611 #if FW_ENABLE_TEXT_LOGGING == 1
612 
613  bool FprimeRouterComponentBase ::
614  isConnected_logTextOut_OutputPort(FwIndexType portNum)
615  {
616  FW_ASSERT(
617  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
618  static_cast<FwAssertArgType>(portNum)
619  );
620 
621  return this->m_logTextOut_OutputPort[portNum].isConnected();
622  }
623 
624 #endif
625 
628  {
629  FW_ASSERT(
630  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
631  static_cast<FwAssertArgType>(portNum)
632  );
633 
634  return this->m_timeCaller_OutputPort[portNum].isConnected();
635  }
636 
637  // ----------------------------------------------------------------------
638  // Connection status queries for typed output ports
639  // ----------------------------------------------------------------------
640 
643  {
644  FW_ASSERT(
645  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
646  static_cast<FwAssertArgType>(portNum)
647  );
648 
649  return this->m_bufferAllocate_OutputPort[portNum].isConnected();
650  }
651 
654  {
655  FW_ASSERT(
656  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
657  static_cast<FwAssertArgType>(portNum)
658  );
659 
660  return this->m_bufferDeallocate_OutputPort[portNum].isConnected();
661  }
662 
665  {
666  FW_ASSERT(
667  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
668  static_cast<FwAssertArgType>(portNum)
669  );
670 
671  return this->m_commandOut_OutputPort[portNum].isConnected();
672  }
673 
676  {
677  FW_ASSERT(
678  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
679  static_cast<FwAssertArgType>(portNum)
680  );
681 
682  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
683  }
684 
687  {
688  FW_ASSERT(
689  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
690  static_cast<FwAssertArgType>(portNum)
691  );
692 
693  return this->m_fileOut_OutputPort[portNum].isConnected();
694  }
695 
698  {
699  FW_ASSERT(
700  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
701  static_cast<FwAssertArgType>(portNum)
702  );
703 
704  return this->m_unknownDataOut_OutputPort[portNum].isConnected();
705  }
706 
707  // ----------------------------------------------------------------------
708  // Port handler base-class functions for typed input ports
709  //
710  // Call these functions directly to bypass the corresponding ports
711  // ----------------------------------------------------------------------
712 
715  FwIndexType portNum,
716  FwOpcodeType opCode,
717  U32 cmdSeq,
718  const Fw::CmdResponse& response
719  )
720  {
721  // Make sure port number is valid
722  FW_ASSERT(
723  (0 <= portNum) && (portNum < this->getNum_cmdResponseIn_InputPorts()),
724  static_cast<FwAssertArgType>(portNum)
725  );
726 
727  // Call handler function
728  this->cmdResponseIn_handler(
729  portNum,
730  opCode,
731  cmdSeq,
732  response
733  );
734  }
735 
738  FwIndexType portNum,
739  Fw::Buffer& data,
740  const ComCfg::FrameContext& context
741  )
742  {
743  // Make sure port number is valid
744  FW_ASSERT(
745  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
746  static_cast<FwAssertArgType>(portNum)
747  );
748 
749  // Call handler function
750  this->dataIn_handler(
751  portNum,
752  data,
753  context
754  );
755  }
756 
759  FwIndexType portNum,
760  Fw::Buffer& fwBuffer
761  )
762  {
763  // Make sure port number is valid
764  FW_ASSERT(
765  (0 <= portNum) && (portNum < this->getNum_fileBufferReturnIn_InputPorts()),
766  static_cast<FwAssertArgType>(portNum)
767  );
768 
769  // Call handler function
771  portNum,
772  fwBuffer
773  );
774  }
775 
776  // ----------------------------------------------------------------------
777  // Invocation functions for typed output ports
778  // ----------------------------------------------------------------------
779 
782  FwIndexType portNum,
783  FwSizeType size
784  )
785  {
786  FW_ASSERT(
787  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
788  static_cast<FwAssertArgType>(portNum)
789  );
790 
791  FW_ASSERT(
792  this->m_bufferAllocate_OutputPort[portNum].isConnected(),
793  static_cast<FwAssertArgType>(portNum)
794  );
795  return this->m_bufferAllocate_OutputPort[portNum].invoke(
796  size
797  );
798  }
799 
802  FwIndexType portNum,
803  Fw::Buffer& fwBuffer
804  )
805  {
806  FW_ASSERT(
807  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
808  static_cast<FwAssertArgType>(portNum)
809  );
810 
811  FW_ASSERT(
812  this->m_bufferDeallocate_OutputPort[portNum].isConnected(),
813  static_cast<FwAssertArgType>(portNum)
814  );
815  this->m_bufferDeallocate_OutputPort[portNum].invoke(
816  fwBuffer
817  );
818  }
819 
822  FwIndexType portNum,
823  Fw::ComBuffer& data,
824  U32 context
825  )
826  {
827  FW_ASSERT(
828  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
829  static_cast<FwAssertArgType>(portNum)
830  );
831 
832  FW_ASSERT(
833  this->m_commandOut_OutputPort[portNum].isConnected(),
834  static_cast<FwAssertArgType>(portNum)
835  );
836  this->m_commandOut_OutputPort[portNum].invoke(
837  data,
838  context
839  );
840  }
841 
844  FwIndexType portNum,
845  Fw::Buffer& data,
846  const ComCfg::FrameContext& context
847  )
848  {
849  FW_ASSERT(
850  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
851  static_cast<FwAssertArgType>(portNum)
852  );
853 
854  FW_ASSERT(
855  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
856  static_cast<FwAssertArgType>(portNum)
857  );
858  this->m_dataReturnOut_OutputPort[portNum].invoke(
859  data,
860  context
861  );
862  }
863 
866  FwIndexType portNum,
867  Fw::Buffer& fwBuffer
868  )
869  {
870  FW_ASSERT(
871  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
872  static_cast<FwAssertArgType>(portNum)
873  );
874 
875  FW_ASSERT(
876  this->m_fileOut_OutputPort[portNum].isConnected(),
877  static_cast<FwAssertArgType>(portNum)
878  );
879  this->m_fileOut_OutputPort[portNum].invoke(
880  fwBuffer
881  );
882  }
883 
886  FwIndexType portNum,
887  Fw::Buffer& data,
888  const ComCfg::FrameContext& context
889  )
890  {
891  FW_ASSERT(
892  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
893  static_cast<FwAssertArgType>(portNum)
894  );
895 
896  FW_ASSERT(
897  this->m_unknownDataOut_OutputPort[portNum].isConnected(),
898  static_cast<FwAssertArgType>(portNum)
899  );
900  this->m_unknownDataOut_OutputPort[portNum].invoke(
901  data,
902  context
903  );
904  }
905 
906  // ----------------------------------------------------------------------
907  // Event logging functions
908  // ----------------------------------------------------------------------
909 
912  {
913  // Get the time
914  Fw::Time _logTime;
915  if (this->m_timeCaller_OutputPort[0].isConnected()) {
916  this->m_timeCaller_OutputPort[0].invoke(_logTime);
917  }
918 
919  FwEventIdType _id = static_cast<FwEventIdType>(0);
920 
921  _id = this->getIdBase() + EVENTID_SERIALIZATIONERROR;
922 
923  // Emit the event on the log port
924  if (this->m_logOut_OutputPort[0].isConnected()) {
925  Fw::LogBuffer _logBuff;
927 
928 #if FW_AMPCS_COMPATIBLE
929  // Serialize the number of arguments
930  _status = _logBuff.serializeFrom(static_cast<U8>(1));
931  FW_ASSERT(
932  _status == Fw::FW_SERIALIZE_OK,
933  static_cast<FwAssertArgType>(_status)
934  );
935 #endif
936 
937 #if FW_AMPCS_COMPATIBLE
938  // Serialize the argument size
939  _status = _logBuff.serializeFrom(
940  static_cast<U8>(sizeof(U32))
941  );
942  FW_ASSERT(
943  _status == Fw::FW_SERIALIZE_OK,
944  static_cast<FwAssertArgType>(_status)
945  );
946 #endif
947  _status = _logBuff.serializeFrom(status);
948  FW_ASSERT(
949  _status == Fw::FW_SERIALIZE_OK,
950  static_cast<FwAssertArgType>(_status)
951  );
952 
953  this->m_logOut_OutputPort[0].invoke(
954  _id,
955  _logTime,
957  _logBuff
958  );
959  }
960 
961  // Emit the event on the text log port
962 #if FW_ENABLE_TEXT_LOGGING
963  if (this->m_logTextOut_OutputPort[0].isConnected()) {
964 #if FW_OBJECT_NAMES == 1
965  const char* _formatString =
966  "(%s) %s: Serializing com buffer failed with status %" PRIu32 "";
967 #else
968  const char* _formatString =
969  "%s: Serializing com buffer failed with status %" PRIu32 "";
970 #endif
971 
972  Fw::TextLogString _logString;
973  _logString.format(
974  _formatString,
975 #if FW_OBJECT_NAMES == 1
976  this->m_objName.toChar(),
977 #endif
978  "SerializationError ",
979  status
980  );
981 
982  this->m_logTextOut_OutputPort[0].invoke(
983  _id,
984  _logTime,
986  _logString
987  );
988  }
989 #endif
990  }
991 
994  {
995  // Get the time
996  Fw::Time _logTime;
997  if (this->m_timeCaller_OutputPort[0].isConnected()) {
998  this->m_timeCaller_OutputPort[0].invoke(_logTime);
999  }
1000 
1001  FwEventIdType _id = static_cast<FwEventIdType>(0);
1002 
1003  _id = this->getIdBase() + EVENTID_DESERIALIZATIONERROR;
1004 
1005  // Emit the event on the log port
1006  if (this->m_logOut_OutputPort[0].isConnected()) {
1007  Fw::LogBuffer _logBuff;
1009 
1010 #if FW_AMPCS_COMPATIBLE
1011  // Serialize the number of arguments
1012  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1013  FW_ASSERT(
1014  _status == Fw::FW_SERIALIZE_OK,
1015  static_cast<FwAssertArgType>(_status)
1016  );
1017 #endif
1018 
1019 #if FW_AMPCS_COMPATIBLE
1020  // Serialize the argument size
1021  _status = _logBuff.serializeFrom(
1022  static_cast<U8>(sizeof(U32))
1023  );
1024  FW_ASSERT(
1025  _status == Fw::FW_SERIALIZE_OK,
1026  static_cast<FwAssertArgType>(_status)
1027  );
1028 #endif
1029  _status = _logBuff.serializeFrom(status);
1030  FW_ASSERT(
1031  _status == Fw::FW_SERIALIZE_OK,
1032  static_cast<FwAssertArgType>(_status)
1033  );
1034 
1035  this->m_logOut_OutputPort[0].invoke(
1036  _id,
1037  _logTime,
1039  _logBuff
1040  );
1041  }
1042 
1043  // Emit the event on the text log port
1044 #if FW_ENABLE_TEXT_LOGGING
1045  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1046 #if FW_OBJECT_NAMES == 1
1047  const char* _formatString =
1048  "(%s) %s: Deserializing packet type failed with status %" PRIu32 "";
1049 #else
1050  const char* _formatString =
1051  "%s: Deserializing packet type failed with status %" PRIu32 "";
1052 #endif
1053 
1054  Fw::TextLogString _logString;
1055  _logString.format(
1056  _formatString,
1057 #if FW_OBJECT_NAMES == 1
1058  this->m_objName.toChar(),
1059 #endif
1060  "DeserializationError ",
1061  status
1062  );
1063 
1064  this->m_logTextOut_OutputPort[0].invoke(
1065  _id,
1066  _logTime,
1068  _logString
1069  );
1070  }
1071 #endif
1072  }
1073 
1074  // ----------------------------------------------------------------------
1075  // Time
1076  // ----------------------------------------------------------------------
1077 
1079  getTime() const
1080  {
1081  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1082  Fw::Time _time;
1083  this->m_timeCaller_OutputPort[0].invoke(_time);
1084  return _time;
1085  }
1086  else {
1087  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1088  }
1089  }
1090 
1091  // ----------------------------------------------------------------------
1092  // Calls for messages received on typed input ports
1093  // ----------------------------------------------------------------------
1094 
1095  void FprimeRouterComponentBase ::
1096  m_p_cmdResponseIn_in(
1097  Fw::PassiveComponentBase* callComp,
1098  FwIndexType portNum,
1099  FwOpcodeType opCode,
1100  U32 cmdSeq,
1101  const Fw::CmdResponse& response
1102  )
1103  {
1104  FW_ASSERT(callComp);
1105  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1106  compPtr->cmdResponseIn_handlerBase(
1107  portNum,
1108  opCode,
1109  cmdSeq,
1110  response
1111  );
1112  }
1113 
1114  void FprimeRouterComponentBase ::
1115  m_p_dataIn_in(
1116  Fw::PassiveComponentBase* callComp,
1117  FwIndexType portNum,
1118  Fw::Buffer& data,
1119  const ComCfg::FrameContext& context
1120  )
1121  {
1122  FW_ASSERT(callComp);
1123  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1124  compPtr->dataIn_handlerBase(
1125  portNum,
1126  data,
1127  context
1128  );
1129  }
1130 
1131  void FprimeRouterComponentBase ::
1132  m_p_fileBufferReturnIn_in(
1133  Fw::PassiveComponentBase* callComp,
1134  FwIndexType portNum,
1135  Fw::Buffer& fwBuffer
1136  )
1137  {
1138  FW_ASSERT(callComp);
1139  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1140  compPtr->fileBufferReturnIn_handlerBase(
1141  portNum,
1142  fwBuffer
1143  );
1144  }
1145 
1146 }
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum)
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum)
An error occurred while serializing a com buffer.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void commandOut_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port commandOut.
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void invoke(Fw::ComBuffer &data, U32 context) const
Invoke a port interface.
Definition: ComPortAc.cpp:156
void init()
Initialization function.
Definition: ComPortAc.cpp:137
static constexpr FwIndexType getNum_dataIn_InputPorts()
virtual ~FprimeRouterComponentBase()
Destroy FprimeRouterComponentBase object.
static constexpr FwIndexType getNum_fileBufferReturnIn_InputPorts()
FwIdType FwOpcodeType
The type of a command opcode.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void fileBufferReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port fileBufferReturnIn.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
An error occurred while deserializing a packet.
bool isConnected_commandOut_OutputPort(FwIndexType portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
FprimeRouterComponentBase(const char *compName="")
Construct FprimeRouterComponentBase object.
static constexpr FwIndexType getNum_bufferDeallocate_OutputPorts()
static constexpr FwIndexType getNum_unknownDataOut_OutputPorts()
static constexpr FwIndexType getNum_bufferAllocate_OutputPorts()
void fileOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port fileOut.
Enum representing a command response.
No time base has been established (Required)
bool isConnected_fileOut_OutputPort(FwIndexType portNum)
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferDeallocate.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
Fw::Buffer bufferAllocate_out(FwIndexType portNum, FwSizeType size)
Invoke output port bufferAllocate.
Fw::InputCmdResponsePort * get_cmdResponseIn_InputPort(FwIndexType portNum)
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_commandOut_OutputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
SerializeStatus
forward declaration for string
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
FwIdType FwEventIdType
The type of an event identifier.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
Fw::InputBufferSendPort * get_fileBufferReturnIn_InputPort(FwIndexType portNum)
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port interface.
void cmdResponseIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port cmdResponseIn.
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port interface.
A serious but recoverable event.
void init()
Initialization function.
Auto-generated base for FprimeRouter component.
bool isConnected() const
Definition: PortBase.cpp:38
void set_fileOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to fileOut[portNum].
#define PRI_FwIndexType
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void setPortNum(FwIndexType portNum)
void unknownDataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port unknownDataOut.
static constexpr FwIndexType getNum_logOut_OutputPorts()
Fw::Buffer invoke(FwSizeType size) const
Invoke a port interface.
static constexpr FwIndexType getNum_fileOut_OutputPorts()
void init()
Initialization function.
void init()
Initialization function.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
void init()
Initialization function.
void set_unknownDataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to unknownDataOut[portNum].
static constexpr FwIndexType getNum_cmdResponseIn_InputPorts()
PlatformIndexType FwIndexType
void log_WARNING_HI_DeserializationError(U32 status) const
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void log_WARNING_HI_SerializationError(U32 status) const
Type used to pass context info between components during framing/deframing.
void init()
Initialization function.
RateGroupDivider component implementation.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
void set_commandOut_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to commandOut[portNum].
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:143
virtual void cmdResponseIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port cmdResponseIn.
Implementation of malloc based allocator.
bool isConnected_unknownDataOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
virtual void fileBufferReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port fileBufferReturnIn.