F´ Flight Software - C/C++ Documentation  devel
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 "FpConfig.hpp"
14 #include "Fw/Log/LogPortAc.hpp"
15 #include "Fw/Log/LogString.hpp"
16 #if FW_ENABLE_TEXT_LOGGING == 1
17 #include "Fw/Log/LogTextPortAc.hpp"
18 #endif
21 #include "Fw/Time/TimePortAc.hpp"
22 #include "Fw/Tlm/TlmPortAc.hpp"
23 #include "Fw/Tlm/TlmString.hpp"
24 #include "Os/Mutex.hpp"
26 
27 namespace Svc {
28 
35  {
36 
37  // ----------------------------------------------------------------------
38  // Friend classes
39  // ----------------------------------------------------------------------
40 
43 
44  PROTECTED:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
51  enum {
55  };
56 
58  enum {
63  };
64 
66  enum {
69  };
70 
72  enum {
75  };
76 
78  enum {
84  };
85 
86  public:
87 
88  // ----------------------------------------------------------------------
89  // Component initialization
90  // ----------------------------------------------------------------------
91 
93  void init(
94  FwEnumStoreType instance = 0
95  );
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Getters for typed input ports
101  // ----------------------------------------------------------------------
102 
107  FwIndexType portNum
108  );
109 
114  FwIndexType portNum
115  );
116 
121  FwIndexType portNum
122  );
123 
124  public:
125 
126  // ----------------------------------------------------------------------
127  // Connect input ports to special output ports
128  // ----------------------------------------------------------------------
129 
132  FwIndexType portNum,
133  Fw::InputLogPort* port
134  );
135 
136 #if FW_ENABLE_TEXT_LOGGING == 1
137 
139  void set_textEventOut_OutputPort(
140  FwIndexType portNum,
141  Fw::InputLogTextPort* port
142  );
143 
144 #endif
145 
148  FwIndexType portNum,
149  Fw::InputTimePort* port
150  );
151 
154  FwIndexType portNum,
155  Fw::InputTlmPort* port
156  );
157 
158 #if FW_PORT_SERIALIZATION
159 
160  public:
161 
162  // ----------------------------------------------------------------------
163  // Connect serial input ports to special output ports
164  // ----------------------------------------------------------------------
165 
168  FwIndexType portNum,
169  Fw::InputSerializePort* port
170  );
171 
172 #if FW_ENABLE_TEXT_LOGGING == 1
173 
175  void set_textEventOut_OutputPort(
176  FwIndexType portNum,
177  Fw::InputSerializePort* port
178  );
179 
180 #endif
181 
184  FwIndexType portNum,
185  Fw::InputSerializePort* port
186  );
187 
190  FwIndexType portNum,
191  Fw::InputSerializePort* port
192  );
193 
194 #endif
195 
196  PROTECTED:
197 
198  // ----------------------------------------------------------------------
199  // Component construction and destruction
200  // ----------------------------------------------------------------------
201 
204  const char* compName = ""
205  );
206 
208  virtual ~BufferManagerComponentBase();
209 
210  PROTECTED:
211 
212  // ----------------------------------------------------------------------
213  // Getters for numbers of typed input ports
214  // ----------------------------------------------------------------------
215 
220 
225 
230 
231  PROTECTED:
232 
233  // ----------------------------------------------------------------------
234  // Getters for numbers of special output ports
235  // ----------------------------------------------------------------------
236 
241 
242 #if FW_ENABLE_TEXT_LOGGING == 1
243 
247  FwIndexType getNum_textEventOut_OutputPorts() const;
248 
249 #endif
250 
255 
260 
261  PROTECTED:
262 
263  // ----------------------------------------------------------------------
264  // Connection status queries for special output ports
265  // ----------------------------------------------------------------------
266 
271  FwIndexType portNum
272  );
273 
274 #if FW_ENABLE_TEXT_LOGGING == 1
275 
279  bool isConnected_textEventOut_OutputPort(
280  FwIndexType portNum
281  );
282 
283 #endif
284 
289  FwIndexType portNum
290  );
291 
296  FwIndexType portNum
297  );
298 
299  PROTECTED:
300 
301  // ----------------------------------------------------------------------
302  // Handlers to implement for typed input ports
303  // ----------------------------------------------------------------------
304 
307  FwIndexType portNum,
308  U32 size
309  ) = 0;
310 
312  virtual void bufferSendIn_handler(
313  FwIndexType portNum,
314  Fw::Buffer& fwBuffer
315  ) = 0;
316 
318  virtual void schedIn_handler(
319  FwIndexType portNum,
320  U32 context
321  ) = 0;
322 
323  PROTECTED:
324 
325  // ----------------------------------------------------------------------
326  // Port handler base-class functions for typed input ports
327  //
328  // Call these functions directly to bypass the corresponding ports
329  // ----------------------------------------------------------------------
330 
333  FwIndexType portNum,
334  U32 size
335  );
336 
339  FwIndexType portNum,
340  Fw::Buffer& fwBuffer
341  );
342 
344  void schedIn_handlerBase(
345  FwIndexType portNum,
346  U32 context
347  );
348 
349  PROTECTED:
350 
351  // ----------------------------------------------------------------------
352  // Event logging functions
353  // ----------------------------------------------------------------------
354 
359  U32 size
360  );
361 
366 
367  PROTECTED:
368 
369  // ----------------------------------------------------------------------
370  // Event throttle reset functions
371  // ----------------------------------------------------------------------
372 
375 
378 
379  PROTECTED:
380 
381  // ----------------------------------------------------------------------
382  // Telemetry write functions
383  // ----------------------------------------------------------------------
384 
388  void tlmWrite_TotalBuffs(
389  U32 arg,
390  Fw::Time _tlmTime = Fw::Time()
391  );
392 
396  void tlmWrite_CurrBuffs(
397  U32 arg,
398  Fw::Time _tlmTime = Fw::Time()
399  );
400 
404  void tlmWrite_HiBuffs(
405  U32 arg,
406  Fw::Time _tlmTime = Fw::Time()
407  );
408 
412  void tlmWrite_NoBuffs(
413  U32 arg,
414  Fw::Time _tlmTime = Fw::Time()
415  );
416 
420  void tlmWrite_EmptyBuffs(
421  U32 arg,
422  Fw::Time _tlmTime = Fw::Time()
423  );
424 
425  PROTECTED:
426 
427  // ----------------------------------------------------------------------
428  // Time
429  // ----------------------------------------------------------------------
430 
434  Fw::Time getTime();
435 
436  PROTECTED:
437 
438  // ----------------------------------------------------------------------
439  // Mutex operations for guarded ports
440  //
441  // You can override these operations to provide more sophisticated
442  // synchronization
443  // ----------------------------------------------------------------------
444 
446  virtual void lock();
447 
449  virtual void unLock();
450 
451  PRIVATE:
452 
453  // ----------------------------------------------------------------------
454  // Calls for messages received on typed input ports
455  // ----------------------------------------------------------------------
456 
458  static Fw::Buffer m_p_bufferGetCallee_in(
459  Fw::PassiveComponentBase* callComp,
460  FwIndexType portNum,
461  U32 size
462  );
463 
465  static void m_p_bufferSendIn_in(
466  Fw::PassiveComponentBase* callComp,
467  FwIndexType portNum,
468  Fw::Buffer& fwBuffer
469  );
470 
472  static void m_p_schedIn_in(
473  Fw::PassiveComponentBase* callComp,
474  FwIndexType portNum,
475  U32 context
476  );
477 
478  PRIVATE:
479 
480  // ----------------------------------------------------------------------
481  // Typed input ports
482  // ----------------------------------------------------------------------
483 
485  Fw::InputBufferGetPort m_bufferGetCallee_InputPort[NUM_BUFFERGETCALLEE_INPUT_PORTS];
486 
488  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
489 
491  Svc::InputSchedPort m_schedIn_InputPort[NUM_SCHEDIN_INPUT_PORTS];
492 
493  PRIVATE:
494 
495  // ----------------------------------------------------------------------
496  // Special output ports
497  // ----------------------------------------------------------------------
498 
500  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
501 
502 #if FW_ENABLE_TEXT_LOGGING == 1
503 
505  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
506 
507 #endif
508 
510  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
511 
513  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
514 
515  PRIVATE:
516 
517  // ----------------------------------------------------------------------
518  // Counter values for event throttling
519  // ----------------------------------------------------------------------
520 
522  FwIndexType m_NoBuffsAvailableThrottle;
523 
525  FwIndexType m_ZeroSizeBufferThrottle;
526 
527  PRIVATE:
528 
529  // ----------------------------------------------------------------------
530  // First update flags for telemetry channels
531  // ----------------------------------------------------------------------
532 
534  bool m_first_update_TotalBuffs;
535 
537  bool m_first_update_CurrBuffs;
538 
540  bool m_first_update_HiBuffs;
541 
543  bool m_first_update_NoBuffs;
544 
546  bool m_first_update_EmptyBuffs;
547 
548  PRIVATE:
549 
550  // ----------------------------------------------------------------------
551  // Last value storage for telemetry channels
552  // ----------------------------------------------------------------------
553 
555  U32 m_last_TotalBuffs;
556 
558  U32 m_last_CurrBuffs;
559 
561  U32 m_last_HiBuffs;
562 
564  U32 m_last_NoBuffs;
565 
567  U32 m_last_EmptyBuffs;
568 
569  PRIVATE:
570 
571  // ----------------------------------------------------------------------
572  // Mutexes
573  // ----------------------------------------------------------------------
574 
576  Os::Mutex m_guardedPortMutex;
577 
578  };
579 
580 }
581 
582 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:51
PlatformIndexType FwIndexType
Definition: FpConfig.h:20
C++-compatible configuration header for fprime configuration.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
Auto-generated base for BufferManager component.
virtual void bufferSendIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendIn.
virtual void unLock()
Unlock the guarded mutex.
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
Fw::InputBufferSendPort * get_bufferSendIn_InputPort(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.
void tlmWrite_HiBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
@ EVENTID_ZEROSIZEBUFFER_THROTTLE
Throttle reset count for ZeroSizeBuffer.
@ EVENTID_NOBUFFSAVAILABLE_THROTTLE
Throttle reset count for NoBuffsAvailable.
Fw::InputBufferGetPort * get_bufferGetCallee_InputPort(FwIndexType portNum)
virtual Fw::Buffer bufferGetCallee_handler(FwIndexType portNum, U32 size)=0
Handler for input port bufferGetCallee.
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
@ EVENTID_NOBUFFSAVAILABLE
The BufferManager was unable to allocate a requested buffer.
@ EVENTID_ZEROSIZEBUFFER
The buffer manager received a zero-sized buffer as a return. Probably undetected empty buffer allocat...
void log_WARNING_HI_ZeroSizeBuffer_ThrottleClear()
Reset throttle value for ZeroSizeBuffer.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void bufferSendIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendIn.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
virtual ~BufferManagerComponentBase()
Destroy BufferManagerComponentBase object.
virtual void lock()
Lock the guarded mutex.
friend class BufferManagerComponentBaseFriend
Friend class for white-box testing.
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
void tlmWrite_EmptyBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_NoBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_TotalBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
void tlmWrite_CurrBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void log_WARNING_HI_NoBuffsAvailable_ThrottleClear()
Reset throttle value for NoBuffsAvailable.
@ CHANNELID_TOTALBUFFS
Channel ID for TotalBuffs.
@ CHANNELID_NOBUFFS
Channel ID for NoBuffs.
@ CHANNELID_EMPTYBUFFS
Channel ID for EmptyBuffs.
@ CHANNELID_CURRBUFFS
Channel ID for CurrBuffs.
@ CHANNELID_HIBUFFS
Channel ID for HiBuffs.