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  // Getters for numbers of typed input ports
598  // ----------------------------------------------------------------------
599 
602  {
603  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseIn_InputPort));
604  }
605 
608  {
609  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataIn_InputPort));
610  }
611 
614  {
615  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_fileBufferReturnIn_InputPort));
616  }
617 
618  // ----------------------------------------------------------------------
619  // Getters for numbers of special output ports
620  // ----------------------------------------------------------------------
621 
624  {
625  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
626  }
627 
628 #if FW_ENABLE_TEXT_LOGGING == 1
629 
630  FwIndexType FprimeRouterComponentBase ::
631  getNum_logTextOut_OutputPorts() const
632  {
633  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logTextOut_OutputPort));
634  }
635 
636 #endif
637 
640  {
641  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
642  }
643 
644  // ----------------------------------------------------------------------
645  // Getters for numbers of typed output ports
646  // ----------------------------------------------------------------------
647 
650  {
651  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferAllocate_OutputPort));
652  }
653 
656  {
657  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferDeallocate_OutputPort));
658  }
659 
662  {
663  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_commandOut_OutputPort));
664  }
665 
668  {
669  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnOut_OutputPort));
670  }
671 
674  {
675  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_fileOut_OutputPort));
676  }
677 
680  {
681  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_unknownDataOut_OutputPort));
682  }
683 
684  // ----------------------------------------------------------------------
685  // Connection status queries for special output ports
686  // ----------------------------------------------------------------------
687 
690  {
691  FW_ASSERT(
692  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
693  static_cast<FwAssertArgType>(portNum)
694  );
695 
696  return this->m_logOut_OutputPort[portNum].isConnected();
697  }
698 
699 #if FW_ENABLE_TEXT_LOGGING == 1
700 
701  bool FprimeRouterComponentBase ::
702  isConnected_logTextOut_OutputPort(FwIndexType portNum)
703  {
704  FW_ASSERT(
705  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
706  static_cast<FwAssertArgType>(portNum)
707  );
708 
709  return this->m_logTextOut_OutputPort[portNum].isConnected();
710  }
711 
712 #endif
713 
716  {
717  FW_ASSERT(
718  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
719  static_cast<FwAssertArgType>(portNum)
720  );
721 
722  return this->m_timeCaller_OutputPort[portNum].isConnected();
723  }
724 
725  // ----------------------------------------------------------------------
726  // Connection status queries for typed output ports
727  // ----------------------------------------------------------------------
728 
731  {
732  FW_ASSERT(
733  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
734  static_cast<FwAssertArgType>(portNum)
735  );
736 
737  return this->m_bufferAllocate_OutputPort[portNum].isConnected();
738  }
739 
742  {
743  FW_ASSERT(
744  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
745  static_cast<FwAssertArgType>(portNum)
746  );
747 
748  return this->m_bufferDeallocate_OutputPort[portNum].isConnected();
749  }
750 
753  {
754  FW_ASSERT(
755  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
756  static_cast<FwAssertArgType>(portNum)
757  );
758 
759  return this->m_commandOut_OutputPort[portNum].isConnected();
760  }
761 
764  {
765  FW_ASSERT(
766  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
767  static_cast<FwAssertArgType>(portNum)
768  );
769 
770  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
771  }
772 
775  {
776  FW_ASSERT(
777  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
778  static_cast<FwAssertArgType>(portNum)
779  );
780 
781  return this->m_fileOut_OutputPort[portNum].isConnected();
782  }
783 
786  {
787  FW_ASSERT(
788  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
789  static_cast<FwAssertArgType>(portNum)
790  );
791 
792  return this->m_unknownDataOut_OutputPort[portNum].isConnected();
793  }
794 
795  // ----------------------------------------------------------------------
796  // Port handler base-class functions for typed input ports
797  //
798  // Call these functions directly to bypass the corresponding ports
799  // ----------------------------------------------------------------------
800 
803  FwIndexType portNum,
804  FwOpcodeType opCode,
805  U32 cmdSeq,
806  const Fw::CmdResponse& response
807  )
808  {
809  // Make sure port number is valid
810  FW_ASSERT(
811  (0 <= portNum) && (portNum < this->getNum_cmdResponseIn_InputPorts()),
812  static_cast<FwAssertArgType>(portNum)
813  );
814 
815  // Call handler function
816  this->cmdResponseIn_handler(
817  portNum,
818  opCode,
819  cmdSeq,
820  response
821  );
822  }
823 
826  FwIndexType portNum,
827  Fw::Buffer& data,
828  const ComCfg::FrameContext& context
829  )
830  {
831  // Make sure port number is valid
832  FW_ASSERT(
833  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
834  static_cast<FwAssertArgType>(portNum)
835  );
836 
837  // Call handler function
838  this->dataIn_handler(
839  portNum,
840  data,
841  context
842  );
843  }
844 
847  FwIndexType portNum,
848  Fw::Buffer& fwBuffer
849  )
850  {
851  // Make sure port number is valid
852  FW_ASSERT(
853  (0 <= portNum) && (portNum < this->getNum_fileBufferReturnIn_InputPorts()),
854  static_cast<FwAssertArgType>(portNum)
855  );
856 
857  // Call handler function
859  portNum,
860  fwBuffer
861  );
862  }
863 
864  // ----------------------------------------------------------------------
865  // Invocation functions for typed output ports
866  // ----------------------------------------------------------------------
867 
870  FwIndexType portNum,
871  U32 size
872  )
873  {
874  FW_ASSERT(
875  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
876  static_cast<FwAssertArgType>(portNum)
877  );
878 
879  FW_ASSERT(
880  this->m_bufferAllocate_OutputPort[portNum].isConnected(),
881  static_cast<FwAssertArgType>(portNum)
882  );
883  return this->m_bufferAllocate_OutputPort[portNum].invoke(
884  size
885  );
886  }
887 
890  FwIndexType portNum,
891  Fw::Buffer& fwBuffer
892  )
893  {
894  FW_ASSERT(
895  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
896  static_cast<FwAssertArgType>(portNum)
897  );
898 
899  FW_ASSERT(
900  this->m_bufferDeallocate_OutputPort[portNum].isConnected(),
901  static_cast<FwAssertArgType>(portNum)
902  );
903  this->m_bufferDeallocate_OutputPort[portNum].invoke(
904  fwBuffer
905  );
906  }
907 
910  FwIndexType portNum,
911  Fw::ComBuffer& data,
912  U32 context
913  )
914  {
915  FW_ASSERT(
916  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
917  static_cast<FwAssertArgType>(portNum)
918  );
919 
920  FW_ASSERT(
921  this->m_commandOut_OutputPort[portNum].isConnected(),
922  static_cast<FwAssertArgType>(portNum)
923  );
924  this->m_commandOut_OutputPort[portNum].invoke(
925  data,
926  context
927  );
928  }
929 
932  FwIndexType portNum,
933  Fw::Buffer& data,
934  const ComCfg::FrameContext& context
935  )
936  {
937  FW_ASSERT(
938  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
939  static_cast<FwAssertArgType>(portNum)
940  );
941 
942  FW_ASSERT(
943  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
944  static_cast<FwAssertArgType>(portNum)
945  );
946  this->m_dataReturnOut_OutputPort[portNum].invoke(
947  data,
948  context
949  );
950  }
951 
954  FwIndexType portNum,
955  Fw::Buffer& fwBuffer
956  )
957  {
958  FW_ASSERT(
959  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
960  static_cast<FwAssertArgType>(portNum)
961  );
962 
963  FW_ASSERT(
964  this->m_fileOut_OutputPort[portNum].isConnected(),
965  static_cast<FwAssertArgType>(portNum)
966  );
967  this->m_fileOut_OutputPort[portNum].invoke(
968  fwBuffer
969  );
970  }
971 
974  FwIndexType portNum,
975  Fw::Buffer& data,
976  const ComCfg::FrameContext& context
977  )
978  {
979  FW_ASSERT(
980  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
981  static_cast<FwAssertArgType>(portNum)
982  );
983 
984  FW_ASSERT(
985  this->m_unknownDataOut_OutputPort[portNum].isConnected(),
986  static_cast<FwAssertArgType>(portNum)
987  );
988  this->m_unknownDataOut_OutputPort[portNum].invoke(
989  data,
990  context
991  );
992  }
993 
994  // ----------------------------------------------------------------------
995  // Event logging functions
996  // ----------------------------------------------------------------------
997 
1000  {
1001  // Get the time
1002  Fw::Time _logTime;
1003  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1004  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1005  }
1006 
1007  FwEventIdType _id = static_cast<FwEventIdType>(0);
1008 
1009  _id = this->getIdBase() + EVENTID_SERIALIZATIONERROR;
1010 
1011  // Emit the event on the log port
1012  if (this->m_logOut_OutputPort[0].isConnected()) {
1013  Fw::LogBuffer _logBuff;
1015 
1016 #if FW_AMPCS_COMPATIBLE
1017  // Serialize the number of arguments
1018  _status = _logBuff.serialize(static_cast<U8>(1));
1019  FW_ASSERT(
1020  _status == Fw::FW_SERIALIZE_OK,
1021  static_cast<FwAssertArgType>(_status)
1022  );
1023 #endif
1024 
1025 #if FW_AMPCS_COMPATIBLE
1026  // Serialize the argument size
1027  _status = _logBuff.serialize(
1028  static_cast<U8>(sizeof(U32))
1029  );
1030  FW_ASSERT(
1031  _status == Fw::FW_SERIALIZE_OK,
1032  static_cast<FwAssertArgType>(_status)
1033  );
1034 #endif
1035  _status = _logBuff.serialize(status);
1036  FW_ASSERT(
1037  _status == Fw::FW_SERIALIZE_OK,
1038  static_cast<FwAssertArgType>(_status)
1039  );
1040 
1041  this->m_logOut_OutputPort[0].invoke(
1042  _id,
1043  _logTime,
1045  _logBuff
1046  );
1047  }
1048 
1049  // Emit the event on the text log port
1050 #if FW_ENABLE_TEXT_LOGGING
1051  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1052 #if FW_OBJECT_NAMES == 1
1053  const char* _formatString =
1054  "(%s) %s: Serializing com buffer failed with status %" PRIu32 "";
1055 #else
1056  const char* _formatString =
1057  "%s: Serializing com buffer failed with status %" PRIu32 "";
1058 #endif
1059 
1060  Fw::TextLogString _logString;
1061  _logString.format(
1062  _formatString,
1063 #if FW_OBJECT_NAMES == 1
1064  this->m_objName.toChar(),
1065 #endif
1066  "SerializationError ",
1067  status
1068  );
1069 
1070  this->m_logTextOut_OutputPort[0].invoke(
1071  _id,
1072  _logTime,
1074  _logString
1075  );
1076  }
1077 #endif
1078  }
1079 
1082  {
1083  // Get the time
1084  Fw::Time _logTime;
1085  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1086  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1087  }
1088 
1089  FwEventIdType _id = static_cast<FwEventIdType>(0);
1090 
1091  _id = this->getIdBase() + EVENTID_DESERIALIZATIONERROR;
1092 
1093  // Emit the event on the log port
1094  if (this->m_logOut_OutputPort[0].isConnected()) {
1095  Fw::LogBuffer _logBuff;
1097 
1098 #if FW_AMPCS_COMPATIBLE
1099  // Serialize the number of arguments
1100  _status = _logBuff.serialize(static_cast<U8>(1));
1101  FW_ASSERT(
1102  _status == Fw::FW_SERIALIZE_OK,
1103  static_cast<FwAssertArgType>(_status)
1104  );
1105 #endif
1106 
1107 #if FW_AMPCS_COMPATIBLE
1108  // Serialize the argument size
1109  _status = _logBuff.serialize(
1110  static_cast<U8>(sizeof(U32))
1111  );
1112  FW_ASSERT(
1113  _status == Fw::FW_SERIALIZE_OK,
1114  static_cast<FwAssertArgType>(_status)
1115  );
1116 #endif
1117  _status = _logBuff.serialize(status);
1118  FW_ASSERT(
1119  _status == Fw::FW_SERIALIZE_OK,
1120  static_cast<FwAssertArgType>(_status)
1121  );
1122 
1123  this->m_logOut_OutputPort[0].invoke(
1124  _id,
1125  _logTime,
1127  _logBuff
1128  );
1129  }
1130 
1131  // Emit the event on the text log port
1132 #if FW_ENABLE_TEXT_LOGGING
1133  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1134 #if FW_OBJECT_NAMES == 1
1135  const char* _formatString =
1136  "(%s) %s: Deserializing packet type failed with status %" PRIu32 "";
1137 #else
1138  const char* _formatString =
1139  "%s: Deserializing packet type failed with status %" PRIu32 "";
1140 #endif
1141 
1142  Fw::TextLogString _logString;
1143  _logString.format(
1144  _formatString,
1145 #if FW_OBJECT_NAMES == 1
1146  this->m_objName.toChar(),
1147 #endif
1148  "DeserializationError ",
1149  status
1150  );
1151 
1152  this->m_logTextOut_OutputPort[0].invoke(
1153  _id,
1154  _logTime,
1156  _logString
1157  );
1158  }
1159 #endif
1160  }
1161 
1162  // ----------------------------------------------------------------------
1163  // Time
1164  // ----------------------------------------------------------------------
1165 
1167  getTime() const
1168  {
1169  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1170  Fw::Time _time;
1171  this->m_timeCaller_OutputPort[0].invoke(_time);
1172  return _time;
1173  }
1174  else {
1175  return Fw::Time(TB_NONE, 0, 0);
1176  }
1177  }
1178 
1179  // ----------------------------------------------------------------------
1180  // Calls for messages received on typed input ports
1181  // ----------------------------------------------------------------------
1182 
1183  void FprimeRouterComponentBase ::
1184  m_p_cmdResponseIn_in(
1185  Fw::PassiveComponentBase* callComp,
1186  FwIndexType portNum,
1187  FwOpcodeType opCode,
1188  U32 cmdSeq,
1189  const Fw::CmdResponse& response
1190  )
1191  {
1192  FW_ASSERT(callComp);
1193  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1194  compPtr->cmdResponseIn_handlerBase(
1195  portNum,
1196  opCode,
1197  cmdSeq,
1198  response
1199  );
1200  }
1201 
1202  void FprimeRouterComponentBase ::
1203  m_p_dataIn_in(
1204  Fw::PassiveComponentBase* callComp,
1205  FwIndexType portNum,
1206  Fw::Buffer& data,
1207  const ComCfg::FrameContext& context
1208  )
1209  {
1210  FW_ASSERT(callComp);
1211  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1212  compPtr->dataIn_handlerBase(
1213  portNum,
1214  data,
1215  context
1216  );
1217  }
1218 
1219  void FprimeRouterComponentBase ::
1220  m_p_fileBufferReturnIn_in(
1221  Fw::PassiveComponentBase* callComp,
1222  FwIndexType portNum,
1223  Fw::Buffer& fwBuffer
1224  )
1225  {
1226  FW_ASSERT(callComp);
1227  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1228  compPtr->fileBufferReturnIn_handlerBase(
1229  portNum,
1230  fwBuffer
1231  );
1232  }
1233 
1234 }
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum)
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum)
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
Definition: Time.hpp:9
void init()
Initialization function.
Definition: ComPortAc.cpp:137
virtual ~FprimeRouterComponentBase()
Destroy FprimeRouterComponentBase object.
FwIdType FwOpcodeType
The type of a command opcode.
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.
I32 FwEnumStoreType
bool isConnected_commandOut_OutputPort(FwIndexType portNum)
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Fw::Buffer invoke(U32 size) const
Invoke a port interface.
FprimeRouterComponentBase(const char *compName="")
Construct FprimeRouterComponentBase object.
Fw::Buffer bufferAllocate_out(FwIndexType portNum, U32 size)
Invoke output port bufferAllocate.
void fileOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port fileOut.
Enum representing a command response.
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::InputCmdResponsePort * get_cmdResponseIn_InputPort(FwIndexType portNum)
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
void init()
Object initializer.
Definition: ObjBase.cpp:26
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.
FwIndexType getNum_bufferDeallocate_OutputPorts() const
FwIdType FwEventIdType
The type of an event identifier.
An error occurred while deserializing a packet.
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].
FwIndexType getNum_bufferAllocate_OutputPorts() const
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:53
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.
FwIndexType getNum_cmdResponseIn_InputPorts() const
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
Definition: ObjectName.hpp:50
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:42
void set_fileOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to fileOut[portNum].
#define PRI_FwIndexType
An error occurred while serializing a com buffer.
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:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
FwIndexType getNum_fileBufferReturnIn_InputPorts() const
void setPortNum(FwIndexType portNum)
void unknownDataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port unknownDataOut.
FwIndexType getNum_unknownDataOut_OutputPorts() const
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].
No time base has been established.
Definition: FpConfig.h:30
PlatformIndexType FwIndexType
void log_WARNING_HI_DeserializationError(U32 status) const
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:93
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.
bool isConnected_unknownDataOut_OutputPort(FwIndexType portNum)
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
FwIndexType getNum_dataReturnOut_OutputPorts() const
virtual void fileBufferReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port fileBufferReturnIn.