F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FprimeFramerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FprimeFramerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FprimeFramer component base class
5 // ======================================================================
6 
7 #ifndef Svc_FprimeFramerComponentAc_HPP
8 #define Svc_FprimeFramerComponentAc_HPP
9 
10 #include <atomic>
11 
15 #include "Fw/FPrimeBasicTypes.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #include "Fw/Log/LogTextPortAc.hpp"
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
26 #include "Fw/Time/TimePortAc.hpp"
28 
29 namespace Svc {
30 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
44  friend class FprimeFramerTesterBase;
46  friend class FprimeFramerTester;
47 
48  protected:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
59  };
60 
62  enum {
66  };
67 
69  enum {
75  };
76 
78  enum {
80  };
81 
83  enum {
85  };
86 
87  public:
88 
89  // ----------------------------------------------------------------------
90  // Component initialization
91  // ----------------------------------------------------------------------
92 
94  void init(
95  FwEnumStoreType instance = 0
96  );
97 
98 #if !FW_DIRECT_PORT_CALLS
99 
100  public:
101 
102  // ----------------------------------------------------------------------
103  // Getters for typed input ports
104  // ----------------------------------------------------------------------
105 
110  FwIndexType portNum
111  );
112 
117  FwIndexType portNum
118  );
119 
124  FwIndexType portNum
125  );
126 
127 #endif
128 
129 #if !FW_DIRECT_PORT_CALLS
130 
131  public:
132 
133  // ----------------------------------------------------------------------
134  // Connect input ports to special output ports
135  // ----------------------------------------------------------------------
136 
139  FwIndexType portNum,
140  Fw::InputLogPort* port
141  );
142 
143 #if FW_ENABLE_TEXT_LOGGING == 1
144 
146  void set_logTextOut_OutputPort(
147  FwIndexType portNum,
148  Fw::InputLogTextPort* port
149  );
150 
151 #endif
152 
155  FwIndexType portNum,
156  Fw::InputTimePort* port
157  );
158 
159 #endif
160 
161 #if !FW_DIRECT_PORT_CALLS
162 
163  public:
164 
165  // ----------------------------------------------------------------------
166  // Connect typed input ports to typed output ports
167  // ----------------------------------------------------------------------
168 
171  FwIndexType portNum,
173  );
174 
177  FwIndexType portNum,
179  );
180 
183  FwIndexType portNum,
185  );
186 
189  FwIndexType portNum,
191  );
192 
195  FwIndexType portNum,
197  );
198 
199 #endif
200 
201 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
202 
203  public:
204 
205  // ----------------------------------------------------------------------
206  // Connect serial input ports to special output ports
207  // ----------------------------------------------------------------------
208 
211  FwIndexType portNum,
212  Fw::InputSerializePort* port
213  );
214 
215 #if FW_ENABLE_TEXT_LOGGING == 1
216 
218  void set_logTextOut_OutputPort(
219  FwIndexType portNum,
220  Fw::InputSerializePort* port
221  );
222 
223 #endif
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
231 #endif
232 
233 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
234 
235  public:
236 
237  // ----------------------------------------------------------------------
238  // Connect serial input ports to typed output ports
239  // ----------------------------------------------------------------------
240 
243  FwIndexType portNum,
244  Fw::InputSerializePort* port
245  );
246 
249  FwIndexType portNum,
250  Fw::InputSerializePort* port
251  );
252 
255  FwIndexType portNum,
256  Fw::InputSerializePort* port
257  );
258 
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
265 #endif
266 
267  protected:
268 
269  // ----------------------------------------------------------------------
270  // Component construction and destruction
271  // ----------------------------------------------------------------------
272 
275  const char* compName = ""
276  );
277 
279  virtual ~FprimeFramerComponentBase();
280 
281  protected:
282 
283  // ----------------------------------------------------------------------
284  // Getters for numbers of typed input ports
285  // ----------------------------------------------------------------------
286 
292  }
293 
298  return NUM_DATAIN_INPUT_PORTS;
299  }
300 
306  }
307 
308  protected:
309 
310  // ----------------------------------------------------------------------
311  // Getters for numbers of special output ports
312  // ----------------------------------------------------------------------
313 
319  }
320 
321 #if FW_ENABLE_TEXT_LOGGING == 1
322 
326  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
328  }
329 
330 #endif
331 
337  }
338 
339  protected:
340 
341  // ----------------------------------------------------------------------
342  // Getters for numbers of typed output ports
343  // ----------------------------------------------------------------------
344 
350  }
351 
357  }
358 
364  }
365 
371  }
372 
378  }
379 
380  protected:
381 
382  // ----------------------------------------------------------------------
383  // Connection status queries for special output ports
384  // ----------------------------------------------------------------------
385 
390  FwIndexType portNum
391  ) const;
392 
393 #if FW_ENABLE_TEXT_LOGGING == 1
394 
398  bool isConnected_logTextOut_OutputPort(
399  FwIndexType portNum
400  ) const;
401 
402 #endif
403 
408  FwIndexType portNum
409  ) const;
410 
411  protected:
412 
413  // ----------------------------------------------------------------------
414  // Connection status queries for typed output ports
415  // ----------------------------------------------------------------------
416 
421  FwIndexType portNum
422  ) const;
423 
428  FwIndexType portNum
429  ) const;
430 
435  FwIndexType portNum
436  ) const;
437 
442  FwIndexType portNum
443  ) const;
444 
449  FwIndexType portNum
450  ) const;
451 
452  protected:
453 
454  // ----------------------------------------------------------------------
455  // Handlers to implement for typed input ports
456  // ----------------------------------------------------------------------
457 
459  virtual void comStatusIn_handler(
460  FwIndexType portNum,
461  Fw::Success& condition
462  ) = 0;
463 
465  virtual void dataIn_handler(
466  FwIndexType portNum,
467  Fw::Buffer& data,
468  const ComCfg::FrameContext& context
469  ) = 0;
470 
472  virtual void dataReturnIn_handler(
473  FwIndexType portNum,
474  Fw::Buffer& data,
475  const ComCfg::FrameContext& context
476  ) = 0;
477 
478 #if FW_DIRECT_PORT_CALLS
479  public:
480 #else
481  protected:
482 #endif
483 
484  // ----------------------------------------------------------------------
485  // Port handler base-class functions for typed input ports
486  //
487  // Call these functions directly to bypass the corresponding ports
488  // ----------------------------------------------------------------------
489 
492  FwIndexType portNum,
493  Fw::Success& condition
494  );
495 
497  void dataIn_handlerBase(
498  FwIndexType portNum,
499  Fw::Buffer& data,
500  const ComCfg::FrameContext& context
501  );
502 
505  FwIndexType portNum,
506  Fw::Buffer& data,
507  const ComCfg::FrameContext& context
508  );
509 
510  protected:
511 
512  // ----------------------------------------------------------------------
513  // Invocation functions for typed output ports
514  // ----------------------------------------------------------------------
515 
518  FwIndexType portNum,
519  FwSizeType size
520  ) const;
521 
524  FwIndexType portNum,
525  Fw::Buffer& fwBuffer
526  ) const;
527 
529  void comStatusOut_out(
530  FwIndexType portNum,
531  Fw::Success& condition
532  ) const;
533 
535  void dataOut_out(
536  FwIndexType portNum,
537  Fw::Buffer& data,
538  const ComCfg::FrameContext& context
539  ) const;
540 
542  void dataReturnOut_out(
543  FwIndexType portNum,
544  Fw::Buffer& data,
545  const ComCfg::FrameContext& context
546  ) const;
547 
548  protected:
549 
550  // ----------------------------------------------------------------------
551  // Event logging functions
552  // ----------------------------------------------------------------------
553 
558 
559  protected:
560 
561  // ----------------------------------------------------------------------
562  // Event throttle reset functions
563  // ----------------------------------------------------------------------
564 
567 
568  protected:
569 
570  // ----------------------------------------------------------------------
571  // Time
572  // ----------------------------------------------------------------------
573 
577  Fw::Time getTime() const;
578 
579  private:
580 
581  // ----------------------------------------------------------------------
582  // Calls for messages received on typed input ports
583  // ----------------------------------------------------------------------
584 
586  static void m_p_comStatusIn_in(
587  Fw::PassiveComponentBase* callComp,
588  FwIndexType portNum,
589  Fw::Success& condition
590  );
591 
593  static void m_p_dataIn_in(
594  Fw::PassiveComponentBase* callComp,
595  FwIndexType portNum,
596  Fw::Buffer& data,
597  const ComCfg::FrameContext& context
598  );
599 
601  static void m_p_dataReturnIn_in(
602  Fw::PassiveComponentBase* callComp,
603  FwIndexType portNum,
604  Fw::Buffer& data,
605  const ComCfg::FrameContext& context
606  );
607 
608  private:
609 
610  // ----------------------------------------------------------------------
611  // Invocation functions for special output ports
612  // ----------------------------------------------------------------------
613 
615  void logOut_out(
616  FwIndexType portNum,
617  FwEventIdType id,
618  Fw::Time& timeTag,
619  const Fw::LogSeverity& severity,
620  Fw::LogBuffer& args
621  ) const;
622 
623 #if FW_ENABLE_TEXT_LOGGING
624 
626  void logTextOut_out(
627  FwIndexType portNum,
628  FwEventIdType id,
629  Fw::Time& timeTag,
630  const Fw::LogSeverity& severity,
631  Fw::TextLogString& text
632  ) const;
633 
634 #endif
635 
637  void timeCaller_out(
638  FwIndexType portNum,
639  Fw::Time& time
640  ) const;
641 
642 #if !FW_DIRECT_PORT_CALLS
643 
644  private:
645 
646  // ----------------------------------------------------------------------
647  // Typed input ports
648  // ----------------------------------------------------------------------
649 
652 
655 
658 
659 #endif
660 
661 #if !FW_DIRECT_PORT_CALLS
662 
663  private:
664 
665  // ----------------------------------------------------------------------
666  // Special output ports
667  // ----------------------------------------------------------------------
668 
670  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
671 
672 #if FW_ENABLE_TEXT_LOGGING == 1
673 
675  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
676 
677 #endif
678 
680  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
681 
682 #endif
683 
684 #if !FW_DIRECT_PORT_CALLS
685 
686  private:
687 
688  // ----------------------------------------------------------------------
689  // Typed output ports
690  // ----------------------------------------------------------------------
691 
693  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
694 
696  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
697 
700 
703 
706 
707 #endif
708 
709  private:
710 
711  // ----------------------------------------------------------------------
712  // Counter values for event throttling
713  // ----------------------------------------------------------------------
714 
716  std::atomic<FwIndexType> m_NoBufferAvailableThrottle;
717 
718  };
719 
720 }
721 
722 #endif
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
PlatformSizeType FwSizeType
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
I32 FwEnumStoreType
Auto-generated base for FprimeFramer component.
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void log_WARNING_HI_NoBufferAvailable_ThrottleClear()
Reset throttle value for NoBufferAvailable.
void comStatusIn_handlerBase(FwIndexType portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
static constexpr FwIndexType getNum_comStatusIn_InputPorts()
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
friend class FprimeFramerTester
Friend class tester implementation to support white-box testing.
static constexpr FwIndexType getNum_logOut_OutputPorts()
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum) const
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
Fw::Buffer bufferAllocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port bufferAllocate.
FwIdType FwEventIdType
The type of an event identifier.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
virtual ~FprimeFramerComponentBase()
Destroy FprimeFramerComponentBase object.
void comStatusOut_out(FwIndexType portNum, Fw::Success &condition) const
Invoke output port comStatusOut.
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
static constexpr FwIndexType getNum_comStatusOut_OutputPorts()
Enum representing event severity.
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum) const
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
static constexpr FwIndexType getNum_bufferAllocate_OutputPorts()
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
friend class FprimeFramerTesterBase
Friend class tester to support autocoded test harness.
No buffer was available to hold the frame, which was dropped.
FprimeFramerComponentBase(const char *compName="")
Construct FprimeFramerComponentBase object.
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_dataOut_OutputPorts()
static constexpr FwIndexType getNum_bufferDeallocate_OutputPorts()
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferDeallocate.
Success/Failure.
bool isConnected_comStatusOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_dataIn_InputPorts()