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 #if FW_ENABLE_TEXT_LOGGING == 1
17 #include "Fw/Log/LogTextPortAc.hpp"
18 #endif
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Fw/Tlm/TlmPortAc.hpp"
31 
32 namespace Svc {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
47  friend class ActivePhaserTesterBase;
49  friend class ActivePhaserTester;
50 
51  protected:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
60  };
61 
63  enum {
68  };
69 
71  enum {
73  };
74 
76  enum {
78  };
79 
81  enum {
83  };
84 
85  public:
86 
87  // ----------------------------------------------------------------------
88  // Component initialization
89  // ----------------------------------------------------------------------
90 
92  void init(
93  FwSizeType queueDepth,
94  FwEnumStoreType instance = 0
95  );
96 
97 #if !FW_DIRECT_PORT_CALLS
98 
99  public:
100 
101  // ----------------------------------------------------------------------
102  // Getters for typed input ports
103  // ----------------------------------------------------------------------
104 
109  FwIndexType portNum
110  );
111 
112 #endif
113 
114 #if !FW_DIRECT_PORT_CALLS
115 
116  public:
117 
118  // ----------------------------------------------------------------------
119  // Connect input ports to special output ports
120  // ----------------------------------------------------------------------
121 
124  FwIndexType portNum,
125  Fw::InputLogPort* port
126  );
127 
128 #if FW_ENABLE_TEXT_LOGGING == 1
129 
131  void set_logTextOut_OutputPort(
132  FwIndexType portNum,
133  Fw::InputLogTextPort* port
134  );
135 
136 #endif
137 
140  FwIndexType portNum,
141  Fw::InputTimePort* port
142  );
143 
146  FwIndexType portNum,
147  Fw::InputTlmPort* port
148  );
149 
150 #endif
151 
152 #if !FW_DIRECT_PORT_CALLS
153 
154  public:
155 
156  // ----------------------------------------------------------------------
157  // Connect typed input ports to typed output ports
158  // ----------------------------------------------------------------------
159 
162  FwIndexType portNum,
163  Svc::InputSchedPort* port
164  );
165 
166 #endif
167 
168 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
169 
170  public:
171 
172  // ----------------------------------------------------------------------
173  // Connect serial input ports to special output ports
174  // ----------------------------------------------------------------------
175 
178  FwIndexType portNum,
179  Fw::InputSerializePort* port
180  );
181 
182 #if FW_ENABLE_TEXT_LOGGING == 1
183 
185  void set_logTextOut_OutputPort(
186  FwIndexType portNum,
187  Fw::InputSerializePort* port
188  );
189 
190 #endif
191 
194  FwIndexType portNum,
195  Fw::InputSerializePort* port
196  );
197 
200  FwIndexType portNum,
201  Fw::InputSerializePort* port
202  );
203 
204 #endif
205 
206 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
207 
208  public:
209 
210  // ----------------------------------------------------------------------
211  // Connect serial input ports to typed output ports
212  // ----------------------------------------------------------------------
213 
216  FwIndexType portNum,
217  Fw::InputSerializePort* port
218  );
219 
220 #endif
221 
222  protected:
223 
224  // ----------------------------------------------------------------------
225  // Component construction and destruction
226  // ----------------------------------------------------------------------
227 
230  const char* compName = ""
231  );
232 
234  virtual ~ActivePhaserComponentBase();
235 
236  protected:
237 
238  // ----------------------------------------------------------------------
239  // Getters for numbers of typed input ports
240  // ----------------------------------------------------------------------
241 
247  }
248 
249  protected:
250 
251  // ----------------------------------------------------------------------
252  // Getters for numbers of special output ports
253  // ----------------------------------------------------------------------
254 
260  }
261 
262 #if FW_ENABLE_TEXT_LOGGING == 1
263 
267  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
269  }
270 
271 #endif
272 
278  }
279 
285  }
286 
287  protected:
288 
289  // ----------------------------------------------------------------------
290  // Getters for numbers of typed output ports
291  // ----------------------------------------------------------------------
292 
298  }
299 
300  protected:
301 
302  // ----------------------------------------------------------------------
303  // Connection status queries for special output ports
304  // ----------------------------------------------------------------------
305 
310  FwIndexType portNum
311  ) const;
312 
313 #if FW_ENABLE_TEXT_LOGGING == 1
314 
318  bool isConnected_logTextOut_OutputPort(
319  FwIndexType portNum
320  ) const;
321 
322 #endif
323 
328  FwIndexType portNum
329  ) const;
330 
335  FwIndexType portNum
336  ) const;
337 
338  protected:
339 
340  // ----------------------------------------------------------------------
341  // Connection status queries for typed output ports
342  // ----------------------------------------------------------------------
343 
348  FwIndexType portNum
349  ) const;
350 
351  protected:
352 
353  // ----------------------------------------------------------------------
354  // Handlers to implement for typed input ports
355  // ----------------------------------------------------------------------
356 
358  virtual void CycleIn_handler(
359  FwIndexType portNum,
360  Os::RawTime& cycleStart
361  ) = 0;
362 
363 #if FW_DIRECT_PORT_CALLS
364  public:
365 #else
366  protected:
367 #endif
368 
369  // ----------------------------------------------------------------------
370  // Port handler base-class functions for typed input ports
371  //
372  // Call these functions directly to bypass the corresponding ports
373  // ----------------------------------------------------------------------
374 
376  void CycleIn_handlerBase(
377  FwIndexType portNum,
378  Os::RawTime& cycleStart
379  );
380 
381  protected:
382 
383  // ----------------------------------------------------------------------
384  // Pre-message hooks for typed async input ports
385  //
386  // Each of these functions is invoked just before processing a message
387  // on the corresponding port. By default, they do nothing. You can
388  // override them to provide specific pre-message behavior.
389  // ----------------------------------------------------------------------
390 
392  virtual void CycleIn_preMsgHook(
393  FwIndexType portNum,
394  Os::RawTime& cycleStart
395  );
396 
397  protected:
398 
399  // ----------------------------------------------------------------------
400  // Invocation functions for typed output ports
401  // ----------------------------------------------------------------------
402 
404  void PhaserMemberOut_out(
405  FwIndexType portNum,
406  U32 context
407  ) const;
408 
409  protected:
410 
411  // ----------------------------------------------------------------------
412  // Internal interface handlers
413  // ----------------------------------------------------------------------
414 
416  virtual void Tick_internalInterfaceHandler() = 0;
417 
418  protected:
419 
420  // ----------------------------------------------------------------------
421  // Internal interface base-class functions
422  // ----------------------------------------------------------------------
423 
426 
427  protected:
428 
429  // ----------------------------------------------------------------------
430  // Event logging functions
431  // ----------------------------------------------------------------------
432 
437  FwIndexType p,
438  U32 start,
439  U32 length,
440  U32 ticks
441  );
442 
443  protected:
444 
445  // ----------------------------------------------------------------------
446  // Event throttle reset functions
447  // ----------------------------------------------------------------------
448 
451 
452  protected:
453 
454  // ----------------------------------------------------------------------
455  // Time
456  // ----------------------------------------------------------------------
457 
461  Fw::Time getTime() const;
462 
463  private:
464 
465  // ----------------------------------------------------------------------
466  // Message dispatch functions
467  // ----------------------------------------------------------------------
468 
470  virtual MsgDispatchStatus doDispatch();
471 
472  private:
473 
474  // ----------------------------------------------------------------------
475  // Calls for messages received on typed input ports
476  // ----------------------------------------------------------------------
477 
479  static void m_p_CycleIn_in(
480  Fw::PassiveComponentBase* callComp,
481  FwIndexType portNum,
482  Os::RawTime& cycleStart
483  );
484 
485  private:
486 
487  // ----------------------------------------------------------------------
488  // Invocation functions for special output ports
489  // ----------------------------------------------------------------------
490 
492  void logOut_out(
493  FwIndexType portNum,
494  FwEventIdType id,
495  Fw::Time& timeTag,
496  const Fw::LogSeverity& severity,
497  Fw::LogBuffer& args
498  ) const;
499 
500 #if FW_ENABLE_TEXT_LOGGING
501 
503  void logTextOut_out(
504  FwIndexType portNum,
505  FwEventIdType id,
506  Fw::Time& timeTag,
507  const Fw::LogSeverity& severity,
508  Fw::TextLogString& text
509  ) const;
510 
511 #endif
512 
514  void timeCaller_out(
515  FwIndexType portNum,
516  Fw::Time& time
517  ) const;
518 
519 #if !FW_DIRECT_PORT_CALLS
520 
521  private:
522 
523  // ----------------------------------------------------------------------
524  // Typed input ports
525  // ----------------------------------------------------------------------
526 
528  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
529 
530 #endif
531 
532 #if !FW_DIRECT_PORT_CALLS
533 
534  private:
535 
536  // ----------------------------------------------------------------------
537  // Special output ports
538  // ----------------------------------------------------------------------
539 
541  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
542 
543 #if FW_ENABLE_TEXT_LOGGING == 1
544 
546  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
547 
548 #endif
549 
551  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
552 
554  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
555 
556 #endif
557 
558 #if !FW_DIRECT_PORT_CALLS
559 
560  private:
561 
562  // ----------------------------------------------------------------------
563  // Typed output ports
564  // ----------------------------------------------------------------------
565 
567  Svc::OutputSchedPort m_PhaserMemberOut_OutputPort[NUM_PHASERMEMBEROUT_OUTPUT_PORTS];
568 
569 #endif
570 
571  private:
572 
573  // ----------------------------------------------------------------------
574  // Counter values for event throttling
575  // ----------------------------------------------------------------------
576 
578  std::atomic<FwIndexType> m_MissedDeadlineThrottle;
579 
580  };
581 
582 }
583 
584 #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
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].
Warning event that rate group has had a missed deadline.
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)