F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
BufferManagerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title BufferManagerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for BufferManager component base class
5 // ======================================================================
6 
7 #ifndef Svc_BufferManagerComponentAc_HPP
8 #define Svc_BufferManagerComponentAc_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 "Fw/Tlm/TlmPortAc.hpp"
25 #include "Fw/Tlm/TlmString.hpp"
26 #include "Os/Mutex.hpp"
28 
29 namespace Svc {
30 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
47 
48  PROTECTED:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
59  };
60 
62  enum {
67  };
68 
70  enum {
73  };
74 
76  enum {
79  };
80 
82  enum {
88  };
89 
90  public:
91 
92  // ----------------------------------------------------------------------
93  // Component initialization
94  // ----------------------------------------------------------------------
95 
97  void init(
98  FwEnumStoreType instance = 0
99  );
100 
101  public:
102 
103  // ----------------------------------------------------------------------
104  // Getters for typed input ports
105  // ----------------------------------------------------------------------
106 
111  FwIndexType portNum
112  );
113 
118  FwIndexType portNum
119  );
120 
125  FwIndexType portNum
126  );
127 
128  public:
129 
130  // ----------------------------------------------------------------------
131  // Connect input ports to special output ports
132  // ----------------------------------------------------------------------
133 
136  FwIndexType portNum,
137  Fw::InputLogPort* port
138  );
139 
140 #if FW_ENABLE_TEXT_LOGGING == 1
141 
143  void set_textEventOut_OutputPort(
144  FwIndexType portNum,
145  Fw::InputLogTextPort* port
146  );
147 
148 #endif
149 
152  FwIndexType portNum,
153  Fw::InputTimePort* port
154  );
155 
158  FwIndexType portNum,
159  Fw::InputTlmPort* port
160  );
161 
162 #if FW_PORT_SERIALIZATION
163 
164  public:
165 
166  // ----------------------------------------------------------------------
167  // Connect serial input ports to special output ports
168  // ----------------------------------------------------------------------
169 
172  FwIndexType portNum,
173  Fw::InputSerializePort* port
174  );
175 
176 #if FW_ENABLE_TEXT_LOGGING == 1
177 
179  void set_textEventOut_OutputPort(
180  FwIndexType portNum,
181  Fw::InputSerializePort* port
182  );
183 
184 #endif
185 
188  FwIndexType portNum,
189  Fw::InputSerializePort* port
190  );
191 
194  FwIndexType portNum,
195  Fw::InputSerializePort* port
196  );
197 
198 #endif
199 
200  PROTECTED:
201 
202  // ----------------------------------------------------------------------
203  // Component construction and destruction
204  // ----------------------------------------------------------------------
205 
208  const char* compName = ""
209  );
210 
212  virtual ~BufferManagerComponentBase();
213 
214  PROTECTED:
215 
216  // ----------------------------------------------------------------------
217  // Getters for numbers of typed input ports
218  // ----------------------------------------------------------------------
219 
224 
229 
234 
235  PROTECTED:
236 
237  // ----------------------------------------------------------------------
238  // Getters for numbers of special output ports
239  // ----------------------------------------------------------------------
240 
245 
246 #if FW_ENABLE_TEXT_LOGGING == 1
247 
251  FwIndexType getNum_textEventOut_OutputPorts() const;
252 
253 #endif
254 
259 
264 
265  PROTECTED:
266 
267  // ----------------------------------------------------------------------
268  // Connection status queries for special output ports
269  // ----------------------------------------------------------------------
270 
275  FwIndexType portNum
276  );
277 
278 #if FW_ENABLE_TEXT_LOGGING == 1
279 
283  bool isConnected_textEventOut_OutputPort(
284  FwIndexType portNum
285  );
286 
287 #endif
288 
293  FwIndexType portNum
294  );
295 
300  FwIndexType portNum
301  );
302 
303  PROTECTED:
304 
305  // ----------------------------------------------------------------------
306  // Handlers to implement for typed input ports
307  // ----------------------------------------------------------------------
308 
311  FwIndexType portNum,
312  U32 size
313  ) = 0;
314 
316  virtual void bufferSendIn_handler(
317  FwIndexType portNum,
318  Fw::Buffer& fwBuffer
319  ) = 0;
320 
322  virtual void schedIn_handler(
323  FwIndexType portNum,
324  U32 context
325  ) = 0;
326 
327  PROTECTED:
328 
329  // ----------------------------------------------------------------------
330  // Port handler base-class functions for typed input ports
331  //
332  // Call these functions directly to bypass the corresponding ports
333  // ----------------------------------------------------------------------
334 
337  FwIndexType portNum,
338  U32 size
339  );
340 
343  FwIndexType portNum,
344  Fw::Buffer& fwBuffer
345  );
346 
348  void schedIn_handlerBase(
349  FwIndexType portNum,
350  U32 context
351  );
352 
353  PROTECTED:
354 
355  // ----------------------------------------------------------------------
356  // Event logging functions
357  // ----------------------------------------------------------------------
358 
363  U32 size
364  );
365 
370 
371  PROTECTED:
372 
373  // ----------------------------------------------------------------------
374  // Event throttle reset functions
375  // ----------------------------------------------------------------------
376 
379 
382 
383  PROTECTED:
384 
385  // ----------------------------------------------------------------------
386  // Telemetry write functions
387  // ----------------------------------------------------------------------
388 
392  void tlmWrite_TotalBuffs(
393  U32 arg,
394  Fw::Time _tlmTime = Fw::Time()
395  );
396 
400  void tlmWrite_CurrBuffs(
401  U32 arg,
402  Fw::Time _tlmTime = Fw::Time()
403  );
404 
408  void tlmWrite_HiBuffs(
409  U32 arg,
410  Fw::Time _tlmTime = Fw::Time()
411  );
412 
416  void tlmWrite_NoBuffs(
417  U32 arg,
418  Fw::Time _tlmTime = Fw::Time()
419  );
420 
424  void tlmWrite_EmptyBuffs(
425  U32 arg,
426  Fw::Time _tlmTime = Fw::Time()
427  );
428 
429  PROTECTED:
430 
431  // ----------------------------------------------------------------------
432  // Time
433  // ----------------------------------------------------------------------
434 
438  Fw::Time getTime() const;
439 
440  PROTECTED:
441 
442  // ----------------------------------------------------------------------
443  // Mutex operations for guarded ports
444  //
445  // You can override these operations to provide more sophisticated
446  // synchronization
447  // ----------------------------------------------------------------------
448 
450  virtual void lock();
451 
453  virtual void unLock();
454 
455  PRIVATE:
456 
457  // ----------------------------------------------------------------------
458  // Calls for messages received on typed input ports
459  // ----------------------------------------------------------------------
460 
462  static Fw::Buffer m_p_bufferGetCallee_in(
463  Fw::PassiveComponentBase* callComp,
464  FwIndexType portNum,
465  U32 size
466  );
467 
469  static void m_p_bufferSendIn_in(
470  Fw::PassiveComponentBase* callComp,
471  FwIndexType portNum,
472  Fw::Buffer& fwBuffer
473  );
474 
476  static void m_p_schedIn_in(
477  Fw::PassiveComponentBase* callComp,
478  FwIndexType portNum,
479  U32 context
480  );
481 
482  PRIVATE:
483 
484  // ----------------------------------------------------------------------
485  // Typed input ports
486  // ----------------------------------------------------------------------
487 
489  Fw::InputBufferGetPort m_bufferGetCallee_InputPort[NUM_BUFFERGETCALLEE_INPUT_PORTS];
490 
492  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
493 
495  Svc::InputSchedPort m_schedIn_InputPort[NUM_SCHEDIN_INPUT_PORTS];
496 
497  PRIVATE:
498 
499  // ----------------------------------------------------------------------
500  // Special output ports
501  // ----------------------------------------------------------------------
502 
504  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
505 
506 #if FW_ENABLE_TEXT_LOGGING == 1
507 
509  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
510 
511 #endif
512 
514  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
515 
517  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
518 
519  PRIVATE:
520 
521  // ----------------------------------------------------------------------
522  // Counter values for event throttling
523  // ----------------------------------------------------------------------
524 
526  std::atomic<FwIndexType> m_NoBuffsAvailableThrottle;
527 
529  std::atomic<FwIndexType> m_NullEmptyBufferThrottle;
530 
531  PRIVATE:
532 
533  // ----------------------------------------------------------------------
534  // First update flags for telemetry channels
535  // ----------------------------------------------------------------------
536 
538  bool m_first_update_TotalBuffs;
539 
541  bool m_first_update_CurrBuffs;
542 
544  bool m_first_update_HiBuffs;
545 
547  bool m_first_update_NoBuffs;
548 
550  bool m_first_update_EmptyBuffs;
551 
552  PRIVATE:
553 
554  // ----------------------------------------------------------------------
555  // Last value storage for telemetry channels
556  // ----------------------------------------------------------------------
557 
559  U32 m_last_TotalBuffs;
560 
562  U32 m_last_CurrBuffs;
563 
565  U32 m_last_HiBuffs;
566 
568  U32 m_last_NoBuffs;
569 
571  U32 m_last_EmptyBuffs;
572 
573  PRIVATE:
574 
575  // ----------------------------------------------------------------------
576  // Mutexes
577  // ----------------------------------------------------------------------
578 
580  Os::Mutex m_guardedPortMutex;
581 
582  };
583 
584 }
585 
586 #endif
Definition: Time.hpp:9
virtual ~BufferManagerComponentBase()
Destroy BufferManagerComponentBase object.
The BufferManager was unable to allocate a requested buffer.
I32 FwEnumStoreType
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
virtual void bufferSendIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendIn.
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
void init()
Object initializer.
Definition: ObjBase.cpp:26
Fw::InputBufferSendPort * get_bufferSendIn_InputPort(FwIndexType portNum)
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void log_WARNING_HI_NoBuffsAvailable_ThrottleClear()
Reset throttle value for NoBuffsAvailable.
Fw::InputBufferGetPort * get_bufferGetCallee_InputPort(FwIndexType portNum)
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
virtual Fw::Buffer bufferGetCallee_handler(FwIndexType portNum, U32 size)=0
Handler for input port bufferGetCallee.
void tlmWrite_NoBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
friend class BufferManagerComponentBaseFriend
Friend class for white-box testing.
void tlmWrite_CurrBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_HiBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
virtual void unLock()
Unlock the guarded mutex.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void tlmWrite_TotalBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
virtual void lock()
Lock the guarded mutex.
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
void tlmWrite_EmptyBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
friend class BufferManagerTesterBase
Friend class tester to support autocoded test harness.
PlatformIndexType FwIndexType
void log_WARNING_HI_NullEmptyBuffer_ThrottleClear()
Reset throttle value for NullEmptyBuffer.
RateGroupDivider component implementation.
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
void bufferSendIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendIn.
Auto-generated base for BufferManager component.
The buffer manager received a null pointer and zero-sized buffer as a return. Probably undetected fai...
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
BufferManagerComponentBase(const char *compName="")
Construct BufferManagerComponentBase object.
Fw::Buffer bufferGetCallee_handlerBase(FwIndexType portNum, U32 size)
Handler base-class function for input port bufferGetCallee.