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 #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"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
47  friend class BufferRepeaterTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
58  };
59 
61  enum {
65  };
66 
68  enum {
72  };
73 
75  enum {
78  };
79 
80  public:
81 
82  // ----------------------------------------------------------------------
83  // Component initialization
84  // ----------------------------------------------------------------------
85 
87  void init(
88  FwEnumStoreType instance = 0
89  );
90 
91 #if !FW_DIRECT_PORT_CALLS
92 
93  public:
94 
95  // ----------------------------------------------------------------------
96  // Getters for typed input ports
97  // ----------------------------------------------------------------------
98 
103  FwIndexType portNum
104  );
105 
106 #endif
107 
108 #if !FW_DIRECT_PORT_CALLS
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Connect input ports to special output ports
114  // ----------------------------------------------------------------------
115 
117  void set_Log_OutputPort(
118  FwIndexType portNum,
119  Fw::InputLogPort* port
120  );
121 
122 #if FW_ENABLE_TEXT_LOGGING == 1
123 
125  void set_LogText_OutputPort(
126  FwIndexType portNum,
127  Fw::InputLogTextPort* port
128  );
129 
130 #endif
131 
133  void set_Time_OutputPort(
134  FwIndexType portNum,
135  Fw::InputTimePort* port
136  );
137 
138 #endif
139 
140 #if !FW_DIRECT_PORT_CALLS
141 
142  public:
143 
144  // ----------------------------------------------------------------------
145  // Connect typed input ports to typed output ports
146  // ----------------------------------------------------------------------
147 
150  FwIndexType portNum,
152  );
153 
156  FwIndexType portNum,
158  );
159 
162  FwIndexType portNum,
164  );
165 
166 #endif
167 
168 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
169 
170  public:
171 
172  // ----------------------------------------------------------------------
173  // Connect serial input ports to special output ports
174  // ----------------------------------------------------------------------
175 
177  void set_Log_OutputPort(
178  FwIndexType portNum,
179  Fw::InputSerializePort* port
180  );
181 
182 #if FW_ENABLE_TEXT_LOGGING == 1
183 
185  void set_LogText_OutputPort(
186  FwIndexType portNum,
187  Fw::InputSerializePort* port
188  );
189 
190 #endif
191 
193  void set_Time_OutputPort(
194  FwIndexType portNum,
195  Fw::InputSerializePort* port
196  );
197 
198 #endif
199 
200 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
201 
202  public:
203 
204  // ----------------------------------------------------------------------
205  // Connect serial input ports to typed output ports
206  // ----------------------------------------------------------------------
207 
210  FwIndexType portNum,
211  Fw::InputSerializePort* port
212  );
213 
216  FwIndexType portNum,
217  Fw::InputSerializePort* port
218  );
219 
220 #endif
221 
222  protected:
223 
224  // ----------------------------------------------------------------------
225  // Component construction and destruction
226  // ----------------------------------------------------------------------
227 
230  const char* compName = ""
231  );
232 
235 
236  protected:
237 
238  // ----------------------------------------------------------------------
239  // Getters for numbers of typed input ports
240  // ----------------------------------------------------------------------
241 
246  return NUM_PORTIN_INPUT_PORTS;
247  }
248 
249  protected:
250 
251  // ----------------------------------------------------------------------
252  // Getters for numbers of special output ports
253  // ----------------------------------------------------------------------
254 
258  static constexpr FwIndexType getNum_Log_OutputPorts() {
259  return NUM_LOG_OUTPUT_PORTS;
260  }
261 
262 #if FW_ENABLE_TEXT_LOGGING == 1
263 
267  static constexpr FwIndexType getNum_LogText_OutputPorts() {
269  }
270 
271 #endif
272 
277  return NUM_TIME_OUTPUT_PORTS;
278  }
279 
280  protected:
281 
282  // ----------------------------------------------------------------------
283  // Getters for numbers of typed output ports
284  // ----------------------------------------------------------------------
285 
291  }
292 
298  }
299 
305  }
306 
307  protected:
308 
309  // ----------------------------------------------------------------------
310  // Connection status queries for special output ports
311  // ----------------------------------------------------------------------
312 
317  FwIndexType portNum
318  ) const;
319 
320 #if FW_ENABLE_TEXT_LOGGING == 1
321 
325  bool isConnected_LogText_OutputPort(
326  FwIndexType portNum
327  ) const;
328 
329 #endif
330 
335  FwIndexType portNum
336  ) const;
337 
338  protected:
339 
340  // ----------------------------------------------------------------------
341  // Connection status queries for typed output ports
342  // ----------------------------------------------------------------------
343 
348  FwIndexType portNum
349  ) const;
350 
355  FwIndexType portNum
356  ) const;
357 
362  FwIndexType portNum
363  ) const;
364 
365  protected:
366 
367  // ----------------------------------------------------------------------
368  // Handlers to implement for typed input ports
369  // ----------------------------------------------------------------------
370 
372  virtual void portIn_handler(
373  FwIndexType portNum,
374  Fw::Buffer& fwBuffer
375  ) = 0;
376 
377 #if FW_DIRECT_PORT_CALLS
378  public:
379 #else
380  protected:
381 #endif
382 
383  // ----------------------------------------------------------------------
384  // Port handler base-class functions for typed input ports
385  //
386  // Call these functions directly to bypass the corresponding ports
387  // ----------------------------------------------------------------------
388 
390  void portIn_handlerBase(
391  FwIndexType portNum,
392  Fw::Buffer& fwBuffer
393  );
394 
395  protected:
396 
397  // ----------------------------------------------------------------------
398  // Invocation functions for typed output ports
399  // ----------------------------------------------------------------------
400 
403  FwIndexType portNum,
404  FwSizeType size
405  ) const;
406 
408  void deallocate_out(
409  FwIndexType portNum,
410  Fw::Buffer& fwBuffer
411  ) const;
412 
414  void portOut_out(
415  FwIndexType portNum,
416  Fw::Buffer& fwBuffer
417  ) const;
418 
419  protected:
420 
421  // ----------------------------------------------------------------------
422  // Event logging functions
423  // ----------------------------------------------------------------------
424 
429  I32 port,
430  FwSizeType size
431  ) const;
432 
437  I32 port,
438  FwSizeType size
439  ) const;
440 
441  protected:
442 
443  // ----------------------------------------------------------------------
444  // Time
445  // ----------------------------------------------------------------------
446 
450  Fw::Time getTime() const;
451 
452  private:
453 
454  // ----------------------------------------------------------------------
455  // Calls for messages received on typed input ports
456  // ----------------------------------------------------------------------
457 
459  static void m_p_portIn_in(
460  Fw::PassiveComponentBase* callComp,
461  FwIndexType portNum,
462  Fw::Buffer& fwBuffer
463  );
464 
465  private:
466 
467  // ----------------------------------------------------------------------
468  // Invocation functions for special output ports
469  // ----------------------------------------------------------------------
470 
472  void Log_out(
473  FwIndexType portNum,
474  FwEventIdType id,
475  Fw::Time& timeTag,
476  const Fw::LogSeverity& severity,
477  Fw::LogBuffer& args
478  ) const;
479 
480 #if FW_ENABLE_TEXT_LOGGING
481 
483  void LogText_out(
484  FwIndexType portNum,
485  FwEventIdType id,
486  Fw::Time& timeTag,
487  const Fw::LogSeverity& severity,
488  Fw::TextLogString& text
489  ) const;
490 
491 #endif
492 
494  void Time_out(
495  FwIndexType portNum,
496  Fw::Time& time
497  ) const;
498 
499 #if !FW_DIRECT_PORT_CALLS
500 
501  private:
502 
503  // ----------------------------------------------------------------------
504  // Typed input ports
505  // ----------------------------------------------------------------------
506 
509 
510 #endif
511 
512 #if !FW_DIRECT_PORT_CALLS
513 
514  private:
515 
516  // ----------------------------------------------------------------------
517  // Special output ports
518  // ----------------------------------------------------------------------
519 
521  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
522 
523 #if FW_ENABLE_TEXT_LOGGING == 1
524 
526  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
527 
528 #endif
529 
531  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
532 
533 #endif
534 
535 #if !FW_DIRECT_PORT_CALLS
536 
537  private:
538 
539  // ----------------------------------------------------------------------
540  // Typed output ports
541  // ----------------------------------------------------------------------
542 
544  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
545 
547  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
548 
551 
552 #endif
553 
554  };
555 
556 }
557 
558 #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].