F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ComQueueComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComQueueComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ComQueue component base class
5 // ======================================================================
6 
7 #ifndef Svc_ComQueueComponentAc_HPP
8 #define Svc_ComQueueComponentAc_HPP
9 
10 #include <atomic>
11 
13 #include "Fw/Com/ComPortAc.hpp"
15 #include "Fw/FPrimeBasicTypes.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #if FW_ENABLE_TEXT_LOGGING == 1
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #endif
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Fw/Tlm/TlmPortAc.hpp"
26 #include "Fw/Tlm/TlmString.hpp"
32 
33 namespace Svc {
34 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
48  friend class ComQueueTesterBase;
50  friend class ComQueueTester;
51 
52  protected:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
59  enum {
65  };
66 
68  enum {
73  };
74 
76  enum {
79  };
80 
82  enum {
84  };
85 
87  enum {
90  };
91 
92  public:
93 
94  // ----------------------------------------------------------------------
95  // Component initialization
96  // ----------------------------------------------------------------------
97 
99  void init(
100  FwSizeType queueDepth,
101  FwEnumStoreType instance = 0
102  );
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Getters for typed input ports
108  // ----------------------------------------------------------------------
109 
114  FwIndexType portNum
115  );
116 
121  FwIndexType portNum
122  );
123 
128  FwIndexType portNum
129  );
130 
135  FwIndexType portNum
136  );
137 
142  FwIndexType portNum
143  );
144 
145  public:
146 
147  // ----------------------------------------------------------------------
148  // Connect input ports to special output ports
149  // ----------------------------------------------------------------------
150 
152  void set_Log_OutputPort(
153  FwIndexType portNum,
154  Fw::InputLogPort* port
155  );
156 
157 #if FW_ENABLE_TEXT_LOGGING == 1
158 
160  void set_LogText_OutputPort(
161  FwIndexType portNum,
162  Fw::InputLogTextPort* port
163  );
164 
165 #endif
166 
168  void set_Time_OutputPort(
169  FwIndexType portNum,
170  Fw::InputTimePort* port
171  );
172 
174  void set_Tlm_OutputPort(
175  FwIndexType portNum,
176  Fw::InputTlmPort* port
177  );
178 
179  public:
180 
181  // ----------------------------------------------------------------------
182  // Connect typed input ports to typed output ports
183  // ----------------------------------------------------------------------
184 
187  FwIndexType portNum,
189  );
190 
193  FwIndexType portNum,
195  );
196 
197 #if FW_PORT_SERIALIZATION
198 
199  public:
200 
201  // ----------------------------------------------------------------------
202  // Connect serial input ports to special output ports
203  // ----------------------------------------------------------------------
204 
206  void set_Log_OutputPort(
207  FwIndexType portNum,
208  Fw::InputSerializePort* port
209  );
210 
211 #if FW_ENABLE_TEXT_LOGGING == 1
212 
214  void set_LogText_OutputPort(
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
219 #endif
220 
222  void set_Time_OutputPort(
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
228  void set_Tlm_OutputPort(
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
233 #endif
234 
235 #if FW_PORT_SERIALIZATION
236 
237  public:
238 
239  // ----------------------------------------------------------------------
240  // Connect serial input ports to typed output ports
241  // ----------------------------------------------------------------------
242 
245  FwIndexType portNum,
246  Fw::InputSerializePort* port
247  );
248 
251  FwIndexType portNum,
252  Fw::InputSerializePort* port
253  );
254 
255 #endif
256 
257  protected:
258 
259  // ----------------------------------------------------------------------
260  // Component construction and destruction
261  // ----------------------------------------------------------------------
262 
265  const char* compName = ""
266  );
267 
269  virtual ~ComQueueComponentBase();
270 
271  protected:
272 
273  // ----------------------------------------------------------------------
274  // Getters for numbers of typed input ports
275  // ----------------------------------------------------------------------
276 
282  }
283 
289  }
290 
296  }
297 
303  }
304 
308  static constexpr FwIndexType getNum_run_InputPorts() {
309  return NUM_RUN_INPUT_PORTS;
310  }
311 
312  protected:
313 
314  // ----------------------------------------------------------------------
315  // Getters for numbers of special output ports
316  // ----------------------------------------------------------------------
317 
321  static constexpr FwIndexType getNum_Log_OutputPorts() {
322  return NUM_LOG_OUTPUT_PORTS;
323  }
324 
325 #if FW_ENABLE_TEXT_LOGGING == 1
326 
330  static constexpr FwIndexType getNum_LogText_OutputPorts() {
332  }
333 
334 #endif
335 
340  return NUM_TIME_OUTPUT_PORTS;
341  }
342 
346  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
347  return NUM_TLM_OUTPUT_PORTS;
348  }
349 
350  protected:
351 
352  // ----------------------------------------------------------------------
353  // Getters for numbers of typed output ports
354  // ----------------------------------------------------------------------
355 
361  }
362 
368  }
369 
370  protected:
371 
372  // ----------------------------------------------------------------------
373  // Connection status queries for special output ports
374  // ----------------------------------------------------------------------
375 
380  FwIndexType portNum
381  );
382 
383 #if FW_ENABLE_TEXT_LOGGING == 1
384 
388  bool isConnected_LogText_OutputPort(
389  FwIndexType portNum
390  );
391 
392 #endif
393 
398  FwIndexType portNum
399  );
400 
405  FwIndexType portNum
406  );
407 
408  protected:
409 
410  // ----------------------------------------------------------------------
411  // Connection status queries for typed output ports
412  // ----------------------------------------------------------------------
413 
418  FwIndexType portNum
419  );
420 
425  FwIndexType portNum
426  );
427 
428  protected:
429 
430  // ----------------------------------------------------------------------
431  // Handlers to implement for typed input ports
432  // ----------------------------------------------------------------------
433 
435  virtual void bufferQueueIn_handler(
436  FwIndexType portNum,
437  Fw::Buffer& fwBuffer
438  ) = 0;
439 
441  virtual void comPacketQueueIn_handler(
442  FwIndexType portNum,
443  Fw::ComBuffer& data,
444  U32 context
445  ) = 0;
446 
448  virtual void comStatusIn_handler(
449  FwIndexType portNum,
450  Fw::Success& condition
451  ) = 0;
452 
454  virtual void dataReturnIn_handler(
455  FwIndexType portNum,
456  Fw::Buffer& data,
457  const ComCfg::FrameContext& context
458  ) = 0;
459 
461  virtual void run_handler(
462  FwIndexType portNum,
463  U32 context
464  ) = 0;
465 
466  protected:
467 
468  // ----------------------------------------------------------------------
469  // Port handler base-class functions for typed input ports
470  //
471  // Call these functions directly to bypass the corresponding ports
472  // ----------------------------------------------------------------------
473 
476  FwIndexType portNum,
477  Fw::Buffer& fwBuffer
478  );
479 
482  FwIndexType portNum,
483  Fw::ComBuffer& data,
484  U32 context
485  );
486 
489  FwIndexType portNum,
490  Fw::Success& condition
491  );
492 
495  FwIndexType portNum,
496  Fw::Buffer& data,
497  const ComCfg::FrameContext& context
498  );
499 
501  void run_handlerBase(
502  FwIndexType portNum,
503  U32 context
504  );
505 
506  protected:
507 
508  // ----------------------------------------------------------------------
509  // Pre-message hooks for typed async input ports
510  //
511  // Each of these functions is invoked just before processing a message
512  // on the corresponding port. By default, they do nothing. You can
513  // override them to provide specific pre-message behavior.
514  // ----------------------------------------------------------------------
515 
517  virtual void bufferQueueIn_preMsgHook(
518  FwIndexType portNum,
519  Fw::Buffer& fwBuffer
520  );
521 
523  virtual void comPacketQueueIn_preMsgHook(
524  FwIndexType portNum,
525  Fw::ComBuffer& data,
526  U32 context
527  );
528 
530  virtual void comStatusIn_preMsgHook(
531  FwIndexType portNum,
532  Fw::Success& condition
533  );
534 
536  virtual void run_preMsgHook(
537  FwIndexType portNum,
538  U32 context
539  );
540 
541  protected:
542 
543  // ----------------------------------------------------------------------
544  // Hooks for typed async input ports
545  //
546  // Each of these functions is invoked when placing a message on the
547  // queue would cause the queue to overlow. You should override them to provide
548  // specific overflow behavior.
549  // ----------------------------------------------------------------------
550 
552  virtual void bufferQueueIn_overflowHook(
553  FwIndexType portNum,
554  Fw::Buffer& fwBuffer
555  ) = 0;
556 
557  protected:
558 
559  // ----------------------------------------------------------------------
560  // Invocation functions for typed output ports
561  // ----------------------------------------------------------------------
562 
564  void bufferReturnOut_out(
565  FwIndexType portNum,
566  Fw::Buffer& fwBuffer
567  );
568 
570  void dataOut_out(
571  FwIndexType portNum,
572  Fw::Buffer& data,
573  const ComCfg::FrameContext& context
574  );
575 
576  protected:
577 
578  // ----------------------------------------------------------------------
579  // Event logging functions
580  // ----------------------------------------------------------------------
581 
586  Svc::QueueType queueType,
587  U32 index
588  ) const;
589 
590  protected:
591 
592  // ----------------------------------------------------------------------
593  // Telemetry write functions
594  // ----------------------------------------------------------------------
595 
600  const Svc::ComQueueDepth& arg,
601  Fw::Time _tlmTime = Fw::Time()
602  ) const;
603 
608  const Svc::BuffQueueDepth& arg,
609  Fw::Time _tlmTime = Fw::Time()
610  ) const;
611 
612  protected:
613 
614  // ----------------------------------------------------------------------
615  // Time
616  // ----------------------------------------------------------------------
617 
621  Fw::Time getTime() const;
622 
623  private:
624 
625  // ----------------------------------------------------------------------
626  // Message dispatch functions
627  // ----------------------------------------------------------------------
628 
630  virtual MsgDispatchStatus doDispatch();
631 
632  private:
633 
634  // ----------------------------------------------------------------------
635  // Calls for messages received on typed input ports
636  // ----------------------------------------------------------------------
637 
639  static void m_p_bufferQueueIn_in(
640  Fw::PassiveComponentBase* callComp,
641  FwIndexType portNum,
642  Fw::Buffer& fwBuffer
643  );
644 
646  static void m_p_comPacketQueueIn_in(
647  Fw::PassiveComponentBase* callComp,
648  FwIndexType portNum,
649  Fw::ComBuffer& data,
650  U32 context
651  );
652 
654  static void m_p_comStatusIn_in(
655  Fw::PassiveComponentBase* callComp,
656  FwIndexType portNum,
657  Fw::Success& condition
658  );
659 
661  static void m_p_dataReturnIn_in(
662  Fw::PassiveComponentBase* callComp,
663  FwIndexType portNum,
664  Fw::Buffer& data,
665  const ComCfg::FrameContext& context
666  );
667 
669  static void m_p_run_in(
670  Fw::PassiveComponentBase* callComp,
671  FwIndexType portNum,
672  U32 context
673  );
674 
675  private:
676 
677  // ----------------------------------------------------------------------
678  // Typed input ports
679  // ----------------------------------------------------------------------
680 
682  Fw::InputBufferSendPort m_bufferQueueIn_InputPort[NUM_BUFFERQUEUEIN_INPUT_PORTS];
683 
685  Fw::InputComPort m_comPacketQueueIn_InputPort[NUM_COMPACKETQUEUEIN_INPUT_PORTS];
686 
689 
692 
694  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
695 
696  private:
697 
698  // ----------------------------------------------------------------------
699  // Special output ports
700  // ----------------------------------------------------------------------
701 
703  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
704 
705 #if FW_ENABLE_TEXT_LOGGING == 1
706 
708  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
709 
710 #endif
711 
713  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
714 
716  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
717 
718  private:
719 
720  // ----------------------------------------------------------------------
721  // Typed output ports
722  // ----------------------------------------------------------------------
723 
725  Fw::OutputBufferSendPort m_bufferReturnOut_OutputPort[NUM_BUFFERRETURNOUT_OUTPUT_PORTS];
726 
729 
730  };
731 
732 }
733 
734 #endif
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
static constexpr FwIndexType getNum_Tlm_OutputPorts()
virtual ~ComQueueComponentBase()
Destroy ComQueueComponentBase object.
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
static constexpr FwIndexType getNum_bufferReturnOut_OutputPorts()
PlatformSizeType FwSizeType
void tlmWrite_buffQueueDepth(const Svc::BuffQueueDepth &arg, Fw::Time _tlmTime=Fw::Time()) const
I32 FwEnumStoreType
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_comPacketQueueIn_InputPorts()
void set_bufferReturnOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferReturnOut[portNum].
bool isConnected_bufferReturnOut_OutputPort(FwIndexType portNum)
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
Array of queue depths for Fw::Com types.
An enumeration of queue data types.
bool isConnected_Log_OutputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
void comStatusIn_handlerBase(FwIndexType portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
virtual void bufferQueueIn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferQueueIn.
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
bool isConnected_Time_OutputPort(FwIndexType portNum)
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
static constexpr FwIndexType getNum_bufferQueueIn_InputPorts()
Array of queue depths for Fw::Buffer types.
virtual void run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port run.
void log_WARNING_HI_QueueOverflow(Svc::QueueType queueType, U32 index) const
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
Fw::InputComPort * get_comPacketQueueIn_InputPort(FwIndexType portNum)
virtual void bufferQueueIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferQueueIn.
virtual void comPacketQueueIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comPacketQueueIn.
void comPacketQueueIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comPacketQueueIn.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
virtual void comPacketQueueIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comPacketQueueIn.
Fw::InputBufferSendPort * get_bufferQueueIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_dataOut_OutputPorts()
static constexpr FwIndexType getNum_comStatusIn_InputPorts()
static constexpr FwIndexType getNum_Log_OutputPorts()
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
ComQueueComponentBase(const char *compName="")
Construct ComQueueComponentBase object.
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
void tlmWrite_comQueueDepth(const Svc::ComQueueDepth &arg, Fw::Time _tlmTime=Fw::Time()) const
RateGroupDivider component implementation.
static constexpr FwIndexType getNum_Time_OutputPorts()
virtual void comStatusIn_preMsgHook(FwIndexType portNum, Fw::Success &condition)
Pre-message hook for async input port comStatusIn.
friend class ComQueueTesterBase
Friend class tester to support autocoded test harness.
virtual void bufferQueueIn_overflowHook(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Overflow hook for async input port bufferQueueIn.
friend class ComQueueTester
Friend class tester implementation to support white-box testing.
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
Success/Failure.
static constexpr FwIndexType getNum_run_InputPorts()
void bufferQueueIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferQueueIn.
Auto-generated base for ComQueue component.
void bufferReturnOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferReturnOut.