F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
BufferAccumulatorComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title BufferAccumulatorComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for BufferAccumulator component base class
5 // ======================================================================
6 
7 #ifndef Svc_BufferAccumulatorComponentAc_HPP
8 #define Svc_BufferAccumulatorComponentAc_HPP
9 
10 #include "FpConfig.hpp"
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.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
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Fw/Tlm/TlmPortAc.hpp"
26 #include "Fw/Tlm/TlmString.hpp"
29 #include "Svc/Ping/PingPortAc.hpp"
30 
31 namespace Svc {
32 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
45 
46  PROTECTED:
47 
48  // ----------------------------------------------------------------------
49  // Constants
50  // ----------------------------------------------------------------------
51 
53  enum {
55  };
56 
58  enum {
62  };
63 
65  enum {
72  };
73 
75  enum {
79  };
80 
82  enum {
85  };
86 
88  enum {
96  };
97 
99  enum {
101  };
102 
103  public:
104 
105  // ----------------------------------------------------------------------
106  // Component initialization
107  // ----------------------------------------------------------------------
108 
110  void init(
111  FwSizeType queueDepth,
112  FwEnumStoreType instance = 0
113  );
114 
115  public:
116 
117  // ----------------------------------------------------------------------
118  // Getters for special input ports
119  // ----------------------------------------------------------------------
120 
125  FwIndexType portNum
126  );
127 
128  public:
129 
130  // ----------------------------------------------------------------------
131  // Getters for typed input ports
132  // ----------------------------------------------------------------------
133 
138  FwIndexType portNum
139  );
140 
145  FwIndexType portNum
146  );
147 
152  FwIndexType portNum
153  );
154 
155  public:
156 
157  // ----------------------------------------------------------------------
158  // Connect input ports to special output ports
159  // ----------------------------------------------------------------------
160 
163  FwIndexType portNum,
164  Fw::InputCmdRegPort* port
165  );
166 
169  FwIndexType portNum,
171  );
172 
175  FwIndexType portNum,
176  Fw::InputLogPort* port
177  );
178 
179 #if FW_ENABLE_TEXT_LOGGING == 1
180 
182  void set_eventOutText_OutputPort(
183  FwIndexType portNum,
184  Fw::InputLogTextPort* port
185  );
186 
187 #endif
188 
191  FwIndexType portNum,
192  Fw::InputTimePort* port
193  );
194 
197  FwIndexType portNum,
198  Fw::InputTlmPort* port
199  );
200 
201  public:
202 
203  // ----------------------------------------------------------------------
204  // Connect typed input ports to typed output ports
205  // ----------------------------------------------------------------------
206 
209  FwIndexType portNum,
211  );
212 
215  FwIndexType portNum,
217  );
218 
221  FwIndexType portNum,
222  Svc::InputPingPort* port
223  );
224 
225 #if FW_PORT_SERIALIZATION
226 
227  public:
228 
229  // ----------------------------------------------------------------------
230  // Connect serial input ports to special 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 
251 #if FW_ENABLE_TEXT_LOGGING == 1
252 
254  void set_eventOutText_OutputPort(
255  FwIndexType portNum,
256  Fw::InputSerializePort* port
257  );
258 
259 #endif
260 
263  FwIndexType portNum,
264  Fw::InputSerializePort* port
265  );
266 
269  FwIndexType portNum,
270  Fw::InputSerializePort* port
271  );
272 
273 #endif
274 
275 #if FW_PORT_SERIALIZATION
276 
277  public:
278 
279  // ----------------------------------------------------------------------
280  // Connect serial input ports to typed output ports
281  // ----------------------------------------------------------------------
282 
285  FwIndexType portNum,
286  Fw::InputSerializePort* port
287  );
288 
291  FwIndexType portNum,
292  Fw::InputSerializePort* port
293  );
294 
297  FwIndexType portNum,
298  Fw::InputSerializePort* port
299  );
300 
301 #endif
302 
303  public:
304 
305  // ----------------------------------------------------------------------
306  // Command registration
307  // ----------------------------------------------------------------------
308 
312  void regCommands();
313 
314  PROTECTED:
315 
316  // ----------------------------------------------------------------------
317  // Component construction and destruction
318  // ----------------------------------------------------------------------
319 
322  const char* compName = ""
323  );
324 
327 
328  PROTECTED:
329 
330  // ----------------------------------------------------------------------
331  // Getters for numbers of special input ports
332  // ----------------------------------------------------------------------
333 
338 
339  PROTECTED:
340 
341  // ----------------------------------------------------------------------
342  // Getters for numbers of typed input ports
343  // ----------------------------------------------------------------------
344 
349 
354 
359 
360  PROTECTED:
361 
362  // ----------------------------------------------------------------------
363  // Getters for numbers of special output ports
364  // ----------------------------------------------------------------------
365 
370 
375 
380 
381 #if FW_ENABLE_TEXT_LOGGING == 1
382 
386  FwIndexType getNum_eventOutText_OutputPorts() const;
387 
388 #endif
389 
394 
399 
400  PROTECTED:
401 
402  // ----------------------------------------------------------------------
403  // Getters for numbers of typed output ports
404  // ----------------------------------------------------------------------
405 
410 
415 
420 
421  PROTECTED:
422 
423  // ----------------------------------------------------------------------
424  // Connection status queries for special output ports
425  // ----------------------------------------------------------------------
426 
431  FwIndexType portNum
432  );
433 
438  FwIndexType portNum
439  );
440 
445  FwIndexType portNum
446  );
447 
448 #if FW_ENABLE_TEXT_LOGGING == 1
449 
453  bool isConnected_eventOutText_OutputPort(
454  FwIndexType portNum
455  );
456 
457 #endif
458 
463  FwIndexType portNum
464  );
465 
470  FwIndexType portNum
471  );
472 
473  PROTECTED:
474 
475  // ----------------------------------------------------------------------
476  // Connection status queries for typed output ports
477  // ----------------------------------------------------------------------
478 
483  FwIndexType portNum
484  );
485 
490  FwIndexType portNum
491  );
492 
497  FwIndexType portNum
498  );
499 
500  PROTECTED:
501 
502  // ----------------------------------------------------------------------
503  // Handlers to implement for typed input ports
504  // ----------------------------------------------------------------------
505 
508  FwIndexType portNum,
509  Fw::Buffer& fwBuffer
510  ) = 0;
511 
514  FwIndexType portNum,
515  Fw::Buffer& fwBuffer
516  ) = 0;
517 
519  virtual void pingIn_handler(
520  FwIndexType portNum,
521  U32 key
522  ) = 0;
523 
524  PROTECTED:
525 
526  // ----------------------------------------------------------------------
527  // Port handler base-class functions for typed input ports
528  //
529  // Call these functions directly to bypass the corresponding ports
530  // ----------------------------------------------------------------------
531 
534  FwIndexType portNum,
535  Fw::Buffer& fwBuffer
536  );
537 
540  FwIndexType portNum,
541  Fw::Buffer& fwBuffer
542  );
543 
545  void pingIn_handlerBase(
546  FwIndexType portNum,
547  U32 key
548  );
549 
550  PROTECTED:
551 
552  // ----------------------------------------------------------------------
553  // Pre-message hooks for typed async input ports
554  //
555  // Each of these functions is invoked just before processing a message
556  // on the corresponding port. By default, they do nothing. You can
557  // override them to provide specific pre-message behavior.
558  // ----------------------------------------------------------------------
559 
561  virtual void bufferSendInFill_preMsgHook(
562  FwIndexType portNum,
563  Fw::Buffer& fwBuffer
564  );
565 
567  virtual void bufferSendInReturn_preMsgHook(
568  FwIndexType portNum,
569  Fw::Buffer& fwBuffer
570  );
571 
573  virtual void pingIn_preMsgHook(
574  FwIndexType portNum,
575  U32 key
576  );
577 
578  PROTECTED:
579 
580  // ----------------------------------------------------------------------
581  // Invocation functions for typed output ports
582  // ----------------------------------------------------------------------
583 
586  FwIndexType portNum,
587  Fw::Buffer& fwBuffer
588  );
589 
592  FwIndexType portNum,
593  Fw::Buffer& fwBuffer
594  );
595 
597  void pingOut_out(
598  FwIndexType portNum,
599  U32 key
600  );
601 
602  PROTECTED:
603 
604  // ----------------------------------------------------------------------
605  // Command response
606  // ----------------------------------------------------------------------
607 
609  void cmdResponse_out(
610  FwOpcodeType opCode,
611  U32 cmdSeq,
612  Fw::CmdResponse response
613  );
614 
615  PROTECTED:
616 
617  // ----------------------------------------------------------------------
618  // Command handlers to implement
619  // ----------------------------------------------------------------------
620 
624  virtual void BA_SetMode_cmdHandler(
625  FwOpcodeType opCode,
626  U32 cmdSeq,
628  ) = 0;
629 
634  FwOpcodeType opCode,
635  U32 cmdSeq,
636  U32 numToDrain,
638  ) = 0;
639 
640  PROTECTED:
641 
642  // ----------------------------------------------------------------------
643  // Command handler base-class functions
644  //
645  // Call these functions directly to bypass the command input port
646  // ----------------------------------------------------------------------
647 
652  FwOpcodeType opCode,
653  U32 cmdSeq,
654  Fw::CmdArgBuffer& args
655  );
656 
661  FwOpcodeType opCode,
662  U32 cmdSeq,
663  Fw::CmdArgBuffer& args
664  );
665 
666  PROTECTED:
667 
668  // ----------------------------------------------------------------------
669  // Pre-message hooks for async commands
670  //
671  // Each of these functions is invoked just before processing the
672  // corresponding command. By default they do nothing. You can
673  // override them to provide specific pre-command behavior.
674  // ----------------------------------------------------------------------
675 
677  virtual void BA_SetMode_preMsgHook(
678  FwOpcodeType opCode,
679  U32 cmdSeq
680  );
681 
683  virtual void BA_DrainBuffers_preMsgHook(
684  FwOpcodeType opCode,
685  U32 cmdSeq
686  );
687 
688  PROTECTED:
689 
690  // ----------------------------------------------------------------------
691  // Event logging functions
692  // ----------------------------------------------------------------------
693 
698 
703 
708  U32 numDrained,
709  U32 numToDrain
710  );
711 
716 
721  U32 numDrained,
722  U32 numToDrain
723  );
724 
728  void log_ACTIVITY_HI_BA_PartialDrainDone(U32 numDrained);
729 
734  U32 numWillDrain,
735  U32 numReqDrain
736  );
737 
738  PROTECTED:
739 
740  // ----------------------------------------------------------------------
741  // Telemetry write functions
742  // ----------------------------------------------------------------------
743 
748  U32 arg,
749  Fw::Time _tlmTime = Fw::Time()
750  );
751 
752  PROTECTED:
753 
754  // ----------------------------------------------------------------------
755  // Time
756  // ----------------------------------------------------------------------
757 
761  Fw::Time getTime();
762 
763  PRIVATE:
764 
765  // ----------------------------------------------------------------------
766  // Message dispatch functions
767  // ----------------------------------------------------------------------
768 
770  virtual MsgDispatchStatus doDispatch();
771 
772  PRIVATE:
773 
774  // ----------------------------------------------------------------------
775  // Calls for messages received on special input ports
776  // ----------------------------------------------------------------------
777 
779  static void m_p_cmdIn_in(
780  Fw::PassiveComponentBase* callComp,
781  FwIndexType portNum,
782  FwOpcodeType opCode,
783  U32 cmdSeq,
784  Fw::CmdArgBuffer& args
785  );
786 
787  PRIVATE:
788 
789  // ----------------------------------------------------------------------
790  // Calls for messages received on typed input ports
791  // ----------------------------------------------------------------------
792 
794  static void m_p_bufferSendInFill_in(
795  Fw::PassiveComponentBase* callComp,
796  FwIndexType portNum,
797  Fw::Buffer& fwBuffer
798  );
799 
801  static void m_p_bufferSendInReturn_in(
802  Fw::PassiveComponentBase* callComp,
803  FwIndexType portNum,
804  Fw::Buffer& fwBuffer
805  );
806 
808  static void m_p_pingIn_in(
809  Fw::PassiveComponentBase* callComp,
810  FwIndexType portNum,
811  U32 key
812  );
813 
814  PRIVATE:
815 
816  // ----------------------------------------------------------------------
817  // Special input ports
818  // ----------------------------------------------------------------------
819 
821  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
822 
823  PRIVATE:
824 
825  // ----------------------------------------------------------------------
826  // Typed input ports
827  // ----------------------------------------------------------------------
828 
830  Fw::InputBufferSendPort m_bufferSendInFill_InputPort[NUM_BUFFERSENDINFILL_INPUT_PORTS];
831 
833  Fw::InputBufferSendPort m_bufferSendInReturn_InputPort[NUM_BUFFERSENDINRETURN_INPUT_PORTS];
834 
836  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
837 
838  PRIVATE:
839 
840  // ----------------------------------------------------------------------
841  // Special output ports
842  // ----------------------------------------------------------------------
843 
845  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
846 
848  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
849 
851  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
852 
853 #if FW_ENABLE_TEXT_LOGGING == 1
854 
856  Fw::OutputLogTextPort m_eventOutText_OutputPort[NUM_EVENTOUTTEXT_OUTPUT_PORTS];
857 
858 #endif
859 
861  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
862 
864  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
865 
866  PRIVATE:
867 
868  // ----------------------------------------------------------------------
869  // Typed output ports
870  // ----------------------------------------------------------------------
871 
873  Fw::OutputBufferSendPort m_bufferSendOutDrain_OutputPort[NUM_BUFFERSENDOUTDRAIN_OUTPUT_PORTS];
874 
876  Fw::OutputBufferSendPort m_bufferSendOutReturn_OutputPort[NUM_BUFFERSENDOUTRETURN_OUTPUT_PORTS];
877 
879  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
880 
881  };
882 
883 }
884 
885 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
Auto-generated base for BufferAccumulator component.
void bufferSendOutReturn_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOutReturn.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void log_WARNING_HI_BA_StillDraining(U32 numDrained, U32 numToDrain)
virtual void bufferSendInReturn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendInReturn.
BufferAccumulatorComponentBase(const char *compName="")
Construct BufferAccumulatorComponentBase object.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_bufferSendOutReturn_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
virtual void bufferSendInFill_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendInFill.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
virtual void BA_DrainBuffers_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 numToDrain, Svc::BufferAccumulator_BlockMode blockMode)=0
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
virtual void BA_DrainBuffers_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BA_DrainBuffers.
virtual void bufferSendInFill_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendInFill.
friend class BufferAccumulatorComponentBaseFriend
Friend class for white-box testing.
bool isConnected_bufferSendOutDrain_OutputPort(FwIndexType portNum)
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
void bufferSendInFill_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendInFill.
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
virtual void BA_SetMode_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::BufferAccumulator_OpState mode)=0
void BA_DrainBuffers_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void bufferSendOutDrain_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOutDrain.
virtual ~BufferAccumulatorComponentBase()
Destroy BufferAccumulatorComponentBase object.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void log_WARNING_LO_BA_NonBlockDrain(U32 numWillDrain, U32 numReqDrain)
@ OPCODE_BA_DRAINBUFFERS
Drain the commanded number of buffers.
Fw::InputBufferSendPort * get_bufferSendInReturn_InputPort(FwIndexType portNum)
void log_WARNING_HI_BA_DrainStalled(U32 numDrained, U32 numToDrain)
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void set_bufferSendOutDrain_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutDrain[portNum].
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void tlmWrite_BA_NumQueuedBuffers(U32 arg, Fw::Time _tlmTime=Fw::Time())
virtual void BA_SetMode_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BA_SetMode.
Fw::InputBufferSendPort * get_bufferSendInFill_InputPort(FwIndexType portNum)
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void set_bufferSendOutReturn_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutReturn[portNum].
@ CHANNELID_BA_NUMQUEUEDBUFFERS
Channel ID for BA_NumQueuedBuffers.
void BA_SetMode_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void regCommands()
Register commands with the Command Dispatcher.
virtual void bufferSendInReturn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendInReturn.
void bufferSendInReturn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendInReturn.
@ EVENTID_BA_BUFFERACCEPTED
The Buffer Accumulator instance accepted and enqueued a buffer. To avoid uncontrolled sending of even...
@ EVENTID_BA_DRAINSTALLED
Ran out of buffers while executing DrainBuffers command.
@ EVENTID_BA_PARTIALDRAINDONE
Finished DrainBuffers command.
@ EVENTID_BA_QUEUEFULL
The Buffer Accumulator instance received a buffer when its queue was full. To avoid uncontrolled send...
@ EVENTID_BA_STILLDRAINING
Got DrainBuffers command while executing DrainBuffers command.
@ EVENTID_BA_NONBLOCKDRAIN
Not enough buffers to complete requested drain, and NOBLOCK was set; will only drain what we have.
@ EVENTID_BA_ALREADYDRAINING
Got DrainBuffers command while in DRAIN mode.