F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FrameAccumulatorComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FrameAccumulatorComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FrameAccumulator component base class
5 // ======================================================================
6 
7 #ifndef Svc_FrameAccumulatorComponentAc_HPP
8 #define Svc_FrameAccumulatorComponentAc_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
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Os/Mutex.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
47  friend class FrameAccumulatorTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
59  };
60 
62  enum {
66  };
67 
69  enum {
74  };
75 
77  enum {
82  };
83 
84  public:
85 
86  // ----------------------------------------------------------------------
87  // Component initialization
88  // ----------------------------------------------------------------------
89 
91  void init(
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 
114  FwIndexType portNum
115  );
116 
117 #endif
118 
119 #if !FW_DIRECT_PORT_CALLS
120 
121  public:
122 
123  // ----------------------------------------------------------------------
124  // Connect input ports to special output ports
125  // ----------------------------------------------------------------------
126 
129  FwIndexType portNum,
130  Fw::InputLogPort* port
131  );
132 
133 #if FW_ENABLE_TEXT_LOGGING == 1
134 
136  void set_logTextOut_OutputPort(
137  FwIndexType portNum,
138  Fw::InputLogTextPort* port
139  );
140 
141 #endif
142 
145  FwIndexType portNum,
146  Fw::InputTimePort* port
147  );
148 
149 #endif
150 
151 #if !FW_DIRECT_PORT_CALLS
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Connect typed input ports to typed output ports
157  // ----------------------------------------------------------------------
158 
161  FwIndexType portNum,
163  );
164 
167  FwIndexType portNum,
169  );
170 
173  FwIndexType portNum,
175  );
176 
179  FwIndexType portNum,
181  );
182 
183 #endif
184 
185 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
186 
187  public:
188 
189  // ----------------------------------------------------------------------
190  // Connect serial input ports to special output ports
191  // ----------------------------------------------------------------------
192 
195  FwIndexType portNum,
196  Fw::InputSerializePort* port
197  );
198 
199 #if FW_ENABLE_TEXT_LOGGING == 1
200 
202  void set_logTextOut_OutputPort(
203  FwIndexType portNum,
204  Fw::InputSerializePort* port
205  );
206 
207 #endif
208 
211  FwIndexType portNum,
212  Fw::InputSerializePort* port
213  );
214 
215 #endif
216 
217 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
218 
219  public:
220 
221  // ----------------------------------------------------------------------
222  // Connect serial input ports to typed output ports
223  // ----------------------------------------------------------------------
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
243 #endif
244 
245  protected:
246 
247  // ----------------------------------------------------------------------
248  // Component construction and destruction
249  // ----------------------------------------------------------------------
250 
253  const char* compName = ""
254  );
255 
258 
259  protected:
260 
261  // ----------------------------------------------------------------------
262  // Getters for numbers of typed input ports
263  // ----------------------------------------------------------------------
264 
269  return NUM_DATAIN_INPUT_PORTS;
270  }
271 
277  }
278 
279  protected:
280 
281  // ----------------------------------------------------------------------
282  // Getters for numbers of special output ports
283  // ----------------------------------------------------------------------
284 
290  }
291 
292 #if FW_ENABLE_TEXT_LOGGING == 1
293 
297  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
299  }
300 
301 #endif
302 
308  }
309 
310  protected:
311 
312  // ----------------------------------------------------------------------
313  // Getters for numbers of typed output ports
314  // ----------------------------------------------------------------------
315 
321  }
322 
328  }
329 
335  }
336 
342  }
343 
344  protected:
345 
346  // ----------------------------------------------------------------------
347  // Connection status queries for special output ports
348  // ----------------------------------------------------------------------
349 
354  FwIndexType portNum
355  ) const;
356 
357 #if FW_ENABLE_TEXT_LOGGING == 1
358 
362  bool isConnected_logTextOut_OutputPort(
363  FwIndexType portNum
364  ) const;
365 
366 #endif
367 
372  FwIndexType portNum
373  ) const;
374 
375  protected:
376 
377  // ----------------------------------------------------------------------
378  // Connection status queries for typed output ports
379  // ----------------------------------------------------------------------
380 
385  FwIndexType portNum
386  ) const;
387 
392  FwIndexType portNum
393  ) const;
394 
399  FwIndexType portNum
400  ) const;
401 
406  FwIndexType portNum
407  ) const;
408 
409  protected:
410 
411  // ----------------------------------------------------------------------
412  // Handlers to implement for typed input ports
413  // ----------------------------------------------------------------------
414 
416  virtual void dataIn_handler(
417  FwIndexType portNum,
418  Fw::Buffer& data,
419  const ComCfg::FrameContext& context
420  ) = 0;
421 
423  virtual void dataReturnIn_handler(
424  FwIndexType portNum,
425  Fw::Buffer& data,
426  const ComCfg::FrameContext& context
427  ) = 0;
428 
429 #if FW_DIRECT_PORT_CALLS
430  public:
431 #else
432  protected:
433 #endif
434 
435  // ----------------------------------------------------------------------
436  // Port handler base-class functions for typed input ports
437  //
438  // Call these functions directly to bypass the corresponding ports
439  // ----------------------------------------------------------------------
440 
442  void dataIn_handlerBase(
443  FwIndexType portNum,
444  Fw::Buffer& data,
445  const ComCfg::FrameContext& context
446  );
447 
450  FwIndexType portNum,
451  Fw::Buffer& data,
452  const ComCfg::FrameContext& context
453  );
454 
455  protected:
456 
457  // ----------------------------------------------------------------------
458  // Invocation functions for typed output ports
459  // ----------------------------------------------------------------------
460 
463  FwIndexType portNum,
464  FwSizeType size
465  ) const;
466 
469  FwIndexType portNum,
470  Fw::Buffer& fwBuffer
471  ) const;
472 
474  void dataOut_out(
475  FwIndexType portNum,
476  Fw::Buffer& data,
477  const ComCfg::FrameContext& context
478  ) const;
479 
481  void dataReturnOut_out(
482  FwIndexType portNum,
483  Fw::Buffer& data,
484  const ComCfg::FrameContext& context
485  ) const;
486 
487  protected:
488 
489  // ----------------------------------------------------------------------
490  // Event logging functions
491  // ----------------------------------------------------------------------
492 
497 
503 
508 
509  protected:
510 
511  // ----------------------------------------------------------------------
512  // Time
513  // ----------------------------------------------------------------------
514 
518  Fw::Time getTime() const;
519 
520  protected:
521 
522  // ----------------------------------------------------------------------
523  // Mutex operations for guarded ports
524  //
525  // You can override these operations to provide more sophisticated
526  // synchronization
527  // ----------------------------------------------------------------------
528 
530  virtual void lock();
531 
533  virtual void unLock();
534 
535  private:
536 
537  // ----------------------------------------------------------------------
538  // Calls for messages received on typed input ports
539  // ----------------------------------------------------------------------
540 
542  static void m_p_dataIn_in(
543  Fw::PassiveComponentBase* callComp,
544  FwIndexType portNum,
545  Fw::Buffer& data,
546  const ComCfg::FrameContext& context
547  );
548 
550  static void m_p_dataReturnIn_in(
551  Fw::PassiveComponentBase* callComp,
552  FwIndexType portNum,
553  Fw::Buffer& data,
554  const ComCfg::FrameContext& context
555  );
556 
557  private:
558 
559  // ----------------------------------------------------------------------
560  // Invocation functions for special output ports
561  // ----------------------------------------------------------------------
562 
564  void logOut_out(
565  FwIndexType portNum,
566  FwEventIdType id,
567  Fw::Time& timeTag,
568  const Fw::LogSeverity& severity,
569  Fw::LogBuffer& args
570  ) const;
571 
572 #if FW_ENABLE_TEXT_LOGGING
573 
575  void logTextOut_out(
576  FwIndexType portNum,
577  FwEventIdType id,
578  Fw::Time& timeTag,
579  const Fw::LogSeverity& severity,
580  Fw::TextLogString& text
581  ) const;
582 
583 #endif
584 
586  void timeCaller_out(
587  FwIndexType portNum,
588  Fw::Time& time
589  ) const;
590 
591 #if !FW_DIRECT_PORT_CALLS
592 
593  private:
594 
595  // ----------------------------------------------------------------------
596  // Typed input ports
597  // ----------------------------------------------------------------------
598 
601 
604 
605 #endif
606 
607 #if !FW_DIRECT_PORT_CALLS
608 
609  private:
610 
611  // ----------------------------------------------------------------------
612  // Special output ports
613  // ----------------------------------------------------------------------
614 
616  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
617 
618 #if FW_ENABLE_TEXT_LOGGING == 1
619 
621  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
622 
623 #endif
624 
626  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
627 
628 #endif
629 
630 #if !FW_DIRECT_PORT_CALLS
631 
632  private:
633 
634  // ----------------------------------------------------------------------
635  // Typed output ports
636  // ----------------------------------------------------------------------
637 
639  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
640 
642  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
643 
646 
649 
650 #endif
651 
652  private:
653 
654  // ----------------------------------------------------------------------
655  // Mutexes
656  // ----------------------------------------------------------------------
657 
659  Os::Mutex m_guardedPortMutex;
660 
661  };
662 
663 }
664 
665 #endif
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum) const
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
virtual void unLock()
Unlock the guarded mutex.
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
PlatformSizeType FwSizeType
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
I32 FwEnumStoreType
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
static constexpr FwIndexType getNum_dataIn_InputPorts()
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum) const
void init()
Object initializer.
Definition: ObjBase.cpp:24
friend class FrameAccumulatorTester
Friend class tester implementation to support white-box testing.
static constexpr FwIndexType getNum_bufferDeallocate_OutputPorts()
FwIdType FwEventIdType
The type of an event identifier.
static constexpr FwIndexType getNum_bufferAllocate_OutputPorts()
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
static constexpr FwIndexType getNum_dataOut_OutputPorts()
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
A frame was detected but dropped because there was no buffer to hold it.
Enum representing event severity.
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferDeallocate.
static constexpr FwIndexType getNum_logOut_OutputPorts()
virtual void lock()
Lock the guarded mutex.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void log_WARNING_HI_FrameDetectionSizeError(FwSizeType size_out) const
PlatformIndexType FwIndexType
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
Fw::Buffer bufferAllocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port bufferAllocate.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
Type used to pass context info between components during framing/deframing.
Auto-generated base for FrameAccumulator component.
RateGroupDivider component implementation.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
FrameAccumulatorComponentBase(const char *compName="")
Construct FrameAccumulatorComponentBase object.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
friend class FrameAccumulatorTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
virtual ~FrameAccumulatorComponentBase()
Destroy FrameAccumulatorComponentBase object.
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()