F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileDispatcherComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileDispatcherComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FileDispatcher component base class
5 // ======================================================================
6 
7 #ifndef Svc_FileDispatcherComponentAc_HPP
8 #define Svc_FileDispatcherComponentAc_HPP
9 
10 #include <atomic>
11 
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.hpp"
17 #include "Fw/FPrimeBasicTypes.hpp"
18 #include "Fw/Log/LogPortAc.hpp"
19 #include "Fw/Log/LogString.hpp"
20 #include "Fw/Log/LogTextPortAc.hpp"
21 #if !FW_DIRECT_PORT_CALLS
23 #endif
24 #if !FW_DIRECT_PORT_CALLS
26 #endif
27 #include "Fw/Time/TimePortAc.hpp"
29 #include "Svc/Ping/PingPortAc.hpp"
34 
35 namespace Svc {
36 
43  {
44 
45  // ----------------------------------------------------------------------
46  // Friend classes
47  // ----------------------------------------------------------------------
48 
52  friend class FileDispatcherTester;
53 
54  protected:
55 
56  // ----------------------------------------------------------------------
57  // Constants
58  // ----------------------------------------------------------------------
59 
61  enum {
63  };
64 
66  enum {
69  };
70 
72  enum {
78  };
79 
81  enum {
84  };
85 
87  enum {
89  };
90 
92  enum {
95  };
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Component initialization
101  // ----------------------------------------------------------------------
102 
104  void init(
105  FwSizeType queueDepth,
106  FwEnumStoreType instance = 0
107  );
108 
109 #if !FW_DIRECT_PORT_CALLS
110 
111  public:
112 
113  // ----------------------------------------------------------------------
114  // Getters for special input ports
115  // ----------------------------------------------------------------------
116 
121  FwIndexType portNum
122  );
123 
124 #endif
125 
126 #if !FW_DIRECT_PORT_CALLS
127 
128  public:
129 
130  // ----------------------------------------------------------------------
131  // Getters for typed input ports
132  // ----------------------------------------------------------------------
133 
138  FwIndexType portNum
139  );
140 
145  FwIndexType portNum
146  );
147 
148 #endif
149 
150 #if !FW_DIRECT_PORT_CALLS
151 
152  public:
153 
154  // ----------------------------------------------------------------------
155  // Connect input ports to special output ports
156  // ----------------------------------------------------------------------
157 
160  FwIndexType portNum,
161  Fw::InputCmdRegPort* port
162  );
163 
166  FwIndexType portNum,
168  );
169 
172  FwIndexType portNum,
173  Fw::InputLogPort* port
174  );
175 
176 #if FW_ENABLE_TEXT_LOGGING == 1
177 
179  void set_logTextOut_OutputPort(
180  FwIndexType portNum,
181  Fw::InputLogTextPort* port
182  );
183 
184 #endif
185 
188  FwIndexType portNum,
189  Fw::InputTimePort* port
190  );
191 
192 #endif
193 
194 #if !FW_DIRECT_PORT_CALLS
195 
196  public:
197 
198  // ----------------------------------------------------------------------
199  // Connect typed input ports to typed output ports
200  // ----------------------------------------------------------------------
201 
204  FwIndexType portNum,
206  );
207 
210  FwIndexType portNum,
211  Svc::InputPingPort* port
212  );
213 
214 #endif
215 
216 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
217 
218  public:
219 
220  // ----------------------------------------------------------------------
221  // Connect serial input ports to special output ports
222  // ----------------------------------------------------------------------
223 
226  FwIndexType portNum,
227  Fw::InputSerializePort* port
228  );
229 
232  FwIndexType portNum,
233  Fw::InputSerializePort* port
234  );
235 
238  FwIndexType portNum,
239  Fw::InputSerializePort* port
240  );
241 
242 #if FW_ENABLE_TEXT_LOGGING == 1
243 
245  void set_logTextOut_OutputPort(
246  FwIndexType portNum,
247  Fw::InputSerializePort* port
248  );
249 
250 #endif
251 
254  FwIndexType portNum,
255  Fw::InputSerializePort* port
256  );
257 
258 #endif
259 
260 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
261 
262  public:
263 
264  // ----------------------------------------------------------------------
265  // Connect serial input ports to typed output ports
266  // ----------------------------------------------------------------------
267 
270  FwIndexType portNum,
271  Fw::InputSerializePort* port
272  );
273 
276  FwIndexType portNum,
277  Fw::InputSerializePort* port
278  );
279 
280 #endif
281 
282  public:
283 
284  // ----------------------------------------------------------------------
285  // Command registration
286  // ----------------------------------------------------------------------
287 
291  void regCommands();
292 
293  protected:
294 
295  // ----------------------------------------------------------------------
296  // Component construction and destruction
297  // ----------------------------------------------------------------------
298 
301  const char* compName = ""
302  );
303 
306 
307  protected:
308 
309  // ----------------------------------------------------------------------
310  // Getters for numbers of special input ports
311  // ----------------------------------------------------------------------
312 
317  return NUM_CMDIN_INPUT_PORTS;
318  }
319 
320  protected:
321 
322  // ----------------------------------------------------------------------
323  // Getters for numbers of typed input ports
324  // ----------------------------------------------------------------------
325 
331  }
332 
337  return NUM_PINGIN_INPUT_PORTS;
338  }
339 
340  protected:
341 
342  // ----------------------------------------------------------------------
343  // Getters for numbers of special output ports
344  // ----------------------------------------------------------------------
345 
351  }
352 
358  }
359 
365  }
366 
367 #if FW_ENABLE_TEXT_LOGGING == 1
368 
372  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
374  }
375 
376 #endif
377 
383  }
384 
385  protected:
386 
387  // ----------------------------------------------------------------------
388  // Getters for numbers of typed output ports
389  // ----------------------------------------------------------------------
390 
396  }
397 
403  }
404 
405  protected:
406 
407  // ----------------------------------------------------------------------
408  // Connection status queries for special output ports
409  // ----------------------------------------------------------------------
410 
415  FwIndexType portNum
416  ) const;
417 
422  FwIndexType portNum
423  ) const;
424 
429  FwIndexType portNum
430  ) const;
431 
432 #if FW_ENABLE_TEXT_LOGGING == 1
433 
437  bool isConnected_logTextOut_OutputPort(
438  FwIndexType portNum
439  ) const;
440 
441 #endif
442 
447  FwIndexType portNum
448  ) const;
449 
450  protected:
451 
452  // ----------------------------------------------------------------------
453  // Connection status queries for typed output ports
454  // ----------------------------------------------------------------------
455 
460  FwIndexType portNum
461  ) const;
462 
467  FwIndexType portNum
468  ) const;
469 
470 #if FW_DIRECT_PORT_CALLS
471  public:
472 #else
473  protected:
474 #endif
475 
476  // ----------------------------------------------------------------------
477  // Port handler base-class functions for special input ports
478  //
479  // Call these functions directly to bypass the corresponding ports
480  // ----------------------------------------------------------------------
481 
483  void cmdIn_handlerBase(
484  FwIndexType portNum,
485  FwOpcodeType opCode,
486  U32 cmdSeq,
487  Fw::CmdArgBuffer& args
488  );
489 
490  protected:
491 
492  // ----------------------------------------------------------------------
493  // Handlers to implement for typed input ports
494  // ----------------------------------------------------------------------
495 
497  virtual void fileAnnounceRecv_handler(
498  FwIndexType portNum,
499  Fw::StringBase& file_name
500  ) = 0;
501 
503  virtual void pingIn_handler(
504  FwIndexType portNum,
505  U32 key
506  ) = 0;
507 
508 #if FW_DIRECT_PORT_CALLS
509  public:
510 #else
511  protected:
512 #endif
513 
514  // ----------------------------------------------------------------------
515  // Port handler base-class functions for typed input ports
516  //
517  // Call these functions directly to bypass the corresponding ports
518  // ----------------------------------------------------------------------
519 
522  FwIndexType portNum,
523  Fw::StringBase& file_name
524  );
525 
527  void pingIn_handlerBase(
528  FwIndexType portNum,
529  U32 key
530  );
531 
532  protected:
533 
534  // ----------------------------------------------------------------------
535  // Pre-message hooks for typed async input ports
536  //
537  // Each of these functions is invoked just before processing a message
538  // on the corresponding port. By default, they do nothing. You can
539  // override them to provide specific pre-message behavior.
540  // ----------------------------------------------------------------------
541 
543  virtual void fileAnnounceRecv_preMsgHook(
544  FwIndexType portNum,
545  Fw::StringBase& file_name
546  );
547 
549  virtual void pingIn_preMsgHook(
550  FwIndexType portNum,
551  U32 key
552  );
553 
554  protected:
555 
556  // ----------------------------------------------------------------------
557  // Invocation functions for typed output ports
558  // ----------------------------------------------------------------------
559 
561  void fileDispatch_out(
562  FwIndexType portNum,
563  Fw::StringBase& file_name
564  ) const;
565 
567  void pingOut_out(
568  FwIndexType portNum,
569  U32 key
570  ) const;
571 
572  protected:
573 
574  // ----------------------------------------------------------------------
575  // Command response
576  // ----------------------------------------------------------------------
577 
579  void cmdResponse_out(
580  FwOpcodeType opCode,
581  U32 cmdSeq,
582  Fw::CmdResponse response
583  );
584 
585  protected:
586 
587  // ----------------------------------------------------------------------
588  // Command handlers to implement
589  // ----------------------------------------------------------------------
590 
592  virtual void ENABLE_DISPATCH_cmdHandler(
593  FwOpcodeType opCode,
594  U32 cmdSeq,
596  Fw::Enabled enable
597  ) = 0;
598 
599  protected:
600 
601  // ----------------------------------------------------------------------
602  // Command handler base-class functions
603  //
604  // Call these functions directly to bypass the command input port
605  // ----------------------------------------------------------------------
606 
609  FwOpcodeType opCode,
610  U32 cmdSeq,
611  Fw::CmdArgBuffer& args
612  );
613 
614  protected:
615 
616  // ----------------------------------------------------------------------
617  // Pre-message hooks for async commands
618  //
619  // Each of these functions is invoked just before processing the
620  // corresponding command. By default they do nothing. You can
621  // override them to provide specific pre-command behavior.
622  // ----------------------------------------------------------------------
623 
625  virtual void ENABLE_DISPATCH_preMsgHook(
626  FwOpcodeType opCode,
627  U32 cmdSeq
628  );
629 
630  protected:
631 
632  // ----------------------------------------------------------------------
633  // Event logging functions
634  // ----------------------------------------------------------------------
635 
639  Fw::Enabled enabled
640  ) const;
641 
644  const Fw::StringBase& file_name,
646  ) const;
647 
648  protected:
649 
650  // ----------------------------------------------------------------------
651  // Time
652  // ----------------------------------------------------------------------
653 
657  Fw::Time getTime() const;
658 
659  private:
660 
661  // ----------------------------------------------------------------------
662  // Message dispatch functions
663  // ----------------------------------------------------------------------
664 
666  virtual MsgDispatchStatus doDispatch();
667 
668  private:
669 
670  // ----------------------------------------------------------------------
671  // Calls for messages received on special input ports
672  // ----------------------------------------------------------------------
673 
675  static void m_p_cmdIn_in(
676  Fw::PassiveComponentBase* callComp,
677  FwIndexType portNum,
678  FwOpcodeType opCode,
679  U32 cmdSeq,
680  Fw::CmdArgBuffer& args
681  );
682 
683  private:
684 
685  // ----------------------------------------------------------------------
686  // Calls for messages received on typed input ports
687  // ----------------------------------------------------------------------
688 
690  static void m_p_fileAnnounceRecv_in(
691  Fw::PassiveComponentBase* callComp,
692  FwIndexType portNum,
693  Fw::StringBase& file_name
694  );
695 
697  static void m_p_pingIn_in(
698  Fw::PassiveComponentBase* callComp,
699  FwIndexType portNum,
700  U32 key
701  );
702 
703  private:
704 
705  // ----------------------------------------------------------------------
706  // Invocation functions for special output ports
707  // ----------------------------------------------------------------------
708 
710  void cmdRegOut_out(
711  FwIndexType portNum,
712  FwOpcodeType opCode
713  ) const;
714 
716  void cmdResponseOut_out(
717  FwIndexType portNum,
718  FwOpcodeType opCode,
719  U32 cmdSeq,
720  const Fw::CmdResponse& response
721  ) const;
722 
724  void logOut_out(
725  FwIndexType portNum,
726  FwEventIdType id,
727  Fw::Time& timeTag,
728  const Fw::LogSeverity& severity,
729  Fw::LogBuffer& args
730  ) const;
731 
732 #if FW_ENABLE_TEXT_LOGGING
733 
735  void logTextOut_out(
736  FwIndexType portNum,
737  FwEventIdType id,
738  Fw::Time& timeTag,
739  const Fw::LogSeverity& severity,
740  Fw::TextLogString& text
741  ) const;
742 
743 #endif
744 
746  void timeCaller_out(
747  FwIndexType portNum,
748  Fw::Time& time
749  ) const;
750 
751 #if !FW_DIRECT_PORT_CALLS
752 
753  private:
754 
755  // ----------------------------------------------------------------------
756  // Special input ports
757  // ----------------------------------------------------------------------
758 
760  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
761 
762 #endif
763 
764 #if !FW_DIRECT_PORT_CALLS
765 
766  private:
767 
768  // ----------------------------------------------------------------------
769  // Typed input ports
770  // ----------------------------------------------------------------------
771 
773  Svc::InputFileAnnouncePort m_fileAnnounceRecv_InputPort[NUM_FILEANNOUNCERECV_INPUT_PORTS];
774 
776  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
777 
778 #endif
779 
780 #if !FW_DIRECT_PORT_CALLS
781 
782  private:
783 
784  // ----------------------------------------------------------------------
785  // Special output ports
786  // ----------------------------------------------------------------------
787 
789  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
790 
792  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
793 
795  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
796 
797 #if FW_ENABLE_TEXT_LOGGING == 1
798 
800  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
801 
802 #endif
803 
805  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
806 
807 #endif
808 
809 #if !FW_DIRECT_PORT_CALLS
810 
811  private:
812 
813  // ----------------------------------------------------------------------
814  // Typed output ports
815  // ----------------------------------------------------------------------
816 
819 
821  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
822 
823 #endif
824 
825  };
826 
827 }
828 
829 #endif
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
bool isConnected_pingOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
FwIdType FwOpcodeType
The type of a command opcode.
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
bool isConnected_fileDispatch_OutputPort(FwIndexType portNum) const
PlatformSizeType FwSizeType
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
I32 FwEnumStoreType
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
friend class FileDispatcherTester
Friend class tester implementation to support white-box testing.
void fileAnnounceRecv_handlerBase(FwIndexType portNum, Fw::StringBase &file_name)
Handler base-class function for input port fileAnnounceRecv.
FileDispatcherComponentBase(const char *compName="")
Construct FileDispatcherComponentBase object.
Enum representing a command response.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
virtual void fileAnnounceRecv_handler(FwIndexType portNum, Fw::StringBase &file_name)=0
Handler for input port fileAnnounceRecv.
void log_ACTIVITY_HI_FileDispatchState(Svc::FileDispatcherCfg::FileDispatchPort file_type, Fw::Enabled enabled) const
Log event FileDispatchState.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
virtual void ENABLE_DISPATCH_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command ENABLE_DISPATCH.
void init()
Object initializer.
Definition: ObjBase.cpp:24
void regCommands()
Register commands with the Command Dispatcher.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_fileDispatch_OutputPorts()
FwIdType FwEventIdType
The type of an event identifier.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_pingIn_InputPorts()
virtual void ENABLE_DISPATCH_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::FileDispatcherCfg::FileDispatchPort file_type, Fw::Enabled enable)=0
Handler for command ENABLE_DISPATCH.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_cmdIn_InputPorts()
friend class FileDispatcherTesterBase
Friend class tester to support autocoded test harness.
void ENABLE_DISPATCH_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Base-class handler function for command ENABLE_DISPATCH.
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
Enum representing event severity.
virtual void fileAnnounceRecv_preMsgHook(FwIndexType portNum, Fw::StringBase &file_name)
Pre-message hook for async input port fileAnnounceRecv.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
Enabled and disabled states.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
void set_fileDispatch_OutputPort(FwIndexType portNum, Svc::InputFileDispatchPort *port)
Connect port to fileDispatch[portNum].
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Svc::InputFileAnnouncePort * get_fileAnnounceRecv_InputPort(FwIndexType portNum)
virtual ~FileDispatcherComponentBase()
Destroy FileDispatcherComponentBase object.
PlatformIndexType FwIndexType
Auto-generated base for FileDispatcher component.
RateGroupDivider component implementation.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
static constexpr FwIndexType getNum_pingOut_OutputPorts()
void fileDispatch_out(FwIndexType portNum, Fw::StringBase &file_name) const
Invoke output port fileDispatch.
void log_ACTIVITY_HI_FileDispatched(const Fw::StringBase &file_name, Svc::FileDispatcherCfg::FileDispatchPort file_type) const
Log event FileDispatched.
static constexpr FwIndexType getNum_fileAnnounceRecv_InputPorts()
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)