F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActivePhaserComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ActivePhaserComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ActivePhaser component base class
5 // ======================================================================
6 
7 #ifndef Svc_ActivePhaserComponentAc_HPP
8 #define Svc_ActivePhaserComponentAc_HPP
9 
10 #include <atomic>
11 
13 #include "Fw/FPrimeBasicTypes.hpp"
14 #include "Fw/Log/LogPortAc.hpp"
15 #include "Fw/Log/LogString.hpp"
16 #include "Fw/Log/LogTextPortAc.hpp"
17 #if !FW_DIRECT_PORT_CALLS
19 #endif
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #include "Fw/Time/TimePortAc.hpp"
24 #include "Fw/Tlm/TlmPortAc.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
45  friend class ActivePhaserTesterBase;
47  friend class ActivePhaserTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
58  };
59 
61  enum {
66  };
67 
69  enum {
71  };
72 
74  enum {
76  };
77 
79  enum {
81  };
82 
83  public:
84 
85  // ----------------------------------------------------------------------
86  // Component initialization
87  // ----------------------------------------------------------------------
88 
90  void init(
91  FwSizeType queueDepth,
92  FwEnumStoreType instance = 0
93  );
94 
95 #if !FW_DIRECT_PORT_CALLS
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Getters for typed input ports
101  // ----------------------------------------------------------------------
102 
107  FwIndexType portNum
108  );
109 
110 #endif
111 
112 #if !FW_DIRECT_PORT_CALLS
113 
114  public:
115 
116  // ----------------------------------------------------------------------
117  // Connect input ports to special output ports
118  // ----------------------------------------------------------------------
119 
122  FwIndexType portNum,
123  Fw::InputLogPort* port
124  );
125 
126 #if FW_ENABLE_TEXT_LOGGING == 1
127 
129  void set_logTextOut_OutputPort(
130  FwIndexType portNum,
131  Fw::InputLogTextPort* port
132  );
133 
134 #endif
135 
138  FwIndexType portNum,
139  Fw::InputTimePort* port
140  );
141 
144  FwIndexType portNum,
145  Fw::InputTlmPort* port
146  );
147 
148 #endif
149 
150 #if !FW_DIRECT_PORT_CALLS
151 
152  public:
153 
154  // ----------------------------------------------------------------------
155  // Connect typed input ports to typed output ports
156  // ----------------------------------------------------------------------
157 
160  FwIndexType portNum,
161  Svc::InputSchedPort* port
162  );
163 
164 #endif
165 
166 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
167 
168  public:
169 
170  // ----------------------------------------------------------------------
171  // Connect serial input ports to special output ports
172  // ----------------------------------------------------------------------
173 
176  FwIndexType portNum,
177  Fw::InputSerializePort* port
178  );
179 
180 #if FW_ENABLE_TEXT_LOGGING == 1
181 
183  void set_logTextOut_OutputPort(
184  FwIndexType portNum,
185  Fw::InputSerializePort* port
186  );
187 
188 #endif
189 
192  FwIndexType portNum,
193  Fw::InputSerializePort* port
194  );
195 
198  FwIndexType portNum,
199  Fw::InputSerializePort* port
200  );
201 
202 #endif
203 
204 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
205 
206  public:
207 
208  // ----------------------------------------------------------------------
209  // Connect serial input ports to typed output ports
210  // ----------------------------------------------------------------------
211 
214  FwIndexType portNum,
215  Fw::InputSerializePort* port
216  );
217 
218 #endif
219 
220  protected:
221 
222  // ----------------------------------------------------------------------
223  // Component construction and destruction
224  // ----------------------------------------------------------------------
225 
228  const char* compName = ""
229  );
230 
232  virtual ~ActivePhaserComponentBase();
233 
234  protected:
235 
236  // ----------------------------------------------------------------------
237  // Getters for numbers of typed input ports
238  // ----------------------------------------------------------------------
239 
245  }
246 
247  protected:
248 
249  // ----------------------------------------------------------------------
250  // Getters for numbers of special output ports
251  // ----------------------------------------------------------------------
252 
258  }
259 
260 #if FW_ENABLE_TEXT_LOGGING == 1
261 
265  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
267  }
268 
269 #endif
270 
276  }
277 
283  }
284 
285  protected:
286 
287  // ----------------------------------------------------------------------
288  // Getters for numbers of typed output ports
289  // ----------------------------------------------------------------------
290 
296  }
297 
298  protected:
299 
300  // ----------------------------------------------------------------------
301  // Connection status queries for special output ports
302  // ----------------------------------------------------------------------
303 
308  FwIndexType portNum
309  ) const;
310 
311 #if FW_ENABLE_TEXT_LOGGING == 1
312 
316  bool isConnected_logTextOut_OutputPort(
317  FwIndexType portNum
318  ) const;
319 
320 #endif
321 
326  FwIndexType portNum
327  ) const;
328 
333  FwIndexType portNum
334  ) const;
335 
336  protected:
337 
338  // ----------------------------------------------------------------------
339  // Connection status queries for typed output ports
340  // ----------------------------------------------------------------------
341 
346  FwIndexType portNum
347  ) const;
348 
349  protected:
350 
351  // ----------------------------------------------------------------------
352  // Handlers to implement for typed input ports
353  // ----------------------------------------------------------------------
354 
356  virtual void CycleIn_handler(
357  FwIndexType portNum,
358  Os::RawTime& cycleStart
359  ) = 0;
360 
361 #if FW_DIRECT_PORT_CALLS
362  public:
363 #else
364  protected:
365 #endif
366 
367  // ----------------------------------------------------------------------
368  // Port handler base-class functions for typed input ports
369  //
370  // Call these functions directly to bypass the corresponding ports
371  // ----------------------------------------------------------------------
372 
374  void CycleIn_handlerBase(
375  FwIndexType portNum,
376  Os::RawTime& cycleStart
377  );
378 
379  protected:
380 
381  // ----------------------------------------------------------------------
382  // Pre-message hooks for typed async input ports
383  //
384  // Each of these functions is invoked just before processing a message
385  // on the corresponding port. By default, they do nothing. You can
386  // override them to provide specific pre-message behavior.
387  // ----------------------------------------------------------------------
388 
390  virtual void CycleIn_preMsgHook(
391  FwIndexType portNum,
392  Os::RawTime& cycleStart
393  );
394 
395  protected:
396 
397  // ----------------------------------------------------------------------
398  // Invocation functions for typed output ports
399  // ----------------------------------------------------------------------
400 
402  void PhaserMemberOut_out(
403  FwIndexType portNum,
404  U32 context
405  ) const;
406 
407  protected:
408 
409  // ----------------------------------------------------------------------
410  // Internal interface handlers
411  // ----------------------------------------------------------------------
412 
414  virtual void Tick_internalInterfaceHandler() = 0;
415 
416  protected:
417 
418  // ----------------------------------------------------------------------
419  // Internal interface base-class functions
420  // ----------------------------------------------------------------------
421 
424 
425  protected:
426 
427  // ----------------------------------------------------------------------
428  // Event logging functions
429  // ----------------------------------------------------------------------
430 
435  FwIndexType p,
436  U32 start,
437  U32 length,
438  U32 ticks
439  );
440 
441  protected:
442 
443  // ----------------------------------------------------------------------
444  // Event throttle reset functions
445  // ----------------------------------------------------------------------
446 
449 
450  protected:
451 
452  // ----------------------------------------------------------------------
453  // Time
454  // ----------------------------------------------------------------------
455 
459  Fw::Time getTime() const;
460 
461  private:
462 
463  // ----------------------------------------------------------------------
464  // Message dispatch functions
465  // ----------------------------------------------------------------------
466 
468  virtual MsgDispatchStatus doDispatch();
469 
470  private:
471 
472  // ----------------------------------------------------------------------
473  // Calls for messages received on typed input ports
474  // ----------------------------------------------------------------------
475 
477  static void m_p_CycleIn_in(
478  Fw::PassiveComponentBase* callComp,
479  FwIndexType portNum,
480  Os::RawTime& cycleStart
481  );
482 
483  private:
484 
485  // ----------------------------------------------------------------------
486  // Invocation functions for special output ports
487  // ----------------------------------------------------------------------
488 
490  void logOut_out(
491  FwIndexType portNum,
492  FwEventIdType id,
493  Fw::Time& timeTag,
494  const Fw::LogSeverity& severity,
495  Fw::LogBuffer& args
496  ) const;
497 
498 #if FW_ENABLE_TEXT_LOGGING
499 
501  void logTextOut_out(
502  FwIndexType portNum,
503  FwEventIdType id,
504  Fw::Time& timeTag,
505  const Fw::LogSeverity& severity,
506  Fw::TextLogString& text
507  ) const;
508 
509 #endif
510 
512  void timeCaller_out(
513  FwIndexType portNum,
514  Fw::Time& time
515  ) const;
516 
517 #if !FW_DIRECT_PORT_CALLS
518 
519  private:
520 
521  // ----------------------------------------------------------------------
522  // Typed input ports
523  // ----------------------------------------------------------------------
524 
526  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
527 
528 #endif
529 
530 #if !FW_DIRECT_PORT_CALLS
531 
532  private:
533 
534  // ----------------------------------------------------------------------
535  // Special output ports
536  // ----------------------------------------------------------------------
537 
539  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
540 
541 #if FW_ENABLE_TEXT_LOGGING == 1
542 
544  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
545 
546 #endif
547 
549  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
550 
552  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
553 
554 #endif
555 
556 #if !FW_DIRECT_PORT_CALLS
557 
558  private:
559 
560  // ----------------------------------------------------------------------
561  // Typed output ports
562  // ----------------------------------------------------------------------
563 
565  Svc::OutputSchedPort m_PhaserMemberOut_OutputPort[NUM_PHASERMEMBEROUT_OUTPUT_PORTS];
566 
567 #endif
568 
569  private:
570 
571  // ----------------------------------------------------------------------
572  // Counter values for event throttling
573  // ----------------------------------------------------------------------
574 
576  std::atomic<FwIndexType> m_MissedDeadlineThrottle;
577 
578  };
579 
580 }
581 
582 #endif
static constexpr FwIndexType getNum_CycleIn_InputPorts()
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
PlatformSizeType FwSizeType
I32 FwEnumStoreType
Warning event that rate group has had a missed deadline.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_PhaserMemberOut_OutputPort(FwIndexType portNum, Svc::InputSchedPort *port)
Connect port to PhaserMemberOut[portNum].
void PhaserMemberOut_out(FwIndexType portNum, U32 context) const
Invoke output port PhaserMemberOut.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIdType FwEventIdType
The type of an event identifier.
ActivePhaserComponentBase(const char *compName="")
Construct ActivePhaserComponentBase object.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
virtual ~ActivePhaserComponentBase()
Destroy ActivePhaserComponentBase object.
friend class ActivePhaserTester
Friend class tester implementation to support white-box testing.
Enum representing event severity.
void Tick_internalInterfaceInvoke()
Internal interface base-class function for Tick.
Svc::InputCyclePort * get_CycleIn_InputPort(FwIndexType portNum)
bool isConnected_PhaserMemberOut_OutputPort(FwIndexType portNum) const
friend class ActivePhaserTesterBase
Friend class tester to support autocoded test harness.
Auto-generated base for ActivePhaser component.
PlatformIndexType FwIndexType
virtual void Tick_internalInterfaceHandler()=0
Internal interface handler for Tick.
static constexpr FwIndexType getNum_PhaserMemberOut_OutputPorts()
void log_WARNING_HI_MissedDeadline_ThrottleClear()
Reset throttle value for MissedDeadline.
void CycleIn_handlerBase(FwIndexType portNum, Os::RawTime &cycleStart)
Handler base-class function for input port CycleIn.
virtual void CycleIn_handler(FwIndexType portNum, Os::RawTime &cycleStart)=0
Handler for input port CycleIn.
RateGroupDivider component implementation.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
virtual void CycleIn_preMsgHook(FwIndexType portNum, Os::RawTime &cycleStart)
Pre-message hook for async input port CycleIn.
void start(FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, FwSizeType stackSize=Os::Task::TASK_DEFAULT, FwSizeType cpuAffinity=Os::Task::TASK_DEFAULT, FwTaskIdType identifier=static_cast< FwTaskIdType >(Os::Task::TASK_DEFAULT))
called by instantiator when task is to be started
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_logOut_OutputPorts()
void log_WARNING_HI_MissedDeadline(FwIndexType p, U32 start, U32 length, U32 ticks)