F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActiveRateGroupComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ActiveRateGroupComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ActiveRateGroup component base class
5 // ======================================================================
6 
7 #ifndef Svc_ActiveRateGroupComponentAc_HPP
8 #define Svc_ActiveRateGroupComponentAc_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
21 #include "Fw/Time/TimePortAc.hpp"
22 #include "Fw/Tlm/TlmPortAc.hpp"
23 #include "Fw/Tlm/TlmString.hpp"
25 #include "Svc/Ping/PingPortAc.hpp"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
46 
47  PROTECTED:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
57  };
58 
60  enum {
65  };
66 
68  enum {
71  };
72 
74  enum {
77  };
78 
80  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  public:
98 
99  // ----------------------------------------------------------------------
100  // Getters for typed input ports
101  // ----------------------------------------------------------------------
102 
107  FwIndexType portNum
108  );
109 
114  FwIndexType portNum
115  );
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Connect input ports to special output ports
121  // ----------------------------------------------------------------------
122 
124  void set_Log_OutputPort(
125  FwIndexType portNum,
126  Fw::InputLogPort* port
127  );
128 
129 #if FW_ENABLE_TEXT_LOGGING == 1
130 
132  void set_LogText_OutputPort(
133  FwIndexType portNum,
134  Fw::InputLogTextPort* port
135  );
136 
137 #endif
138 
140  void set_Time_OutputPort(
141  FwIndexType portNum,
142  Fw::InputTimePort* port
143  );
144 
146  void set_Tlm_OutputPort(
147  FwIndexType portNum,
148  Fw::InputTlmPort* port
149  );
150 
151  public:
152 
153  // ----------------------------------------------------------------------
154  // Connect typed input ports to typed output ports
155  // ----------------------------------------------------------------------
156 
159  FwIndexType portNum,
160  Svc::InputPingPort* port
161  );
162 
165  FwIndexType portNum,
166  Svc::InputSchedPort* port
167  );
168 
169 #if FW_PORT_SERIALIZATION
170 
171  public:
172 
173  // ----------------------------------------------------------------------
174  // Connect serial input ports to special output ports
175  // ----------------------------------------------------------------------
176 
178  void set_Log_OutputPort(
179  FwIndexType portNum,
180  Fw::InputSerializePort* port
181  );
182 
183 #if FW_ENABLE_TEXT_LOGGING == 1
184 
186  void set_LogText_OutputPort(
187  FwIndexType portNum,
188  Fw::InputSerializePort* port
189  );
190 
191 #endif
192 
194  void set_Time_OutputPort(
195  FwIndexType portNum,
196  Fw::InputSerializePort* port
197  );
198 
200  void set_Tlm_OutputPort(
201  FwIndexType portNum,
202  Fw::InputSerializePort* port
203  );
204 
205 #endif
206 
207 #if FW_PORT_SERIALIZATION
208 
209  public:
210 
211  // ----------------------------------------------------------------------
212  // Connect serial input ports to typed output ports
213  // ----------------------------------------------------------------------
214 
217  FwIndexType portNum,
218  Fw::InputSerializePort* port
219  );
220 
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
227 #endif
228 
229  PROTECTED:
230 
231  // ----------------------------------------------------------------------
232  // Component construction and destruction
233  // ----------------------------------------------------------------------
234 
237  const char* compName = ""
238  );
239 
242 
243  PROTECTED:
244 
245  // ----------------------------------------------------------------------
246  // Getters for numbers of typed input ports
247  // ----------------------------------------------------------------------
248 
253 
258 
259  PROTECTED:
260 
261  // ----------------------------------------------------------------------
262  // Getters for numbers of special output ports
263  // ----------------------------------------------------------------------
264 
269 
270 #if FW_ENABLE_TEXT_LOGGING == 1
271 
275  FwIndexType getNum_LogText_OutputPorts() const;
276 
277 #endif
278 
283 
288 
289  PROTECTED:
290 
291  // ----------------------------------------------------------------------
292  // Getters for numbers of typed output ports
293  // ----------------------------------------------------------------------
294 
299 
304 
305  PROTECTED:
306 
307  // ----------------------------------------------------------------------
308  // Connection status queries for special output ports
309  // ----------------------------------------------------------------------
310 
315  FwIndexType portNum
316  );
317 
318 #if FW_ENABLE_TEXT_LOGGING == 1
319 
323  bool isConnected_LogText_OutputPort(
324  FwIndexType portNum
325  );
326 
327 #endif
328 
333  FwIndexType portNum
334  );
335 
340  FwIndexType portNum
341  );
342 
343  PROTECTED:
344 
345  // ----------------------------------------------------------------------
346  // Connection status queries for typed output ports
347  // ----------------------------------------------------------------------
348 
353  FwIndexType portNum
354  );
355 
360  FwIndexType portNum
361  );
362 
363  PROTECTED:
364 
365  // ----------------------------------------------------------------------
366  // Handlers to implement for typed input ports
367  // ----------------------------------------------------------------------
368 
370  virtual void CycleIn_handler(
371  FwIndexType portNum,
372  Os::RawTime& cycleStart
373  ) = 0;
374 
376  virtual void PingIn_handler(
377  FwIndexType portNum,
378  U32 key
379  ) = 0;
380 
381  PROTECTED:
382 
383  // ----------------------------------------------------------------------
384  // Port handler base-class functions for typed input ports
385  //
386  // Call these functions directly to bypass the corresponding ports
387  // ----------------------------------------------------------------------
388 
390  void CycleIn_handlerBase(
391  FwIndexType portNum,
392  Os::RawTime& cycleStart
393  );
394 
396  void PingIn_handlerBase(
397  FwIndexType portNum,
398  U32 key
399  );
400 
401  PROTECTED:
402 
403  // ----------------------------------------------------------------------
404  // Pre-message hooks for typed async input ports
405  //
406  // Each of these functions is invoked just before processing a message
407  // on the corresponding port. By default, they do nothing. You can
408  // override them to provide specific pre-message behavior.
409  // ----------------------------------------------------------------------
410 
412  virtual void CycleIn_preMsgHook(
413  FwIndexType portNum,
414  Os::RawTime& cycleStart
415  );
416 
418  virtual void PingIn_preMsgHook(
419  FwIndexType portNum,
420  U32 key
421  );
422 
423  PROTECTED:
424 
425  // ----------------------------------------------------------------------
426  // Invocation functions for typed output ports
427  // ----------------------------------------------------------------------
428 
430  void PingOut_out(
431  FwIndexType portNum,
432  U32 key
433  );
434 
437  FwIndexType portNum,
438  U32 context
439  );
440 
441  PROTECTED:
442 
443  // ----------------------------------------------------------------------
444  // Event logging functions
445  // ----------------------------------------------------------------------
446 
450  void log_DIAGNOSTIC_RateGroupStarted() const;
451 
456  U32 cycle
457  ) const;
458 
459  PROTECTED:
460 
461  // ----------------------------------------------------------------------
462  // Telemetry write functions
463  // ----------------------------------------------------------------------
464 
468  void tlmWrite_RgMaxTime(
469  U32 arg,
470  Fw::Time _tlmTime = Fw::Time()
471  );
472 
477  U32 arg,
478  Fw::Time _tlmTime = Fw::Time()
479  );
480 
481  PROTECTED:
482 
483  // ----------------------------------------------------------------------
484  // Time
485  // ----------------------------------------------------------------------
486 
490  Fw::Time getTime() const;
491 
492  PRIVATE:
493 
494  // ----------------------------------------------------------------------
495  // Message dispatch functions
496  // ----------------------------------------------------------------------
497 
499  virtual MsgDispatchStatus doDispatch();
500 
501  PRIVATE:
502 
503  // ----------------------------------------------------------------------
504  // Calls for messages received on typed input ports
505  // ----------------------------------------------------------------------
506 
508  static void m_p_CycleIn_in(
509  Fw::PassiveComponentBase* callComp,
510  FwIndexType portNum,
511  Os::RawTime& cycleStart
512  );
513 
515  static void m_p_PingIn_in(
516  Fw::PassiveComponentBase* callComp,
517  FwIndexType portNum,
518  U32 key
519  );
520 
521  PRIVATE:
522 
523  // ----------------------------------------------------------------------
524  // Typed input ports
525  // ----------------------------------------------------------------------
526 
528  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
529 
531  Svc::InputPingPort m_PingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
532 
533  PRIVATE:
534 
535  // ----------------------------------------------------------------------
536  // Special output ports
537  // ----------------------------------------------------------------------
538 
540  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
541 
542 #if FW_ENABLE_TEXT_LOGGING == 1
543 
545  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
546 
547 #endif
548 
550  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
551 
553  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
554 
555  PRIVATE:
556 
557  // ----------------------------------------------------------------------
558  // Typed output ports
559  // ----------------------------------------------------------------------
560 
562  Svc::OutputPingPort m_PingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
563 
565  Svc::OutputSchedPort m_RateGroupMemberOut_OutputPort[NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
566 
567  PRIVATE:
568 
569  // ----------------------------------------------------------------------
570  // First update flags for telemetry channels
571  // ----------------------------------------------------------------------
572 
574  bool m_first_update_RgMaxTime;
575 
577  bool m_first_update_RgCycleSlips;
578 
579  PRIVATE:
580 
581  // ----------------------------------------------------------------------
582  // Last value storage for telemetry channels
583  // ----------------------------------------------------------------------
584 
586  U32 m_last_RgMaxTime;
587 
589  U32 m_last_RgCycleSlips;
590 
591  };
592 
593 }
594 
595 #endif
void set_PingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to PingOut[portNum].
Definition: Time.hpp:9
void tlmWrite_RgCycleSlips(U32 arg, Fw::Time _tlmTime=Fw::Time())
friend class ActiveRateGroupTesterBase
Friend class tester to support autocoded test harness.
friend class ActiveRateGroupComponentBaseFriend
Friend class for white-box testing.
PlatformSizeType FwSizeType
void CycleIn_handlerBase(FwIndexType portNum, Os::RawTime &cycleStart)
Handler base-class function for input port CycleIn.
void PingOut_out(FwIndexType portNum, U32 key)
Invoke output port PingOut.
I32 FwEnumStoreType
virtual void PingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port PingIn.
virtual ~ActiveRateGroupComponentBase()
Destroy ActiveRateGroupComponentBase object.
bool isConnected_Time_OutputPort(FwIndexType portNum)
virtual void CycleIn_preMsgHook(FwIndexType portNum, Os::RawTime &cycleStart)
Pre-message hook for async input port CycleIn.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void init()
Object initializer.
Definition: ObjBase.cpp:26
ActiveRateGroupComponentBase(const char *compName="")
Construct ActiveRateGroupComponentBase object.
void set_RateGroupMemberOut_OutputPort(FwIndexType portNum, Svc::InputSchedPort *port)
Connect port to RateGroupMemberOut[portNum].
bool isConnected_Log_OutputPort(FwIndexType portNum)
Warning event that rate group has had a cycle slip.
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void tlmWrite_RgMaxTime(U32 arg, Fw::Time _tlmTime=Fw::Time())
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
bool isConnected_RateGroupMemberOut_OutputPort(FwIndexType portNum)
virtual void CycleIn_handler(FwIndexType portNum, Os::RawTime &cycleStart)=0
Handler for input port CycleIn.
Auto-generated base for ActiveRateGroup component.
PlatformIndexType FwIndexType
Svc::InputPingPort * get_PingIn_InputPort(FwIndexType portNum)
RateGroupDivider component implementation.
virtual void PingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port PingIn.
bool isConnected_PingOut_OutputPort(FwIndexType portNum)
Svc::InputCyclePort * get_CycleIn_InputPort(FwIndexType portNum)
void RateGroupMemberOut_out(FwIndexType portNum, U32 context)
Invoke output port RateGroupMemberOut.
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void PingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port PingIn.