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
23 #include "Fw/Time/TimePortAc.hpp"
24 #include "Os/Mutex.hpp"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
45  friend class FrameAccumulatorTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
57  };
58 
60  enum {
64  };
65 
67  enum {
72  };
73 
75  enum {
78  };
80 
81  public:
82 
83  // ----------------------------------------------------------------------
84  // Component initialization
85  // ----------------------------------------------------------------------
86 
88  void init(
89  FwEnumStoreType instance = 0
90  );
91 
92  public:
93 
94  // ----------------------------------------------------------------------
95  // Getters for typed input ports
96  // ----------------------------------------------------------------------
97 
102  FwIndexType portNum
103  );
104 
109  FwIndexType portNum
110  );
111 
112  public:
113 
114  // ----------------------------------------------------------------------
115  // Connect input ports to special output ports
116  // ----------------------------------------------------------------------
117 
120  FwIndexType portNum,
121  Fw::InputLogPort* port
122  );
123 
124 #if FW_ENABLE_TEXT_LOGGING == 1
125 
127  void set_logTextOut_OutputPort(
128  FwIndexType portNum,
129  Fw::InputLogTextPort* port
130  );
131 
132 #endif
133 
136  FwIndexType portNum,
137  Fw::InputTimePort* port
138  );
139 
140  public:
141 
142  // ----------------------------------------------------------------------
143  // Connect typed input ports to typed output ports
144  // ----------------------------------------------------------------------
145 
148  FwIndexType portNum,
150  );
151 
154  FwIndexType portNum,
156  );
157 
160  FwIndexType portNum,
162  );
163 
166  FwIndexType portNum,
168  );
169 
170 #if FW_PORT_SERIALIZATION
171 
172  public:
173 
174  // ----------------------------------------------------------------------
175  // Connect serial input ports to special output ports
176  // ----------------------------------------------------------------------
177 
180  FwIndexType portNum,
181  Fw::InputSerializePort* port
182  );
183 
184 #if FW_ENABLE_TEXT_LOGGING == 1
185 
187  void set_logTextOut_OutputPort(
188  FwIndexType portNum,
189  Fw::InputSerializePort* port
190  );
191 
192 #endif
193 
196  FwIndexType portNum,
197  Fw::InputSerializePort* port
198  );
199 
200 #endif
201 
202 #if FW_PORT_SERIALIZATION
203 
204  public:
205 
206  // ----------------------------------------------------------------------
207  // Connect serial input ports to typed output ports
208  // ----------------------------------------------------------------------
209 
212  FwIndexType portNum,
213  Fw::InputSerializePort* port
214  );
215 
218  FwIndexType portNum,
219  Fw::InputSerializePort* port
220  );
221 
224  FwIndexType portNum,
225  Fw::InputSerializePort* port
226  );
227 
228 #endif
229 
230  protected:
231 
232  // ----------------------------------------------------------------------
233  // Component construction and destruction
234  // ----------------------------------------------------------------------
235 
238  const char* compName = ""
239  );
240 
243 
244  protected:
245 
246  // ----------------------------------------------------------------------
247  // Getters for numbers of typed input ports
248  // ----------------------------------------------------------------------
249 
254  return NUM_DATAIN_INPUT_PORTS;
255  }
256 
262  }
263 
264  protected:
265 
266  // ----------------------------------------------------------------------
267  // Getters for numbers of special output ports
268  // ----------------------------------------------------------------------
269 
275  }
276 
277 #if FW_ENABLE_TEXT_LOGGING == 1
278 
282  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
284  }
285 
286 #endif
287 
293  }
294 
295  protected:
296 
297  // ----------------------------------------------------------------------
298  // Getters for numbers of typed output ports
299  // ----------------------------------------------------------------------
300 
306  }
307 
313  }
314 
320  }
321 
327  }
328 
329  protected:
330 
331  // ----------------------------------------------------------------------
332  // Connection status queries for special output ports
333  // ----------------------------------------------------------------------
334 
339  FwIndexType portNum
340  );
341 
342 #if FW_ENABLE_TEXT_LOGGING == 1
343 
347  bool isConnected_logTextOut_OutputPort(
348  FwIndexType portNum
349  );
350 
351 #endif
352 
357  FwIndexType portNum
358  );
359 
360  protected:
361 
362  // ----------------------------------------------------------------------
363  // Connection status queries for typed output ports
364  // ----------------------------------------------------------------------
365 
370  FwIndexType portNum
371  );
372 
377  FwIndexType portNum
378  );
379 
384  FwIndexType portNum
385  );
386 
391  FwIndexType portNum
392  );
393 
394  protected:
395 
396  // ----------------------------------------------------------------------
397  // Handlers to implement for typed input ports
398  // ----------------------------------------------------------------------
399 
401  virtual void dataIn_handler(
402  FwIndexType portNum,
403  Fw::Buffer& data,
404  const ComCfg::FrameContext& context
405  ) = 0;
406 
408  virtual void dataReturnIn_handler(
409  FwIndexType portNum,
410  Fw::Buffer& data,
411  const ComCfg::FrameContext& context
412  ) = 0;
413 
414  protected:
415 
416  // ----------------------------------------------------------------------
417  // Port handler base-class functions for typed input ports
418  //
419  // Call these functions directly to bypass the corresponding ports
420  // ----------------------------------------------------------------------
421 
423  void dataIn_handlerBase(
424  FwIndexType portNum,
425  Fw::Buffer& data,
426  const ComCfg::FrameContext& context
427  );
428 
431  FwIndexType portNum,
432  Fw::Buffer& data,
433  const ComCfg::FrameContext& context
434  );
435 
436  protected:
437 
438  // ----------------------------------------------------------------------
439  // Invocation functions for typed output ports
440  // ----------------------------------------------------------------------
441 
444  FwIndexType portNum,
445  FwSizeType size
446  );
447 
450  FwIndexType portNum,
451  Fw::Buffer& fwBuffer
452  );
453 
455  void dataOut_out(
456  FwIndexType portNum,
457  Fw::Buffer& data,
458  const ComCfg::FrameContext& context
459  );
460 
462  void dataReturnOut_out(
463  FwIndexType portNum,
464  Fw::Buffer& data,
465  const ComCfg::FrameContext& context
466  );
467 
468  protected:
469 
470  // ----------------------------------------------------------------------
471  // Event logging functions
472  // ----------------------------------------------------------------------
473 
478 
484 
485  protected:
486 
487  // ----------------------------------------------------------------------
488  // Time
489  // ----------------------------------------------------------------------
490 
494  Fw::Time getTime() const;
495 
496  protected:
497 
498  // ----------------------------------------------------------------------
499  // Mutex operations for guarded ports
500  //
501  // You can override these operations to provide more sophisticated
502  // synchronization
503  // ----------------------------------------------------------------------
504 
506  virtual void lock();
507 
509  virtual void unLock();
510 
511  private:
512 
513  // ----------------------------------------------------------------------
514  // Calls for messages received on typed input ports
515  // ----------------------------------------------------------------------
516 
518  static void m_p_dataIn_in(
519  Fw::PassiveComponentBase* callComp,
520  FwIndexType portNum,
521  Fw::Buffer& data,
522  const ComCfg::FrameContext& context
523  );
524 
526  static void m_p_dataReturnIn_in(
527  Fw::PassiveComponentBase* callComp,
528  FwIndexType portNum,
529  Fw::Buffer& data,
530  const ComCfg::FrameContext& context
531  );
532 
533  private:
534 
535  // ----------------------------------------------------------------------
536  // Typed input ports
537  // ----------------------------------------------------------------------
538 
541 
544 
545  private:
546 
547  // ----------------------------------------------------------------------
548  // Special output ports
549  // ----------------------------------------------------------------------
550 
552  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
553 
554 #if FW_ENABLE_TEXT_LOGGING == 1
555 
557  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
558 
559 #endif
560 
562  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
563 
564  private:
565 
566  // ----------------------------------------------------------------------
567  // Typed output ports
568  // ----------------------------------------------------------------------
569 
571  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
572 
574  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
575 
578 
581 
582  private:
583 
584  // ----------------------------------------------------------------------
585  // Mutexes
586  // ----------------------------------------------------------------------
587 
589  Os::Mutex m_guardedPortMutex;
590 
591  };
592 
593 }
594 
595 #endif
virtual void unLock()
Unlock the guarded mutex.
Fw::Buffer bufferAllocate_out(FwIndexType portNum, FwSizeType size)
Invoke output port bufferAllocate.
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum)
PlatformSizeType FwSizeType
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
I32 FwEnumStoreType
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
static constexpr FwIndexType getNum_dataIn_InputPorts()
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
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()
static constexpr FwIndexType getNum_bufferAllocate_OutputPorts()
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
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.
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
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
bool isConnected_logOut_OutputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
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)
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
friend class FrameAccumulatorTesterBase
Friend class tester to support autocoded test harness.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
virtual ~FrameAccumulatorComponentBase()
Destroy FrameAccumulatorComponentBase object.
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum)