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 
14 #include "Fw/Com/ComPortAc.hpp"
16 #include "Fw/FPrimeBasicTypes.hpp"
17 #include "Fw/Log/LogPortAc.hpp"
18 #include "Fw/Log/LogString.hpp"
19 #if FW_ENABLE_TEXT_LOGGING == 1
20 #include "Fw/Log/LogTextPortAc.hpp"
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
25 #if !FW_DIRECT_PORT_CALLS
27 #endif
28 #include "Fw/Time/TimePortAc.hpp"
30 
31 namespace Svc {
32 
39  {
40 
41  // ----------------------------------------------------------------------
42  // Friend classes
43  // ----------------------------------------------------------------------
44 
46  friend class FprimeRouterTesterBase;
48  friend class FprimeRouterTester;
49 
50  protected:
51 
52  // ----------------------------------------------------------------------
53  // Constants
54  // ----------------------------------------------------------------------
55 
57  enum {
61  };
62 
64  enum {
68  };
69 
71  enum {
76  };
77 
79  enum {
82  };
83 
84  public:
85 
86  // ----------------------------------------------------------------------
87  // Component initialization
88  // ----------------------------------------------------------------------
89 
91  void init(
92  FwEnumStoreType instance = 0
93  );
94 
95 #if !FW_DIRECT_PORT_CALLS
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Getters for typed input ports
101  // ----------------------------------------------------------------------
102 
107  FwIndexType portNum
108  );
109 
114  FwIndexType portNum
115  );
116 
121  FwIndexType portNum
122  );
123 
124 #endif
125 
126 #if !FW_DIRECT_PORT_CALLS
127 
128  public:
129 
130  // ----------------------------------------------------------------------
131  // Connect input ports to special output ports
132  // ----------------------------------------------------------------------
133 
136  FwIndexType portNum,
137  Fw::InputLogPort* port
138  );
139 
140 #if FW_ENABLE_TEXT_LOGGING == 1
141 
143  void set_logTextOut_OutputPort(
144  FwIndexType portNum,
145  Fw::InputLogTextPort* port
146  );
147 
148 #endif
149 
152  FwIndexType portNum,
153  Fw::InputTimePort* port
154  );
155 
156 #endif
157 
158 #if !FW_DIRECT_PORT_CALLS
159 
160  public:
161 
162  // ----------------------------------------------------------------------
163  // Connect typed input ports to typed output ports
164  // ----------------------------------------------------------------------
165 
168  FwIndexType portNum,
169  Fw::InputComPort* port
170  );
171 
174  FwIndexType portNum,
176  );
177 
180  FwIndexType portNum,
182  );
183 
186  FwIndexType portNum,
188  );
189 
190 #endif
191 
192 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
193 
194  public:
195 
196  // ----------------------------------------------------------------------
197  // Connect serial input ports to special output ports
198  // ----------------------------------------------------------------------
199 
202  FwIndexType portNum,
203  Fw::InputSerializePort* port
204  );
205 
206 #if FW_ENABLE_TEXT_LOGGING == 1
207 
209  void set_logTextOut_OutputPort(
210  FwIndexType portNum,
211  Fw::InputSerializePort* port
212  );
213 
214 #endif
215 
218  FwIndexType portNum,
219  Fw::InputSerializePort* port
220  );
221 
222 #endif
223 
224 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
225 
226  public:
227 
228  // ----------------------------------------------------------------------
229  // Connect serial input ports to typed output ports
230  // ----------------------------------------------------------------------
231 
234  FwIndexType portNum,
235  Fw::InputSerializePort* port
236  );
237 
240  FwIndexType portNum,
241  Fw::InputSerializePort* port
242  );
243 
246  FwIndexType portNum,
247  Fw::InputSerializePort* port
248  );
249 
252  FwIndexType portNum,
253  Fw::InputSerializePort* port
254  );
255 
256 #endif
257 
258  protected:
259 
260  // ----------------------------------------------------------------------
261  // Component construction and destruction
262  // ----------------------------------------------------------------------
263 
266  const char* compName = ""
267  );
268 
270  virtual ~FprimeRouterComponentBase();
271 
272  protected:
273 
274  // ----------------------------------------------------------------------
275  // Getters for numbers of typed input ports
276  // ----------------------------------------------------------------------
277 
283  }
284 
289  return NUM_DATAIN_INPUT_PORTS;
290  }
291 
297  }
298 
299  protected:
300 
301  // ----------------------------------------------------------------------
302  // Getters for numbers of special output ports
303  // ----------------------------------------------------------------------
304 
310  }
311 
312 #if FW_ENABLE_TEXT_LOGGING == 1
313 
317  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
319  }
320 
321 #endif
322 
328  }
329 
330  protected:
331 
332  // ----------------------------------------------------------------------
333  // Getters for numbers of typed output ports
334  // ----------------------------------------------------------------------
335 
341  }
342 
348  }
349 
355  }
356 
362  }
363 
364  protected:
365 
366  // ----------------------------------------------------------------------
367  // Connection status queries for special output ports
368  // ----------------------------------------------------------------------
369 
374  FwIndexType portNum
375  ) const;
376 
377 #if FW_ENABLE_TEXT_LOGGING == 1
378 
382  bool isConnected_logTextOut_OutputPort(
383  FwIndexType portNum
384  ) const;
385 
386 #endif
387 
392  FwIndexType portNum
393  ) const;
394 
395  protected:
396 
397  // ----------------------------------------------------------------------
398  // Connection status queries for typed output ports
399  // ----------------------------------------------------------------------
400 
405  FwIndexType portNum
406  ) const;
407 
412  FwIndexType portNum
413  ) const;
414 
419  FwIndexType portNum
420  ) const;
421 
426  FwIndexType portNum
427  ) const;
428 
429  protected:
430 
431  // ----------------------------------------------------------------------
432  // Handlers to implement for typed input ports
433  // ----------------------------------------------------------------------
434 
436  virtual void cmdResponseIn_handler(
437  FwIndexType portNum,
438  FwOpcodeType opCode,
439  U32 cmdSeq,
440  const Fw::CmdResponse& response
441  ) = 0;
442 
444  virtual void dataIn_handler(
445  FwIndexType portNum,
446  Fw::Buffer& data,
447  const ComCfg::FrameContext& context
448  ) = 0;
449 
451  virtual void fileBufferReturnIn_handler(
452  FwIndexType portNum,
453  Fw::Buffer& fwBuffer
454  ) = 0;
455 
456 #if FW_DIRECT_PORT_CALLS
457  public:
458 #else
459  protected:
460 #endif
461 
462  // ----------------------------------------------------------------------
463  // Port handler base-class functions for typed input ports
464  //
465  // Call these functions directly to bypass the corresponding ports
466  // ----------------------------------------------------------------------
467 
470  FwIndexType portNum,
471  FwOpcodeType opCode,
472  U32 cmdSeq,
473  const Fw::CmdResponse& response
474  );
475 
477  void dataIn_handlerBase(
478  FwIndexType portNum,
479  Fw::Buffer& data,
480  const ComCfg::FrameContext& context
481  );
482 
485  FwIndexType portNum,
486  Fw::Buffer& fwBuffer
487  );
488 
489  protected:
490 
491  // ----------------------------------------------------------------------
492  // Invocation functions for typed output ports
493  // ----------------------------------------------------------------------
494 
496  void commandOut_out(
497  FwIndexType portNum,
498  Fw::ComBuffer& data,
499  U32 context
500  ) const;
501 
503  void dataReturnOut_out(
504  FwIndexType portNum,
505  Fw::Buffer& data,
506  const ComCfg::FrameContext& context
507  ) const;
508 
510  void fileOut_out(
511  FwIndexType portNum,
512  Fw::Buffer& fwBuffer
513  ) const;
514 
516  void unknownDataOut_out(
517  FwIndexType portNum,
518  Fw::Buffer& data,
519  const ComCfg::FrameContext& context
520  ) const;
521 
522  protected:
523 
524  // ----------------------------------------------------------------------
525  // Event logging functions
526  // ----------------------------------------------------------------------
527 
532  U32 status
533  ) const;
534 
539  U32 status
540  ) const;
541 
542  protected:
543 
544  // ----------------------------------------------------------------------
545  // Time
546  // ----------------------------------------------------------------------
547 
551  Fw::Time getTime() const;
552 
553  private:
554 
555  // ----------------------------------------------------------------------
556  // Calls for messages received on typed input ports
557  // ----------------------------------------------------------------------
558 
560  static void m_p_cmdResponseIn_in(
561  Fw::PassiveComponentBase* callComp,
562  FwIndexType portNum,
563  FwOpcodeType opCode,
564  U32 cmdSeq,
565  const Fw::CmdResponse& response
566  );
567 
569  static void m_p_dataIn_in(
570  Fw::PassiveComponentBase* callComp,
571  FwIndexType portNum,
572  Fw::Buffer& data,
573  const ComCfg::FrameContext& context
574  );
575 
577  static void m_p_fileBufferReturnIn_in(
578  Fw::PassiveComponentBase* callComp,
579  FwIndexType portNum,
580  Fw::Buffer& fwBuffer
581  );
582 
583  private:
584 
585  // ----------------------------------------------------------------------
586  // Invocation functions for special output ports
587  // ----------------------------------------------------------------------
588 
590  void logOut_out(
591  FwIndexType portNum,
592  FwEventIdType id,
593  Fw::Time& timeTag,
594  const Fw::LogSeverity& severity,
595  Fw::LogBuffer& args
596  ) const;
597 
598 #if FW_ENABLE_TEXT_LOGGING
599 
601  void logTextOut_out(
602  FwIndexType portNum,
603  FwEventIdType id,
604  Fw::Time& timeTag,
605  const Fw::LogSeverity& severity,
606  Fw::TextLogString& text
607  ) const;
608 
609 #endif
610 
612  void timeCaller_out(
613  FwIndexType portNum,
614  Fw::Time& time
615  ) const;
616 
617 #if !FW_DIRECT_PORT_CALLS
618 
619  private:
620 
621  // ----------------------------------------------------------------------
622  // Typed input ports
623  // ----------------------------------------------------------------------
624 
626  Fw::InputCmdResponsePort m_cmdResponseIn_InputPort[NUM_CMDRESPONSEIN_INPUT_PORTS];
627 
630 
632  Fw::InputBufferSendPort m_fileBufferReturnIn_InputPort[NUM_FILEBUFFERRETURNIN_INPUT_PORTS];
633 
634 #endif
635 
636 #if !FW_DIRECT_PORT_CALLS
637 
638  private:
639 
640  // ----------------------------------------------------------------------
641  // Special output ports
642  // ----------------------------------------------------------------------
643 
645  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
646 
647 #if FW_ENABLE_TEXT_LOGGING == 1
648 
650  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
651 
652 #endif
653 
655  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
656 
657 #endif
658 
659 #if !FW_DIRECT_PORT_CALLS
660 
661  private:
662 
663  // ----------------------------------------------------------------------
664  // Typed output ports
665  // ----------------------------------------------------------------------
666 
668  Fw::OutputComPort m_commandOut_OutputPort[NUM_COMMANDOUT_OUTPUT_PORTS];
669 
672 
675 
678 
679 #endif
680 
681  };
682 
683 }
684 
685 #endif
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
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.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
void unknownDataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port unknownDataOut.
I32 FwEnumStoreType
friend class FprimeRouterTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_commandOut_OutputPort(FwIndexType portNum) const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
FprimeRouterComponentBase(const char *compName="")
Construct FprimeRouterComponentBase object.
static constexpr FwIndexType getNum_unknownDataOut_OutputPorts()
void fileOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port fileOut.
Enum representing a command response.
void commandOut_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context) const
Invoke output port commandOut.
Fw::InputCmdResponsePort * get_cmdResponseIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_commandOut_OutputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIdType FwEventIdType
The type of an event identifier.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[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.
An error occurred while deserializing a packet.
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
Auto-generated base for FprimeRouter component.
Enum representing event severity.
void set_fileOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to fileOut[portNum].
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_fileOut_OutputPorts()
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void set_unknownDataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to unknownDataOut[portNum].
bool isConnected_unknownDataOut_OutputPort(FwIndexType portNum) const
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.
bool isConnected_fileOut_OutputPort(FwIndexType portNum) const
RateGroupDivider component implementation.
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_logOut_OutputPort(FwIndexType portNum) const
An error occurred while serializing a com buffer.
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.