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 #if FW_ENABLE_TEXT_LOGGING == 1
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #endif
21 #if !FW_DIRECT_PORT_CALLS
23 #endif
24 #if !FW_DIRECT_PORT_CALLS
26 #endif
27 #include "Fw/Time/TimePortAc.hpp"
28 #include "Os/Mutex.hpp"
31 
32 namespace Svc {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
49  friend class FrameAccumulatorTester;
50 
51  protected:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
61  };
62 
64  enum {
68  };
69 
71  enum {
76  };
77 
79  enum {
84  };
85 
86  public:
87 
88  // ----------------------------------------------------------------------
89  // Component initialization
90  // ----------------------------------------------------------------------
91 
93  void init(
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 
116  FwIndexType portNum
117  );
118 
119 #endif
120 
121 #if !FW_DIRECT_PORT_CALLS
122 
123  public:
124 
125  // ----------------------------------------------------------------------
126  // Connect input ports to special output ports
127  // ----------------------------------------------------------------------
128 
131  FwIndexType portNum,
132  Fw::InputLogPort* port
133  );
134 
135 #if FW_ENABLE_TEXT_LOGGING == 1
136 
138  void set_logTextOut_OutputPort(
139  FwIndexType portNum,
140  Fw::InputLogTextPort* port
141  );
142 
143 #endif
144 
147  FwIndexType portNum,
148  Fw::InputTimePort* port
149  );
150 
151 #endif
152 
153 #if !FW_DIRECT_PORT_CALLS
154 
155  public:
156 
157  // ----------------------------------------------------------------------
158  // Connect typed input ports to typed output ports
159  // ----------------------------------------------------------------------
160 
163  FwIndexType portNum,
165  );
166 
169  FwIndexType portNum,
171  );
172 
175  FwIndexType portNum,
177  );
178 
181  FwIndexType portNum,
183  );
184 
185 #endif
186 
187 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
188 
189  public:
190 
191  // ----------------------------------------------------------------------
192  // Connect serial input ports to special output ports
193  // ----------------------------------------------------------------------
194 
197  FwIndexType portNum,
198  Fw::InputSerializePort* port
199  );
200 
201 #if FW_ENABLE_TEXT_LOGGING == 1
202 
204  void set_logTextOut_OutputPort(
205  FwIndexType portNum,
206  Fw::InputSerializePort* port
207  );
208 
209 #endif
210 
213  FwIndexType portNum,
214  Fw::InputSerializePort* port
215  );
216 
217 #endif
218 
219 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
220 
221  public:
222 
223  // ----------------------------------------------------------------------
224  // Connect serial input ports to typed output ports
225  // ----------------------------------------------------------------------
226 
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
235  FwIndexType portNum,
236  Fw::InputSerializePort* port
237  );
238 
241  FwIndexType portNum,
242  Fw::InputSerializePort* port
243  );
244 
245 #endif
246 
247  protected:
248 
249  // ----------------------------------------------------------------------
250  // Component construction and destruction
251  // ----------------------------------------------------------------------
252 
255  const char* compName = ""
256  );
257 
260 
261  protected:
262 
263  // ----------------------------------------------------------------------
264  // Getters for numbers of typed input ports
265  // ----------------------------------------------------------------------
266 
271  return NUM_DATAIN_INPUT_PORTS;
272  }
273 
279  }
280 
281  protected:
282 
283  // ----------------------------------------------------------------------
284  // Getters for numbers of special output ports
285  // ----------------------------------------------------------------------
286 
292  }
293 
294 #if FW_ENABLE_TEXT_LOGGING == 1
295 
299  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
301  }
302 
303 #endif
304 
310  }
311 
312  protected:
313 
314  // ----------------------------------------------------------------------
315  // Getters for numbers of typed output ports
316  // ----------------------------------------------------------------------
317 
323  }
324 
330  }
331 
337  }
338 
344  }
345 
346  protected:
347 
348  // ----------------------------------------------------------------------
349  // Connection status queries for special output ports
350  // ----------------------------------------------------------------------
351 
356  FwIndexType portNum
357  ) const;
358 
359 #if FW_ENABLE_TEXT_LOGGING == 1
360 
364  bool isConnected_logTextOut_OutputPort(
365  FwIndexType portNum
366  ) const;
367 
368 #endif
369 
374  FwIndexType portNum
375  ) const;
376 
377  protected:
378 
379  // ----------------------------------------------------------------------
380  // Connection status queries for typed output ports
381  // ----------------------------------------------------------------------
382 
387  FwIndexType portNum
388  ) const;
389 
394  FwIndexType portNum
395  ) const;
396 
401  FwIndexType portNum
402  ) const;
403 
408  FwIndexType portNum
409  ) const;
410 
411  protected:
412 
413  // ----------------------------------------------------------------------
414  // Handlers to implement for typed input ports
415  // ----------------------------------------------------------------------
416 
418  virtual void dataIn_handler(
419  FwIndexType portNum,
420  Fw::Buffer& data,
421  const ComCfg::FrameContext& context
422  ) = 0;
423 
425  virtual void dataReturnIn_handler(
426  FwIndexType portNum,
427  Fw::Buffer& data,
428  const ComCfg::FrameContext& context
429  ) = 0;
430 
431 #if FW_DIRECT_PORT_CALLS
432  public:
433 #else
434  protected:
435 #endif
436 
437  // ----------------------------------------------------------------------
438  // Port handler base-class functions for typed input ports
439  //
440  // Call these functions directly to bypass the corresponding ports
441  // ----------------------------------------------------------------------
442 
444  void dataIn_handlerBase(
445  FwIndexType portNum,
446  Fw::Buffer& data,
447  const ComCfg::FrameContext& context
448  );
449 
452  FwIndexType portNum,
453  Fw::Buffer& data,
454  const ComCfg::FrameContext& context
455  );
456 
457  protected:
458 
459  // ----------------------------------------------------------------------
460  // Invocation functions for typed output ports
461  // ----------------------------------------------------------------------
462 
465  FwIndexType portNum,
466  FwSizeType size
467  ) const;
468 
471  FwIndexType portNum,
472  Fw::Buffer& fwBuffer
473  ) const;
474 
476  void dataOut_out(
477  FwIndexType portNum,
478  Fw::Buffer& data,
479  const ComCfg::FrameContext& context
480  ) const;
481 
483  void dataReturnOut_out(
484  FwIndexType portNum,
485  Fw::Buffer& data,
486  const ComCfg::FrameContext& context
487  ) const;
488 
489  protected:
490 
491  // ----------------------------------------------------------------------
492  // Event logging functions
493  // ----------------------------------------------------------------------
494 
499 
505 
510 
511  protected:
512 
513  // ----------------------------------------------------------------------
514  // Time
515  // ----------------------------------------------------------------------
516 
520  Fw::Time getTime() const;
521 
522  protected:
523 
524  // ----------------------------------------------------------------------
525  // Mutex operations for guarded ports
526  //
527  // You can override these operations to provide more sophisticated
528  // synchronization
529  // ----------------------------------------------------------------------
530 
532  virtual void lock();
533 
535  virtual void unLock();
536 
537  private:
538 
539  // ----------------------------------------------------------------------
540  // Calls for messages received on typed input ports
541  // ----------------------------------------------------------------------
542 
544  static void m_p_dataIn_in(
545  Fw::PassiveComponentBase* callComp,
546  FwIndexType portNum,
547  Fw::Buffer& data,
548  const ComCfg::FrameContext& context
549  );
550 
552  static void m_p_dataReturnIn_in(
553  Fw::PassiveComponentBase* callComp,
554  FwIndexType portNum,
555  Fw::Buffer& data,
556  const ComCfg::FrameContext& context
557  );
558 
559  private:
560 
561  // ----------------------------------------------------------------------
562  // Invocation functions for special output ports
563  // ----------------------------------------------------------------------
564 
566  void logOut_out(
567  FwIndexType portNum,
568  FwEventIdType id,
569  Fw::Time& timeTag,
570  const Fw::LogSeverity& severity,
571  Fw::LogBuffer& args
572  ) const;
573 
574 #if FW_ENABLE_TEXT_LOGGING
575 
577  void logTextOut_out(
578  FwIndexType portNum,
579  FwEventIdType id,
580  Fw::Time& timeTag,
581  const Fw::LogSeverity& severity,
582  Fw::TextLogString& text
583  ) const;
584 
585 #endif
586 
588  void timeCaller_out(
589  FwIndexType portNum,
590  Fw::Time& time
591  ) const;
592 
593 #if !FW_DIRECT_PORT_CALLS
594 
595  private:
596 
597  // ----------------------------------------------------------------------
598  // Typed input ports
599  // ----------------------------------------------------------------------
600 
603 
606 
607 #endif
608 
609 #if !FW_DIRECT_PORT_CALLS
610 
611  private:
612 
613  // ----------------------------------------------------------------------
614  // Special output ports
615  // ----------------------------------------------------------------------
616 
618  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
619 
620 #if FW_ENABLE_TEXT_LOGGING == 1
621 
623  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
624 
625 #endif
626 
628  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
629 
630 #endif
631 
632 #if !FW_DIRECT_PORT_CALLS
633 
634  private:
635 
636  // ----------------------------------------------------------------------
637  // Typed output ports
638  // ----------------------------------------------------------------------
639 
641  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
642 
644  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
645 
648 
651 
652 #endif
653 
654  private:
655 
656  // ----------------------------------------------------------------------
657  // Mutexes
658  // ----------------------------------------------------------------------
659 
661  Os::Mutex m_guardedPortMutex;
662 
663  };
664 
665 }
666 
667 #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.
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()
A frame was detected but dropped because there was no buffer to hold it.