F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
BufferRepeaterComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title BufferRepeaterComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for BufferRepeater component base class
5 // ======================================================================
6 
7 #ifndef Svc_BufferRepeaterComponentAc_HPP
8 #define Svc_BufferRepeaterComponentAc_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"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
45  friend class BufferRepeaterTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
56  };
57 
59  enum {
63  };
64 
66  enum {
70  };
71 
73  enum {
76  };
77 
78  public:
79 
80  // ----------------------------------------------------------------------
81  // Component initialization
82  // ----------------------------------------------------------------------
83 
85  void init(
86  FwEnumStoreType instance = 0
87  );
88 
89 #if !FW_DIRECT_PORT_CALLS
90 
91  public:
92 
93  // ----------------------------------------------------------------------
94  // Getters for typed input ports
95  // ----------------------------------------------------------------------
96 
101  FwIndexType portNum
102  );
103 
104 #endif
105 
106 #if !FW_DIRECT_PORT_CALLS
107 
108  public:
109 
110  // ----------------------------------------------------------------------
111  // Connect input ports to special output ports
112  // ----------------------------------------------------------------------
113 
115  void set_Log_OutputPort(
116  FwIndexType portNum,
117  Fw::InputLogPort* port
118  );
119 
120 #if FW_ENABLE_TEXT_LOGGING == 1
121 
123  void set_LogText_OutputPort(
124  FwIndexType portNum,
125  Fw::InputLogTextPort* port
126  );
127 
128 #endif
129 
131  void set_Time_OutputPort(
132  FwIndexType portNum,
133  Fw::InputTimePort* port
134  );
135 
136 #endif
137 
138 #if !FW_DIRECT_PORT_CALLS
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 
164 #endif
165 
166 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
167 
168  public:
169 
170  // ----------------------------------------------------------------------
171  // Connect serial input ports to special output ports
172  // ----------------------------------------------------------------------
173 
175  void set_Log_OutputPort(
176  FwIndexType portNum,
177  Fw::InputSerializePort* port
178  );
179 
180 #if FW_ENABLE_TEXT_LOGGING == 1
181 
183  void set_LogText_OutputPort(
184  FwIndexType portNum,
185  Fw::InputSerializePort* port
186  );
187 
188 #endif
189 
191  void set_Time_OutputPort(
192  FwIndexType portNum,
193  Fw::InputSerializePort* port
194  );
195 
196 #endif
197 
198 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
199 
200  public:
201 
202  // ----------------------------------------------------------------------
203  // Connect serial input ports to typed output ports
204  // ----------------------------------------------------------------------
205 
208  FwIndexType portNum,
209  Fw::InputSerializePort* port
210  );
211 
214  FwIndexType portNum,
215  Fw::InputSerializePort* port
216  );
217 
218 #endif
219 
220  protected:
221 
222  // ----------------------------------------------------------------------
223  // Component construction and destruction
224  // ----------------------------------------------------------------------
225 
228  const char* compName = ""
229  );
230 
233 
234  protected:
235 
236  // ----------------------------------------------------------------------
237  // Getters for numbers of typed input ports
238  // ----------------------------------------------------------------------
239 
244  return NUM_PORTIN_INPUT_PORTS;
245  }
246 
247  protected:
248 
249  // ----------------------------------------------------------------------
250  // Getters for numbers of special output ports
251  // ----------------------------------------------------------------------
252 
256  static constexpr FwIndexType getNum_Log_OutputPorts() {
257  return NUM_LOG_OUTPUT_PORTS;
258  }
259 
260 #if FW_ENABLE_TEXT_LOGGING == 1
261 
265  static constexpr FwIndexType getNum_LogText_OutputPorts() {
267  }
268 
269 #endif
270 
275  return NUM_TIME_OUTPUT_PORTS;
276  }
277 
278  protected:
279 
280  // ----------------------------------------------------------------------
281  // Getters for numbers of typed output ports
282  // ----------------------------------------------------------------------
283 
289  }
290 
296  }
297 
303  }
304 
305  protected:
306 
307  // ----------------------------------------------------------------------
308  // Connection status queries for special output ports
309  // ----------------------------------------------------------------------
310 
315  FwIndexType portNum
316  ) const;
317 
318 #if FW_ENABLE_TEXT_LOGGING == 1
319 
323  bool isConnected_LogText_OutputPort(
324  FwIndexType portNum
325  ) const;
326 
327 #endif
328 
333  FwIndexType portNum
334  ) const;
335 
336  protected:
337 
338  // ----------------------------------------------------------------------
339  // Connection status queries for typed output ports
340  // ----------------------------------------------------------------------
341 
346  FwIndexType portNum
347  ) const;
348 
353  FwIndexType portNum
354  ) const;
355 
360  FwIndexType portNum
361  ) const;
362 
363  protected:
364 
365  // ----------------------------------------------------------------------
366  // Handlers to implement for typed input ports
367  // ----------------------------------------------------------------------
368 
370  virtual void portIn_handler(
371  FwIndexType portNum,
372  Fw::Buffer& fwBuffer
373  ) = 0;
374 
375 #if FW_DIRECT_PORT_CALLS
376  public:
377 #else
378  protected:
379 #endif
380 
381  // ----------------------------------------------------------------------
382  // Port handler base-class functions for typed input ports
383  //
384  // Call these functions directly to bypass the corresponding ports
385  // ----------------------------------------------------------------------
386 
388  void portIn_handlerBase(
389  FwIndexType portNum,
390  Fw::Buffer& fwBuffer
391  );
392 
393  protected:
394 
395  // ----------------------------------------------------------------------
396  // Invocation functions for typed output ports
397  // ----------------------------------------------------------------------
398 
401  FwIndexType portNum,
402  FwSizeType size
403  ) const;
404 
406  void deallocate_out(
407  FwIndexType portNum,
408  Fw::Buffer& fwBuffer
409  ) const;
410 
412  void portOut_out(
413  FwIndexType portNum,
414  Fw::Buffer& fwBuffer
415  ) const;
416 
417  protected:
418 
419  // ----------------------------------------------------------------------
420  // Event logging functions
421  // ----------------------------------------------------------------------
422 
427  I32 port,
428  FwSizeType size
429  ) const;
430 
435  I32 port,
436  FwSizeType size
437  ) const;
438 
439  protected:
440 
441  // ----------------------------------------------------------------------
442  // Time
443  // ----------------------------------------------------------------------
444 
448  Fw::Time getTime() const;
449 
450  private:
451 
452  // ----------------------------------------------------------------------
453  // Calls for messages received on typed input ports
454  // ----------------------------------------------------------------------
455 
457  static void m_p_portIn_in(
458  Fw::PassiveComponentBase* callComp,
459  FwIndexType portNum,
460  Fw::Buffer& fwBuffer
461  );
462 
463  private:
464 
465  // ----------------------------------------------------------------------
466  // Invocation functions for special output ports
467  // ----------------------------------------------------------------------
468 
470  void Log_out(
471  FwIndexType portNum,
472  FwEventIdType id,
473  Fw::Time& timeTag,
474  const Fw::LogSeverity& severity,
475  Fw::LogBuffer& args
476  ) const;
477 
478 #if FW_ENABLE_TEXT_LOGGING
479 
481  void LogText_out(
482  FwIndexType portNum,
483  FwEventIdType id,
484  Fw::Time& timeTag,
485  const Fw::LogSeverity& severity,
486  Fw::TextLogString& text
487  ) const;
488 
489 #endif
490 
492  void Time_out(
493  FwIndexType portNum,
494  Fw::Time& time
495  ) const;
496 
497 #if !FW_DIRECT_PORT_CALLS
498 
499  private:
500 
501  // ----------------------------------------------------------------------
502  // Typed input ports
503  // ----------------------------------------------------------------------
504 
507 
508 #endif
509 
510 #if !FW_DIRECT_PORT_CALLS
511 
512  private:
513 
514  // ----------------------------------------------------------------------
515  // Special output ports
516  // ----------------------------------------------------------------------
517 
519  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
520 
521 #if FW_ENABLE_TEXT_LOGGING == 1
522 
524  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
525 
526 #endif
527 
529  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
530 
531 #endif
532 
533 #if !FW_DIRECT_PORT_CALLS
534 
535  private:
536 
537  // ----------------------------------------------------------------------
538  // Typed output ports
539  // ----------------------------------------------------------------------
540 
542  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
543 
545  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
546 
549 
550 #endif
551 
552  };
553 
554 }
555 
556 #endif
bool isConnected_portOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_portIn_InputPorts()
PlatformSizeType FwSizeType
I32 FwEnumStoreType
bool isConnected_Time_OutputPort(FwIndexType portNum) const
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void log_WARNING_HI_AllocationSoftFailure(I32 port, FwSizeType size) const
static constexpr FwIndexType getNum_portOut_OutputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
void portOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port portOut.
friend class BufferRepeaterTester
Friend class tester implementation to support white-box testing.
static constexpr FwIndexType getNum_allocate_OutputPorts()
FwIdType FwEventIdType
The type of an event identifier.
BufferRepeaterComponentBase(const char *compName="")
Construct BufferRepeaterComponentBase object.
virtual void portIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port portIn.
bool isConnected_Log_OutputPort(FwIndexType portNum) const
void set_portOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to portOut[portNum].
static constexpr FwIndexType getNum_Time_OutputPorts()
static constexpr FwIndexType getNum_deallocate_OutputPorts()
Fw::InputBufferSendPort * get_portIn_InputPort(FwIndexType portNum)
Enum representing event severity.
virtual ~BufferRepeaterComponentBase()
Destroy BufferRepeaterComponentBase object.
friend class BufferRepeaterTesterBase
Friend class tester to support autocoded test harness.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void portIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port portIn.
void set_deallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
Fw::Buffer allocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port allocate.
void log_FATAL_AllocationHardFailure(I32 port, FwSizeType size) const
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_Log_OutputPorts()
bool isConnected_deallocate_OutputPort(FwIndexType portNum) const
RateGroupDivider component implementation.
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port deallocate.
Auto-generated base for BufferRepeater component.
bool isConnected_allocate_OutputPort(FwIndexType portNum) const
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].