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 
50  friend class ComQueueTesterBase;
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 
281 
286 
291 
296 
301 
302  PROTECTED:
303 
304  // ----------------------------------------------------------------------
305  // Getters for numbers of special output ports
306  // ----------------------------------------------------------------------
307 
312 
313 #if FW_ENABLE_TEXT_LOGGING == 1
314 
318  FwIndexType getNum_LogText_OutputPorts() const;
319 
320 #endif
321 
326 
331 
332  PROTECTED:
333 
334  // ----------------------------------------------------------------------
335  // Getters for numbers of typed output ports
336  // ----------------------------------------------------------------------
337 
342 
347 
348  PROTECTED:
349 
350  // ----------------------------------------------------------------------
351  // Connection status queries for special output ports
352  // ----------------------------------------------------------------------
353 
358  FwIndexType portNum
359  );
360 
361 #if FW_ENABLE_TEXT_LOGGING == 1
362 
366  bool isConnected_LogText_OutputPort(
367  FwIndexType portNum
368  );
369 
370 #endif
371 
376  FwIndexType portNum
377  );
378 
383  FwIndexType portNum
384  );
385 
386  PROTECTED:
387 
388  // ----------------------------------------------------------------------
389  // Connection status queries for typed output ports
390  // ----------------------------------------------------------------------
391 
396  FwIndexType portNum
397  );
398 
403  FwIndexType portNum
404  );
405 
406  PROTECTED:
407 
408  // ----------------------------------------------------------------------
409  // Handlers to implement for typed input ports
410  // ----------------------------------------------------------------------
411 
413  virtual void bufferQueueIn_handler(
414  FwIndexType portNum,
415  Fw::Buffer& fwBuffer
416  ) = 0;
417 
419  virtual void bufferReturnIn_handler(
420  FwIndexType portNum,
421  Fw::Buffer& data,
422  const ComCfg::FrameContext& context
423  ) = 0;
424 
426  virtual void comPacketQueueIn_handler(
427  FwIndexType portNum,
428  Fw::ComBuffer& data,
429  U32 context
430  ) = 0;
431 
433  virtual void comStatusIn_handler(
434  FwIndexType portNum,
435  Fw::Success& condition
436  ) = 0;
437 
439  virtual void run_handler(
440  FwIndexType portNum,
441  U32 context
442  ) = 0;
443 
444  PROTECTED:
445 
446  // ----------------------------------------------------------------------
447  // Port handler base-class functions for typed input ports
448  //
449  // Call these functions directly to bypass the corresponding ports
450  // ----------------------------------------------------------------------
451 
454  FwIndexType portNum,
455  Fw::Buffer& fwBuffer
456  );
457 
460  FwIndexType portNum,
461  Fw::Buffer& data,
462  const ComCfg::FrameContext& context
463  );
464 
467  FwIndexType portNum,
468  Fw::ComBuffer& data,
469  U32 context
470  );
471 
474  FwIndexType portNum,
475  Fw::Success& condition
476  );
477 
479  void run_handlerBase(
480  FwIndexType portNum,
481  U32 context
482  );
483 
484  PROTECTED:
485 
486  // ----------------------------------------------------------------------
487  // Pre-message hooks for typed async input ports
488  //
489  // Each of these functions is invoked just before processing a message
490  // on the corresponding port. By default, they do nothing. You can
491  // override them to provide specific pre-message behavior.
492  // ----------------------------------------------------------------------
493 
495  virtual void bufferQueueIn_preMsgHook(
496  FwIndexType portNum,
497  Fw::Buffer& fwBuffer
498  );
499 
501  virtual void comPacketQueueIn_preMsgHook(
502  FwIndexType portNum,
503  Fw::ComBuffer& data,
504  U32 context
505  );
506 
508  virtual void comStatusIn_preMsgHook(
509  FwIndexType portNum,
510  Fw::Success& condition
511  );
512 
514  virtual void run_preMsgHook(
515  FwIndexType portNum,
516  U32 context
517  );
518 
519  PROTECTED:
520 
521  // ----------------------------------------------------------------------
522  // Hooks for typed async input ports
523  //
524  // Each of these functions is invoked when placing a message on the
525  // queue would cause the queue to overlow. You should override them to provide
526  // specific overflow behavior.
527  // ----------------------------------------------------------------------
528 
530  virtual void bufferQueueIn_overflowHook(
531  FwIndexType portNum,
532  Fw::Buffer& fwBuffer
533  ) = 0;
534 
535  PROTECTED:
536 
537  // ----------------------------------------------------------------------
538  // Invocation functions for typed output ports
539  // ----------------------------------------------------------------------
540 
542  void bufferReturnOut_out(
543  FwIndexType portNum,
544  Fw::Buffer& fwBuffer
545  );
546 
548  void queueSend_out(
549  FwIndexType portNum,
550  Fw::Buffer& data,
551  const ComCfg::FrameContext& context
552  );
553 
554  PROTECTED:
555 
556  // ----------------------------------------------------------------------
557  // Event logging functions
558  // ----------------------------------------------------------------------
559 
564  Svc::QueueType queueType,
565  U32 index
566  ) const;
567 
568  PROTECTED:
569 
570  // ----------------------------------------------------------------------
571  // Telemetry write functions
572  // ----------------------------------------------------------------------
573 
578  const Svc::ComQueueDepth& arg,
579  Fw::Time _tlmTime = Fw::Time()
580  ) const;
581 
586  const Svc::BuffQueueDepth& arg,
587  Fw::Time _tlmTime = Fw::Time()
588  ) const;
589 
590  PROTECTED:
591 
592  // ----------------------------------------------------------------------
593  // Time
594  // ----------------------------------------------------------------------
595 
599  Fw::Time getTime() const;
600 
601  PRIVATE:
602 
603  // ----------------------------------------------------------------------
604  // Message dispatch functions
605  // ----------------------------------------------------------------------
606 
608  virtual MsgDispatchStatus doDispatch();
609 
610  PRIVATE:
611 
612  // ----------------------------------------------------------------------
613  // Calls for messages received on typed input ports
614  // ----------------------------------------------------------------------
615 
617  static void m_p_bufferQueueIn_in(
618  Fw::PassiveComponentBase* callComp,
619  FwIndexType portNum,
620  Fw::Buffer& fwBuffer
621  );
622 
624  static void m_p_bufferReturnIn_in(
625  Fw::PassiveComponentBase* callComp,
626  FwIndexType portNum,
627  Fw::Buffer& data,
628  const ComCfg::FrameContext& context
629  );
630 
632  static void m_p_comPacketQueueIn_in(
633  Fw::PassiveComponentBase* callComp,
634  FwIndexType portNum,
635  Fw::ComBuffer& data,
636  U32 context
637  );
638 
640  static void m_p_comStatusIn_in(
641  Fw::PassiveComponentBase* callComp,
642  FwIndexType portNum,
643  Fw::Success& condition
644  );
645 
647  static void m_p_run_in(
648  Fw::PassiveComponentBase* callComp,
649  FwIndexType portNum,
650  U32 context
651  );
652 
653  PRIVATE:
654 
655  // ----------------------------------------------------------------------
656  // Typed input ports
657  // ----------------------------------------------------------------------
658 
660  Fw::InputBufferSendPort m_bufferQueueIn_InputPort[NUM_BUFFERQUEUEIN_INPUT_PORTS];
661 
664 
666  Fw::InputComPort m_comPacketQueueIn_InputPort[NUM_COMPACKETQUEUEIN_INPUT_PORTS];
667 
670 
672  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
673 
674  PRIVATE:
675 
676  // ----------------------------------------------------------------------
677  // Special output ports
678  // ----------------------------------------------------------------------
679 
681  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
682 
683 #if FW_ENABLE_TEXT_LOGGING == 1
684 
686  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
687 
688 #endif
689 
691  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
692 
694  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
695 
696  PRIVATE:
697 
698  // ----------------------------------------------------------------------
699  // Typed output ports
700  // ----------------------------------------------------------------------
701 
703  Fw::OutputBufferSendPort m_bufferReturnOut_OutputPort[NUM_BUFFERRETURNOUT_OUTPUT_PORTS];
704 
707 
708  };
709 
710 }
711 
712 #endif
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
virtual ~ComQueueComponentBase()
Destroy ComQueueComponentBase object.
Definition: Time.hpp:9
virtual void bufferReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port bufferReturnIn.
FwIndexType getNum_bufferReturnOut_OutputPorts() const
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].
friend class ComQueueComponentBaseFriend
Friend class for white-box testing.
FwIndexType getNum_bufferQueueIn_InputPorts() const
FwIndexType getNum_Log_OutputPorts() const
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
void set_bufferReturnOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferReturnOut[portNum].
bool isConnected_bufferReturnOut_OutputPort(FwIndexType 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:26
FwIndexType getNum_comPacketQueueIn_InputPorts() const
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.
Svc::InputComDataWithContextPort * get_bufferReturnIn_InputPort(FwIndexType portNum)
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.
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.
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)
FwIndexType getNum_bufferReturnIn_InputPorts() const
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
FwIndexType getNum_Time_OutputPorts() const
ComQueueComponentBase(const char *compName="")
Construct ComQueueComponentBase object.
PlatformIndexType FwIndexType
void queueSend_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port queueSend.
void bufferReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port bufferReturnIn.
bool isConnected_queueSend_OutputPort(FwIndexType portNum)
FwIndexType getNum_Tlm_OutputPorts() const
FwIndexType getNum_comStatusIn_InputPorts() const
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.
void set_queueSend_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to queueSend[portNum].
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.
FwIndexType getNum_queueSend_OutputPorts() const
Success/Failure.
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.
FwIndexType getNum_run_InputPorts() const