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"
26 
27 namespace Svc {
28 
35  {
36 
37  // ----------------------------------------------------------------------
38  // Friend classes
39  // ----------------------------------------------------------------------
40 
44  friend class FrameAccumulatorTester;
45 
46  PROTECTED:
47 
48  // ----------------------------------------------------------------------
49  // Constants
50  // ----------------------------------------------------------------------
51 
53  enum {
56  };
57 
59  enum {
63  };
64 
66  enum {
71  };
72 
74  enum {
76  };
77 
78  public:
79 
80  // ----------------------------------------------------------------------
81  // Component initialization
82  // ----------------------------------------------------------------------
83 
85  void init(
86  FwEnumStoreType instance = 0
87  );
88 
89  public:
90 
91  // ----------------------------------------------------------------------
92  // Getters for typed input ports
93  // ----------------------------------------------------------------------
94 
99  FwIndexType portNum
100  );
101 
106  FwIndexType portNum
107  );
108 
109  public:
110 
111  // ----------------------------------------------------------------------
112  // Connect input ports to special output ports
113  // ----------------------------------------------------------------------
114 
117  FwIndexType portNum,
118  Fw::InputLogPort* port
119  );
120 
121 #if FW_ENABLE_TEXT_LOGGING == 1
122 
124  void set_logTextOut_OutputPort(
125  FwIndexType portNum,
126  Fw::InputLogTextPort* port
127  );
128 
129 #endif
130 
133  FwIndexType portNum,
134  Fw::InputTimePort* port
135  );
136 
137  public:
138 
139  // ----------------------------------------------------------------------
140  // Connect typed input ports to typed output ports
141  // ----------------------------------------------------------------------
142 
145  FwIndexType portNum,
147  );
148 
151  FwIndexType portNum,
153  );
154 
157  FwIndexType portNum,
159  );
160 
163  FwIndexType portNum,
165  );
166 
167 #if FW_PORT_SERIALIZATION
168 
169  public:
170 
171  // ----------------------------------------------------------------------
172  // Connect serial input ports to special output ports
173  // ----------------------------------------------------------------------
174 
177  FwIndexType portNum,
178  Fw::InputSerializePort* port
179  );
180 
181 #if FW_ENABLE_TEXT_LOGGING == 1
182 
184  void set_logTextOut_OutputPort(
185  FwIndexType portNum,
186  Fw::InputSerializePort* port
187  );
188 
189 #endif
190 
193  FwIndexType portNum,
194  Fw::InputSerializePort* port
195  );
196 
197 #endif
198 
199 #if FW_PORT_SERIALIZATION
200 
201  public:
202 
203  // ----------------------------------------------------------------------
204  // Connect serial input ports to typed output ports
205  // ----------------------------------------------------------------------
206 
209  FwIndexType portNum,
210  Fw::InputSerializePort* port
211  );
212 
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
225 #endif
226 
227  PROTECTED:
228 
229  // ----------------------------------------------------------------------
230  // Component construction and destruction
231  // ----------------------------------------------------------------------
232 
235  const char* compName = ""
236  );
237 
240 
241  PROTECTED:
242 
243  // ----------------------------------------------------------------------
244  // Getters for numbers of typed input ports
245  // ----------------------------------------------------------------------
246 
251 
256 
257  PROTECTED:
258 
259  // ----------------------------------------------------------------------
260  // Getters for numbers of special output ports
261  // ----------------------------------------------------------------------
262 
267 
268 #if FW_ENABLE_TEXT_LOGGING == 1
269 
273  FwIndexType getNum_logTextOut_OutputPorts() const;
274 
275 #endif
276 
281 
282  PROTECTED:
283 
284  // ----------------------------------------------------------------------
285  // Getters for numbers of typed output ports
286  // ----------------------------------------------------------------------
287 
292 
297 
302 
307 
308  PROTECTED:
309 
310  // ----------------------------------------------------------------------
311  // Connection status queries for special output ports
312  // ----------------------------------------------------------------------
313 
318  FwIndexType portNum
319  );
320 
321 #if FW_ENABLE_TEXT_LOGGING == 1
322 
326  bool isConnected_logTextOut_OutputPort(
327  FwIndexType portNum
328  );
329 
330 #endif
331 
336  FwIndexType portNum
337  );
338 
339  PROTECTED:
340 
341  // ----------------------------------------------------------------------
342  // Connection status queries for typed output ports
343  // ----------------------------------------------------------------------
344 
349  FwIndexType portNum
350  );
351 
356  FwIndexType portNum
357  );
358 
363  FwIndexType portNum
364  );
365 
370  FwIndexType portNum
371  );
372 
373  PROTECTED:
374 
375  // ----------------------------------------------------------------------
376  // Handlers to implement for typed input ports
377  // ----------------------------------------------------------------------
378 
380  virtual void dataIn_handler(
381  FwIndexType portNum,
382  Fw::Buffer& data,
383  const ComCfg::FrameContext& context
384  ) = 0;
385 
387  virtual void dataReturnIn_handler(
388  FwIndexType portNum,
389  Fw::Buffer& data,
390  const ComCfg::FrameContext& context
391  ) = 0;
392 
393  PROTECTED:
394 
395  // ----------------------------------------------------------------------
396  // Port handler base-class functions for typed input ports
397  //
398  // Call these functions directly to bypass the corresponding ports
399  // ----------------------------------------------------------------------
400 
402  void dataIn_handlerBase(
403  FwIndexType portNum,
404  Fw::Buffer& data,
405  const ComCfg::FrameContext& context
406  );
407 
410  FwIndexType portNum,
411  Fw::Buffer& data,
412  const ComCfg::FrameContext& context
413  );
414 
415  PROTECTED:
416 
417  // ----------------------------------------------------------------------
418  // Invocation functions for typed output ports
419  // ----------------------------------------------------------------------
420 
423  FwIndexType portNum,
424  U32 size
425  );
426 
429  FwIndexType portNum,
430  Fw::Buffer& fwBuffer
431  );
432 
434  void dataOut_out(
435  FwIndexType portNum,
436  Fw::Buffer& data,
437  const ComCfg::FrameContext& context
438  );
439 
441  void dataReturnOut_out(
442  FwIndexType portNum,
443  Fw::Buffer& data,
444  const ComCfg::FrameContext& context
445  );
446 
447  PROTECTED:
448 
449  // ----------------------------------------------------------------------
450  // Event logging functions
451  // ----------------------------------------------------------------------
452 
457 
458  PROTECTED:
459 
460  // ----------------------------------------------------------------------
461  // Time
462  // ----------------------------------------------------------------------
463 
467  Fw::Time getTime() const;
468 
469  PROTECTED:
470 
471  // ----------------------------------------------------------------------
472  // Mutex operations for guarded ports
473  //
474  // You can override these operations to provide more sophisticated
475  // synchronization
476  // ----------------------------------------------------------------------
477 
479  virtual void lock();
480 
482  virtual void unLock();
483 
484  PRIVATE:
485 
486  // ----------------------------------------------------------------------
487  // Calls for messages received on typed input ports
488  // ----------------------------------------------------------------------
489 
491  static void m_p_dataIn_in(
492  Fw::PassiveComponentBase* callComp,
493  FwIndexType portNum,
494  Fw::Buffer& data,
495  const ComCfg::FrameContext& context
496  );
497 
499  static void m_p_dataReturnIn_in(
500  Fw::PassiveComponentBase* callComp,
501  FwIndexType portNum,
502  Fw::Buffer& data,
503  const ComCfg::FrameContext& context
504  );
505 
506  PRIVATE:
507 
508  // ----------------------------------------------------------------------
509  // Typed input ports
510  // ----------------------------------------------------------------------
511 
514 
517 
518  PRIVATE:
519 
520  // ----------------------------------------------------------------------
521  // Special output ports
522  // ----------------------------------------------------------------------
523 
525  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
526 
527 #if FW_ENABLE_TEXT_LOGGING == 1
528 
530  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
531 
532 #endif
533 
535  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
536 
537  PRIVATE:
538 
539  // ----------------------------------------------------------------------
540  // Typed output ports
541  // ----------------------------------------------------------------------
542 
544  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
545 
547  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
548 
551 
554 
555  PRIVATE:
556 
557  // ----------------------------------------------------------------------
558  // Mutexes
559  // ----------------------------------------------------------------------
560 
562  Os::Mutex m_guardedPortMutex;
563 
564  };
565 
566 }
567 
568 #endif
virtual void unLock()
Unlock the guarded mutex.
Definition: Time.hpp:9
Fw::Buffer bufferAllocate_out(FwIndexType portNum, U32 size)
Invoke output port bufferAllocate.
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum)
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].
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:26
friend class FrameAccumulatorTester
Friend class tester implementation to support white-box testing.
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.
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.
virtual void lock()
Lock the guarded mutex.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
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.
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum)