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"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
47  friend class BufferManagerTester;
48 
49  PROTECTED:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
60  };
61 
63  enum {
68  };
69 
71  enum {
74  };
75 
77  enum {
80  };
81 
83  enum {
89  };
90 
91  public:
92 
93  // ----------------------------------------------------------------------
94  // Component initialization
95  // ----------------------------------------------------------------------
96 
98  void init(
99  FwEnumStoreType instance = 0
100  );
101 
102  public:
103 
104  // ----------------------------------------------------------------------
105  // Getters for typed input ports
106  // ----------------------------------------------------------------------
107 
112  FwIndexType portNum
113  );
114 
119  FwIndexType portNum
120  );
121 
126  FwIndexType portNum
127  );
128 
129  public:
130 
131  // ----------------------------------------------------------------------
132  // Connect input ports to special output ports
133  // ----------------------------------------------------------------------
134 
137  FwIndexType portNum,
138  Fw::InputLogPort* port
139  );
140 
141 #if FW_ENABLE_TEXT_LOGGING == 1
142 
144  void set_textEventOut_OutputPort(
145  FwIndexType portNum,
146  Fw::InputLogTextPort* port
147  );
148 
149 #endif
150 
153  FwIndexType portNum,
154  Fw::InputTimePort* port
155  );
156 
159  FwIndexType portNum,
160  Fw::InputTlmPort* port
161  );
162 
163 #if FW_PORT_SERIALIZATION
164 
165  public:
166 
167  // ----------------------------------------------------------------------
168  // Connect serial input ports to special output ports
169  // ----------------------------------------------------------------------
170 
173  FwIndexType portNum,
174  Fw::InputSerializePort* port
175  );
176 
177 #if FW_ENABLE_TEXT_LOGGING == 1
178 
180  void set_textEventOut_OutputPort(
181  FwIndexType portNum,
182  Fw::InputSerializePort* port
183  );
184 
185 #endif
186 
189  FwIndexType portNum,
190  Fw::InputSerializePort* port
191  );
192 
195  FwIndexType portNum,
196  Fw::InputSerializePort* port
197  );
198 
199 #endif
200 
201  PROTECTED:
202 
203  // ----------------------------------------------------------------------
204  // Component construction and destruction
205  // ----------------------------------------------------------------------
206 
209  const char* compName = ""
210  );
211 
213  virtual ~BufferManagerComponentBase();
214 
215  PROTECTED:
216 
217  // ----------------------------------------------------------------------
218  // Getters for numbers of typed input ports
219  // ----------------------------------------------------------------------
220 
225 
230 
235 
236  PROTECTED:
237 
238  // ----------------------------------------------------------------------
239  // Getters for numbers of special output ports
240  // ----------------------------------------------------------------------
241 
246 
247 #if FW_ENABLE_TEXT_LOGGING == 1
248 
252  FwIndexType getNum_textEventOut_OutputPorts() const;
253 
254 #endif
255 
260 
265 
266  PROTECTED:
267 
268  // ----------------------------------------------------------------------
269  // Connection status queries for special output ports
270  // ----------------------------------------------------------------------
271 
276  FwIndexType portNum
277  );
278 
279 #if FW_ENABLE_TEXT_LOGGING == 1
280 
284  bool isConnected_textEventOut_OutputPort(
285  FwIndexType portNum
286  );
287 
288 #endif
289 
294  FwIndexType portNum
295  );
296 
301  FwIndexType portNum
302  );
303 
304  PROTECTED:
305 
306  // ----------------------------------------------------------------------
307  // Handlers to implement for typed input ports
308  // ----------------------------------------------------------------------
309 
312  FwIndexType portNum,
313  FwSizeType size
314  ) = 0;
315 
317  virtual void bufferSendIn_handler(
318  FwIndexType portNum,
319  Fw::Buffer& fwBuffer
320  ) = 0;
321 
323  virtual void schedIn_handler(
324  FwIndexType portNum,
325  U32 context
326  ) = 0;
327 
328  PROTECTED:
329 
330  // ----------------------------------------------------------------------
331  // Port handler base-class functions for typed input ports
332  //
333  // Call these functions directly to bypass the corresponding ports
334  // ----------------------------------------------------------------------
335 
338  FwIndexType portNum,
339  FwSizeType size
340  );
341 
344  FwIndexType portNum,
345  Fw::Buffer& fwBuffer
346  );
347 
349  void schedIn_handlerBase(
350  FwIndexType portNum,
351  U32 context
352  );
353 
354  PROTECTED:
355 
356  // ----------------------------------------------------------------------
357  // Event logging functions
358  // ----------------------------------------------------------------------
359 
364  FwSizeType size
365  );
366 
371 
372  PROTECTED:
373 
374  // ----------------------------------------------------------------------
375  // Event throttle reset functions
376  // ----------------------------------------------------------------------
377 
380 
383 
384  PROTECTED:
385 
386  // ----------------------------------------------------------------------
387  // Telemetry write functions
388  // ----------------------------------------------------------------------
389 
393  void tlmWrite_TotalBuffs(
394  U32 arg,
395  Fw::Time _tlmTime = Fw::Time()
396  );
397 
401  void tlmWrite_CurrBuffs(
402  U32 arg,
403  Fw::Time _tlmTime = Fw::Time()
404  );
405 
409  void tlmWrite_HiBuffs(
410  U32 arg,
411  Fw::Time _tlmTime = Fw::Time()
412  );
413 
417  void tlmWrite_NoBuffs(
418  U32 arg,
419  Fw::Time _tlmTime = Fw::Time()
420  );
421 
425  void tlmWrite_EmptyBuffs(
426  U32 arg,
427  Fw::Time _tlmTime = Fw::Time()
428  );
429 
430  PROTECTED:
431 
432  // ----------------------------------------------------------------------
433  // Time
434  // ----------------------------------------------------------------------
435 
439  Fw::Time getTime() const;
440 
441  PROTECTED:
442 
443  // ----------------------------------------------------------------------
444  // Mutex operations for guarded ports
445  //
446  // You can override these operations to provide more sophisticated
447  // synchronization
448  // ----------------------------------------------------------------------
449 
451  virtual void lock();
452 
454  virtual void unLock();
455 
456  PRIVATE:
457 
458  // ----------------------------------------------------------------------
459  // Calls for messages received on typed input ports
460  // ----------------------------------------------------------------------
461 
463  static Fw::Buffer m_p_bufferGetCallee_in(
464  Fw::PassiveComponentBase* callComp,
465  FwIndexType portNum,
466  FwSizeType size
467  );
468 
470  static void m_p_bufferSendIn_in(
471  Fw::PassiveComponentBase* callComp,
472  FwIndexType portNum,
473  Fw::Buffer& fwBuffer
474  );
475 
477  static void m_p_schedIn_in(
478  Fw::PassiveComponentBase* callComp,
479  FwIndexType portNum,
480  U32 context
481  );
482 
483  PRIVATE:
484 
485  // ----------------------------------------------------------------------
486  // Typed input ports
487  // ----------------------------------------------------------------------
488 
490  Fw::InputBufferGetPort m_bufferGetCallee_InputPort[NUM_BUFFERGETCALLEE_INPUT_PORTS];
491 
493  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
494 
496  Svc::InputSchedPort m_schedIn_InputPort[NUM_SCHEDIN_INPUT_PORTS];
497 
498  PRIVATE:
499 
500  // ----------------------------------------------------------------------
501  // Special output ports
502  // ----------------------------------------------------------------------
503 
505  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
506 
507 #if FW_ENABLE_TEXT_LOGGING == 1
508 
510  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
511 
512 #endif
513 
515  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
516 
518  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
519 
520  PRIVATE:
521 
522  // ----------------------------------------------------------------------
523  // Counter values for event throttling
524  // ----------------------------------------------------------------------
525 
527  std::atomic<FwIndexType> m_NoBuffsAvailableThrottle;
528 
530  std::atomic<FwIndexType> m_NullEmptyBufferThrottle;
531 
532  PRIVATE:
533 
534  // ----------------------------------------------------------------------
535  // First update flags for telemetry channels
536  // ----------------------------------------------------------------------
537 
539  bool m_first_update_TotalBuffs;
540 
542  bool m_first_update_CurrBuffs;
543 
545  bool m_first_update_HiBuffs;
546 
548  bool m_first_update_NoBuffs;
549 
551  bool m_first_update_EmptyBuffs;
552 
553  PRIVATE:
554 
555  // ----------------------------------------------------------------------
556  // Last value storage for telemetry channels
557  // ----------------------------------------------------------------------
558 
560  U32 m_last_TotalBuffs;
561 
563  U32 m_last_CurrBuffs;
564 
566  U32 m_last_HiBuffs;
567 
569  U32 m_last_NoBuffs;
570 
572  U32 m_last_EmptyBuffs;
573 
574  PRIVATE:
575 
576  // ----------------------------------------------------------------------
577  // Mutexes
578  // ----------------------------------------------------------------------
579 
581  Os::Mutex m_guardedPortMutex;
582 
583  };
584 
585 }
586 
587 #endif
void log_WARNING_HI_NoBuffsAvailable(FwSizeType size)
Definition: Time.hpp:9
virtual ~BufferManagerComponentBase()
Destroy BufferManagerComponentBase object.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
The BufferManager was unable to allocate a requested buffer.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Fw::Buffer bufferGetCallee_handlerBase(FwIndexType portNum, FwSizeType size)
Handler base-class function for input port bufferGetCallee.
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.
The buffer manager received a null pointer and zero-sized buffer as a return. Probably undetected fai...
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.
void tlmWrite_NoBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CurrBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_HiBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
friend class BufferManagerTester
Friend class tester implementation to support white-box testing.
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].
virtual Fw::Buffer bufferGetCallee_handler(FwIndexType portNum, FwSizeType size)=0
Handler for input port bufferGetCallee.
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.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
BufferManagerComponentBase(const char *compName="")
Construct BufferManagerComponentBase object.