F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FprimeRouterComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FprimeRouterComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FprimeRouter component base class
5 // ======================================================================
6 
7 #ifndef Svc_FprimeRouterComponentAc_HPP
8 #define Svc_FprimeRouterComponentAc_HPP
9 
10 #include <atomic>
11 
15 #include "Fw/Com/ComPortAc.hpp"
17 #include "Fw/FPrimeBasicTypes.hpp"
18 #include "Fw/Log/LogPortAc.hpp"
19 #include "Fw/Log/LogString.hpp"
20 #if FW_ENABLE_TEXT_LOGGING == 1
21 #include "Fw/Log/LogTextPortAc.hpp"
22 #endif
25 #include "Fw/Time/TimePortAc.hpp"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
43  friend class FprimeRouterTesterBase;
45  friend class FprimeRouterTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
58  };
59 
61  enum {
65  };
66 
68  enum {
75  };
76 
78  enum {
81  };
82 
83  public:
84 
85  // ----------------------------------------------------------------------
86  // Component initialization
87  // ----------------------------------------------------------------------
88 
90  void init(
91  FwEnumStoreType instance = 0
92  );
93 
94  public:
95 
96  // ----------------------------------------------------------------------
97  // Getters for typed input ports
98  // ----------------------------------------------------------------------
99 
104  FwIndexType portNum
105  );
106 
111  FwIndexType portNum
112  );
113 
118  FwIndexType portNum
119  );
120 
121  public:
122 
123  // ----------------------------------------------------------------------
124  // Connect input ports to special output ports
125  // ----------------------------------------------------------------------
126 
129  FwIndexType portNum,
130  Fw::InputLogPort* port
131  );
132 
133 #if FW_ENABLE_TEXT_LOGGING == 1
134 
136  void set_logTextOut_OutputPort(
137  FwIndexType portNum,
138  Fw::InputLogTextPort* port
139  );
140 
141 #endif
142 
145  FwIndexType portNum,
146  Fw::InputTimePort* port
147  );
148 
149  public:
150 
151  // ----------------------------------------------------------------------
152  // Connect typed input ports to typed output ports
153  // ----------------------------------------------------------------------
154 
157  FwIndexType portNum,
159  );
160 
163  FwIndexType portNum,
165  );
166 
169  FwIndexType portNum,
170  Fw::InputComPort* port
171  );
172 
175  FwIndexType portNum,
177  );
178 
181  FwIndexType portNum,
183  );
184 
187  FwIndexType portNum,
189  );
190 
191 #if FW_PORT_SERIALIZATION
192 
193  public:
194 
195  // ----------------------------------------------------------------------
196  // Connect serial input ports to special output ports
197  // ----------------------------------------------------------------------
198 
201  FwIndexType portNum,
202  Fw::InputSerializePort* port
203  );
204 
205 #if FW_ENABLE_TEXT_LOGGING == 1
206 
208  void set_logTextOut_OutputPort(
209  FwIndexType portNum,
210  Fw::InputSerializePort* port
211  );
212 
213 #endif
214 
217  FwIndexType portNum,
218  Fw::InputSerializePort* port
219  );
220 
221 #endif
222 
223 #if FW_PORT_SERIALIZATION
224 
225  public:
226 
227  // ----------------------------------------------------------------------
228  // Connect serial input ports to typed output ports
229  // ----------------------------------------------------------------------
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
245  FwIndexType portNum,
246  Fw::InputSerializePort* port
247  );
248 
251  FwIndexType portNum,
252  Fw::InputSerializePort* port
253  );
254 
257  FwIndexType portNum,
258  Fw::InputSerializePort* port
259  );
260 
261 #endif
262 
263  protected:
264 
265  // ----------------------------------------------------------------------
266  // Component construction and destruction
267  // ----------------------------------------------------------------------
268 
271  const char* compName = ""
272  );
273 
275  virtual ~FprimeRouterComponentBase();
276 
277  protected:
278 
279  // ----------------------------------------------------------------------
280  // Getters for numbers of typed input ports
281  // ----------------------------------------------------------------------
282 
288  }
289 
294  return NUM_DATAIN_INPUT_PORTS;
295  }
296 
302  }
303 
304  protected:
305 
306  // ----------------------------------------------------------------------
307  // Getters for numbers of special output ports
308  // ----------------------------------------------------------------------
309 
315  }
316 
317 #if FW_ENABLE_TEXT_LOGGING == 1
318 
322  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
324  }
325 
326 #endif
327 
333  }
334 
335  protected:
336 
337  // ----------------------------------------------------------------------
338  // Getters for numbers of typed output ports
339  // ----------------------------------------------------------------------
340 
346  }
347 
353  }
354 
360  }
361 
367  }
368 
374  }
375 
381  }
382 
383  protected:
384 
385  // ----------------------------------------------------------------------
386  // Connection status queries for special output ports
387  // ----------------------------------------------------------------------
388 
393  FwIndexType portNum
394  );
395 
396 #if FW_ENABLE_TEXT_LOGGING == 1
397 
401  bool isConnected_logTextOut_OutputPort(
402  FwIndexType portNum
403  );
404 
405 #endif
406 
411  FwIndexType portNum
412  );
413 
414  protected:
415 
416  // ----------------------------------------------------------------------
417  // Connection status queries for typed output ports
418  // ----------------------------------------------------------------------
419 
424  FwIndexType portNum
425  );
426 
431  FwIndexType portNum
432  );
433 
438  FwIndexType portNum
439  );
440 
445  FwIndexType portNum
446  );
447 
452  FwIndexType portNum
453  );
454 
459  FwIndexType portNum
460  );
461 
462  protected:
463 
464  // ----------------------------------------------------------------------
465  // Handlers to implement for typed input ports
466  // ----------------------------------------------------------------------
467 
469  virtual void cmdResponseIn_handler(
470  FwIndexType portNum,
471  FwOpcodeType opCode,
472  U32 cmdSeq,
473  const Fw::CmdResponse& response
474  ) = 0;
475 
477  virtual void dataIn_handler(
478  FwIndexType portNum,
479  Fw::Buffer& data,
480  const ComCfg::FrameContext& context
481  ) = 0;
482 
484  virtual void fileBufferReturnIn_handler(
485  FwIndexType portNum,
486  Fw::Buffer& fwBuffer
487  ) = 0;
488 
489  protected:
490 
491  // ----------------------------------------------------------------------
492  // Port handler base-class functions for typed input ports
493  //
494  // Call these functions directly to bypass the corresponding ports
495  // ----------------------------------------------------------------------
496 
499  FwIndexType portNum,
500  FwOpcodeType opCode,
501  U32 cmdSeq,
502  const Fw::CmdResponse& response
503  );
504 
506  void dataIn_handlerBase(
507  FwIndexType portNum,
508  Fw::Buffer& data,
509  const ComCfg::FrameContext& context
510  );
511 
514  FwIndexType portNum,
515  Fw::Buffer& fwBuffer
516  );
517 
518  protected:
519 
520  // ----------------------------------------------------------------------
521  // Invocation functions for typed output ports
522  // ----------------------------------------------------------------------
523 
526  FwIndexType portNum,
527  FwSizeType size
528  );
529 
532  FwIndexType portNum,
533  Fw::Buffer& fwBuffer
534  );
535 
537  void commandOut_out(
538  FwIndexType portNum,
539  Fw::ComBuffer& data,
540  U32 context
541  );
542 
544  void dataReturnOut_out(
545  FwIndexType portNum,
546  Fw::Buffer& data,
547  const ComCfg::FrameContext& context
548  );
549 
551  void fileOut_out(
552  FwIndexType portNum,
553  Fw::Buffer& fwBuffer
554  );
555 
557  void unknownDataOut_out(
558  FwIndexType portNum,
559  Fw::Buffer& data,
560  const ComCfg::FrameContext& context
561  );
562 
563  protected:
564 
565  // ----------------------------------------------------------------------
566  // Event logging functions
567  // ----------------------------------------------------------------------
568 
573  U32 status
574  ) const;
575 
580  U32 status
581  ) const;
582 
583  protected:
584 
585  // ----------------------------------------------------------------------
586  // Time
587  // ----------------------------------------------------------------------
588 
592  Fw::Time getTime() const;
593 
594  private:
595 
596  // ----------------------------------------------------------------------
597  // Calls for messages received on typed input ports
598  // ----------------------------------------------------------------------
599 
601  static void m_p_cmdResponseIn_in(
602  Fw::PassiveComponentBase* callComp,
603  FwIndexType portNum,
604  FwOpcodeType opCode,
605  U32 cmdSeq,
606  const Fw::CmdResponse& response
607  );
608 
610  static void m_p_dataIn_in(
611  Fw::PassiveComponentBase* callComp,
612  FwIndexType portNum,
613  Fw::Buffer& data,
614  const ComCfg::FrameContext& context
615  );
616 
618  static void m_p_fileBufferReturnIn_in(
619  Fw::PassiveComponentBase* callComp,
620  FwIndexType portNum,
621  Fw::Buffer& fwBuffer
622  );
623 
624  private:
625 
626  // ----------------------------------------------------------------------
627  // Typed input ports
628  // ----------------------------------------------------------------------
629 
631  Fw::InputCmdResponsePort m_cmdResponseIn_InputPort[NUM_CMDRESPONSEIN_INPUT_PORTS];
632 
635 
637  Fw::InputBufferSendPort m_fileBufferReturnIn_InputPort[NUM_FILEBUFFERRETURNIN_INPUT_PORTS];
638 
639  private:
640 
641  // ----------------------------------------------------------------------
642  // Special output ports
643  // ----------------------------------------------------------------------
644 
646  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
647 
648 #if FW_ENABLE_TEXT_LOGGING == 1
649 
651  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
652 
653 #endif
654 
656  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
657 
658  private:
659 
660  // ----------------------------------------------------------------------
661  // Typed output ports
662  // ----------------------------------------------------------------------
663 
665  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
666 
668  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
669 
671  Fw::OutputComPort m_commandOut_OutputPort[NUM_COMMANDOUT_OUTPUT_PORTS];
672 
675 
678 
681 
682  };
683 
684 }
685 
686 #endif
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.
friend class FprimeRouterTester
Friend class tester implementation to support white-box testing.
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.
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.
friend class FprimeRouterTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_commandOut_OutputPort(FwIndexType portNum)
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.
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)
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].
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].
Fw::InputBufferSendPort * get_fileBufferReturnIn_InputPort(FwIndexType portNum)
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void cmdResponseIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port cmdResponseIn.
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
Auto-generated base for FprimeRouter component.
void set_fileOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to fileOut[portNum].
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void unknownDataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port unknownDataOut.
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_fileOut_OutputPorts()
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 log_WARNING_HI_SerializationError(U32 status) const
Type used to pass context info between components during framing/deframing.
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].
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)
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.
virtual void fileBufferReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port fileBufferReturnIn.