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"
28 
29 namespace Svc {
30 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
44  friend class FprimeRouterTesterBase;
46  friend class FprimeRouterTester;
47 
48  protected:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
59  };
60 
62  enum {
66  };
67 
69  enum {
76  };
77 
79  enum {
83  };
84 
85  public:
86 
87  // ----------------------------------------------------------------------
88  // Component initialization
89  // ----------------------------------------------------------------------
90 
92  void init(
93  FwEnumStoreType instance = 0
94  );
95 
96  public:
97 
98  // ----------------------------------------------------------------------
99  // Getters for typed input ports
100  // ----------------------------------------------------------------------
101 
106  FwIndexType portNum
107  );
108 
113  FwIndexType portNum
114  );
115 
120  FwIndexType portNum
121  );
122 
123  public:
124 
125  // ----------------------------------------------------------------------
126  // Connect input ports to special output ports
127  // ----------------------------------------------------------------------
128 
131  FwIndexType portNum,
132  Fw::InputLogPort* port
133  );
134 
135 #if FW_ENABLE_TEXT_LOGGING == 1
136 
138  void set_logTextOut_OutputPort(
139  FwIndexType portNum,
140  Fw::InputLogTextPort* port
141  );
142 
143 #endif
144 
147  FwIndexType portNum,
148  Fw::InputTimePort* port
149  );
150 
151  public:
152 
153  // ----------------------------------------------------------------------
154  // Connect typed input ports to typed output ports
155  // ----------------------------------------------------------------------
156 
159  FwIndexType portNum,
161  );
162 
165  FwIndexType portNum,
167  );
168 
171  FwIndexType portNum,
172  Fw::InputComPort* port
173  );
174 
177  FwIndexType portNum,
179  );
180 
183  FwIndexType portNum,
185  );
186 
189  FwIndexType portNum,
191  );
192 
193 #if FW_PORT_SERIALIZATION
194 
195  public:
196 
197  // ----------------------------------------------------------------------
198  // Connect serial input ports to special output ports
199  // ----------------------------------------------------------------------
200 
203  FwIndexType portNum,
204  Fw::InputSerializePort* port
205  );
206 
207 #if FW_ENABLE_TEXT_LOGGING == 1
208 
210  void set_logTextOut_OutputPort(
211  FwIndexType portNum,
212  Fw::InputSerializePort* port
213  );
214 
215 #endif
216 
219  FwIndexType portNum,
220  Fw::InputSerializePort* port
221  );
222 
223 #endif
224 
225 #if FW_PORT_SERIALIZATION
226 
227  public:
228 
229  // ----------------------------------------------------------------------
230  // Connect serial input ports to typed output ports
231  // ----------------------------------------------------------------------
232 
235  FwIndexType portNum,
236  Fw::InputSerializePort* port
237  );
238 
241  FwIndexType portNum,
242  Fw::InputSerializePort* port
243  );
244 
247  FwIndexType portNum,
248  Fw::InputSerializePort* port
249  );
250 
253  FwIndexType portNum,
254  Fw::InputSerializePort* port
255  );
256 
259  FwIndexType portNum,
260  Fw::InputSerializePort* port
261  );
262 
263 #endif
264 
265  protected:
266 
267  // ----------------------------------------------------------------------
268  // Component construction and destruction
269  // ----------------------------------------------------------------------
270 
273  const char* compName = ""
274  );
275 
277  virtual ~FprimeRouterComponentBase();
278 
279  protected:
280 
281  // ----------------------------------------------------------------------
282  // Getters for numbers of typed input ports
283  // ----------------------------------------------------------------------
284 
290  }
291 
296  return NUM_DATAIN_INPUT_PORTS;
297  }
298 
304  }
305 
306  protected:
307 
308  // ----------------------------------------------------------------------
309  // Getters for numbers of special output ports
310  // ----------------------------------------------------------------------
311 
317  }
318 
319 #if FW_ENABLE_TEXT_LOGGING == 1
320 
324  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
326  }
327 
328 #endif
329 
335  }
336 
337  protected:
338 
339  // ----------------------------------------------------------------------
340  // Getters for numbers of typed output ports
341  // ----------------------------------------------------------------------
342 
348  }
349 
355  }
356 
362  }
363 
369  }
370 
376  }
377 
383  }
384 
385  protected:
386 
387  // ----------------------------------------------------------------------
388  // Connection status queries for special output ports
389  // ----------------------------------------------------------------------
390 
395  FwIndexType portNum
396  );
397 
398 #if FW_ENABLE_TEXT_LOGGING == 1
399 
403  bool isConnected_logTextOut_OutputPort(
404  FwIndexType portNum
405  );
406 
407 #endif
408 
413  FwIndexType portNum
414  );
415 
416  protected:
417 
418  // ----------------------------------------------------------------------
419  // Connection status queries for typed output ports
420  // ----------------------------------------------------------------------
421 
426  FwIndexType portNum
427  );
428 
433  FwIndexType portNum
434  );
435 
440  FwIndexType portNum
441  );
442 
447  FwIndexType portNum
448  );
449 
454  FwIndexType portNum
455  );
456 
461  FwIndexType portNum
462  );
463 
464  protected:
465 
466  // ----------------------------------------------------------------------
467  // Handlers to implement for typed input ports
468  // ----------------------------------------------------------------------
469 
471  virtual void cmdResponseIn_handler(
472  FwIndexType portNum,
473  FwOpcodeType opCode,
474  U32 cmdSeq,
475  const Fw::CmdResponse& response
476  ) = 0;
477 
479  virtual void dataIn_handler(
480  FwIndexType portNum,
481  Fw::Buffer& data,
482  const ComCfg::FrameContext& context
483  ) = 0;
484 
486  virtual void fileBufferReturnIn_handler(
487  FwIndexType portNum,
488  Fw::Buffer& fwBuffer
489  ) = 0;
490 
491  protected:
492 
493  // ----------------------------------------------------------------------
494  // Port handler base-class functions for typed input ports
495  //
496  // Call these functions directly to bypass the corresponding ports
497  // ----------------------------------------------------------------------
498 
501  FwIndexType portNum,
502  FwOpcodeType opCode,
503  U32 cmdSeq,
504  const Fw::CmdResponse& response
505  );
506 
508  void dataIn_handlerBase(
509  FwIndexType portNum,
510  Fw::Buffer& data,
511  const ComCfg::FrameContext& context
512  );
513 
516  FwIndexType portNum,
517  Fw::Buffer& fwBuffer
518  );
519 
520  protected:
521 
522  // ----------------------------------------------------------------------
523  // Invocation functions for typed output ports
524  // ----------------------------------------------------------------------
525 
528  FwIndexType portNum,
529  FwSizeType size
530  );
531 
534  FwIndexType portNum,
535  Fw::Buffer& fwBuffer
536  );
537 
539  void commandOut_out(
540  FwIndexType portNum,
541  Fw::ComBuffer& data,
542  U32 context
543  );
544 
546  void dataReturnOut_out(
547  FwIndexType portNum,
548  Fw::Buffer& data,
549  const ComCfg::FrameContext& context
550  );
551 
553  void fileOut_out(
554  FwIndexType portNum,
555  Fw::Buffer& fwBuffer
556  );
557 
559  void unknownDataOut_out(
560  FwIndexType portNum,
561  Fw::Buffer& data,
562  const ComCfg::FrameContext& context
563  );
564 
565  protected:
566 
567  // ----------------------------------------------------------------------
568  // Event logging functions
569  // ----------------------------------------------------------------------
570 
575  U32 status
576  ) const;
577 
582  U32 status
583  ) const;
584 
589 
590  protected:
591 
592  // ----------------------------------------------------------------------
593  // Time
594  // ----------------------------------------------------------------------
595 
599  Fw::Time getTime() const;
600 
601  private:
602 
603  // ----------------------------------------------------------------------
604  // Calls for messages received on typed input ports
605  // ----------------------------------------------------------------------
606 
608  static void m_p_cmdResponseIn_in(
609  Fw::PassiveComponentBase* callComp,
610  FwIndexType portNum,
611  FwOpcodeType opCode,
612  U32 cmdSeq,
613  const Fw::CmdResponse& response
614  );
615 
617  static void m_p_dataIn_in(
618  Fw::PassiveComponentBase* callComp,
619  FwIndexType portNum,
620  Fw::Buffer& data,
621  const ComCfg::FrameContext& context
622  );
623 
625  static void m_p_fileBufferReturnIn_in(
626  Fw::PassiveComponentBase* callComp,
627  FwIndexType portNum,
628  Fw::Buffer& fwBuffer
629  );
630 
631  private:
632 
633  // ----------------------------------------------------------------------
634  // Typed input ports
635  // ----------------------------------------------------------------------
636 
638  Fw::InputCmdResponsePort m_cmdResponseIn_InputPort[NUM_CMDRESPONSEIN_INPUT_PORTS];
639 
642 
644  Fw::InputBufferSendPort m_fileBufferReturnIn_InputPort[NUM_FILEBUFFERRETURNIN_INPUT_PORTS];
645 
646  private:
647 
648  // ----------------------------------------------------------------------
649  // Special output ports
650  // ----------------------------------------------------------------------
651 
653  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
654 
655 #if FW_ENABLE_TEXT_LOGGING == 1
656 
658  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
659 
660 #endif
661 
663  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
664 
665  private:
666 
667  // ----------------------------------------------------------------------
668  // Typed output ports
669  // ----------------------------------------------------------------------
670 
672  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
673 
675  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
676 
678  Fw::OutputComPort m_commandOut_OutputPort[NUM_COMMANDOUT_OUTPUT_PORTS];
679 
682 
685 
688 
689  };
690 
691 }
692 
693 #endif
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.
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
friend class FprimeRouterTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_commandOut_OutputPort(FwIndexType portNum)
FprimeRouterComponentBase(const char *compName="")
Construct FprimeRouterComponentBase object.
An error occurred while serializing a com buffer.
static constexpr FwIndexType getNum_bufferDeallocate_OutputPorts()
static constexpr FwIndexType getNum_unknownDataOut_OutputPorts()
An error occurred while deserializing a packet.
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 log_WARNING_HI_AllocationError(Svc::FprimeRouter_AllocationReason reason) const
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.