F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
BufferManagerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title BufferManagerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for BufferManager component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26  // Connect input port bufferGetCallee
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_bufferGetCallee_InputPorts());
30  port++
31  ) {
32  this->m_bufferGetCallee_InputPort[port].init();
33  this->m_bufferGetCallee_InputPort[port].addCallComp(
34  this,
35  m_p_bufferGetCallee_in
36  );
37  this->m_bufferGetCallee_InputPort[port].setPortNum(port);
38 
39 #if FW_OBJECT_NAMES == 1
40  Fw::ObjectName portName;
41  portName.format(
42  "%s_bufferGetCallee_InputPort[%" PRI_FwIndexType "]",
43  this->m_objName.toChar(),
44  port
45  );
46  this->m_bufferGetCallee_InputPort[port].setObjName(portName.toChar());
47 #endif
48  }
49 
50  // Connect input port bufferSendIn
51  for (
52  FwIndexType port = 0;
53  port < static_cast<FwIndexType>(this->getNum_bufferSendIn_InputPorts());
54  port++
55  ) {
56  this->m_bufferSendIn_InputPort[port].init();
57  this->m_bufferSendIn_InputPort[port].addCallComp(
58  this,
59  m_p_bufferSendIn_in
60  );
61  this->m_bufferSendIn_InputPort[port].setPortNum(port);
62 
63 #if FW_OBJECT_NAMES == 1
64  Fw::ObjectName portName;
65  portName.format(
66  "%s_bufferSendIn_InputPort[%" PRI_FwIndexType "]",
67  this->m_objName.toChar(),
68  port
69  );
70  this->m_bufferSendIn_InputPort[port].setObjName(portName.toChar());
71 #endif
72  }
73 
74  // Connect input port schedIn
75  for (
76  FwIndexType port = 0;
77  port < static_cast<FwIndexType>(this->getNum_schedIn_InputPorts());
78  port++
79  ) {
80  this->m_schedIn_InputPort[port].init();
81  this->m_schedIn_InputPort[port].addCallComp(
82  this,
83  m_p_schedIn_in
84  );
85  this->m_schedIn_InputPort[port].setPortNum(port);
86 
87 #if FW_OBJECT_NAMES == 1
88  Fw::ObjectName portName;
89  portName.format(
90  "%s_schedIn_InputPort[%" PRI_FwIndexType "]",
91  this->m_objName.toChar(),
92  port
93  );
94  this->m_schedIn_InputPort[port].setObjName(portName.toChar());
95 #endif
96  }
97 
98  // Connect output port eventOut
99  for (
100  FwIndexType port = 0;
101  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
102  port++
103  ) {
104  this->m_eventOut_OutputPort[port].init();
105 
106 #if FW_OBJECT_NAMES == 1
107  Fw::ObjectName portName;
108  portName.format(
109  "%s_eventOut_OutputPort[%" PRI_FwIndexType "]",
110  this->m_objName.toChar(),
111  port
112  );
113  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
114 #endif
115  }
116 
117 #if FW_ENABLE_TEXT_LOGGING == 1
118  // Connect output port textEventOut
119  for (
120  FwIndexType port = 0;
121  port < static_cast<FwIndexType>(this->getNum_textEventOut_OutputPorts());
122  port++
123  ) {
124  this->m_textEventOut_OutputPort[port].init();
125 
126 #if FW_OBJECT_NAMES == 1
127  Fw::ObjectName portName;
128  portName.format(
129  "%s_textEventOut_OutputPort[%" PRI_FwIndexType "]",
130  this->m_objName.toChar(),
131  port
132  );
133  this->m_textEventOut_OutputPort[port].setObjName(portName.toChar());
134 #endif
135  }
136 #endif
137 
138  // Connect output port timeCaller
139  for (
140  FwIndexType port = 0;
141  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
142  port++
143  ) {
144  this->m_timeCaller_OutputPort[port].init();
145 
146 #if FW_OBJECT_NAMES == 1
147  Fw::ObjectName portName;
148  portName.format(
149  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
150  this->m_objName.toChar(),
151  port
152  );
153  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
154 #endif
155  }
156 
157  // Connect output port tlmOut
158  for (
159  FwIndexType port = 0;
160  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
161  port++
162  ) {
163  this->m_tlmOut_OutputPort[port].init();
164 
165 #if FW_OBJECT_NAMES == 1
166  Fw::ObjectName portName;
167  portName.format(
168  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
169  this->m_objName.toChar(),
170  port
171  );
172  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
173 #endif
174  }
175  }
176 
177  // ----------------------------------------------------------------------
178  // Getters for typed input ports
179  // ----------------------------------------------------------------------
180 
183  {
184  FW_ASSERT(
185  (0 <= portNum) && (portNum < this->getNum_bufferGetCallee_InputPorts()),
186  static_cast<FwAssertArgType>(portNum)
187  );
188 
189  return &this->m_bufferGetCallee_InputPort[portNum];
190  }
191 
194  {
195  FW_ASSERT(
196  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
197  static_cast<FwAssertArgType>(portNum)
198  );
199 
200  return &this->m_bufferSendIn_InputPort[portNum];
201  }
202 
205  {
206  FW_ASSERT(
207  (0 <= portNum) && (portNum < this->getNum_schedIn_InputPorts()),
208  static_cast<FwAssertArgType>(portNum)
209  );
210 
211  return &this->m_schedIn_InputPort[portNum];
212  }
213 
214  // ----------------------------------------------------------------------
215  // Connect input ports to special output ports
216  // ----------------------------------------------------------------------
217 
220  FwIndexType portNum,
221  Fw::InputLogPort* port
222  )
223  {
224  FW_ASSERT(
225  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
226  static_cast<FwAssertArgType>(portNum)
227  );
228 
229  this->m_eventOut_OutputPort[portNum].addCallPort(port);
230  }
231 
232 #if FW_ENABLE_TEXT_LOGGING == 1
233 
234  void BufferManagerComponentBase ::
235  set_textEventOut_OutputPort(
236  FwIndexType portNum,
238  )
239  {
240  FW_ASSERT(
241  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
242  static_cast<FwAssertArgType>(portNum)
243  );
244 
245  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
246  }
247 
248 #endif
249 
252  FwIndexType portNum,
253  Fw::InputTimePort* port
254  )
255  {
256  FW_ASSERT(
257  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
258  static_cast<FwAssertArgType>(portNum)
259  );
260 
261  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
262  }
263 
266  FwIndexType portNum,
267  Fw::InputTlmPort* port
268  )
269  {
270  FW_ASSERT(
271  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
272  static_cast<FwAssertArgType>(portNum)
273  );
274 
275  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
276  }
277 
278 #if FW_PORT_SERIALIZATION
279 
280  // ----------------------------------------------------------------------
281  // Connect serial input ports to special output ports
282  // ----------------------------------------------------------------------
283 
286  FwIndexType portNum,
287  Fw::InputSerializePort* port
288  )
289  {
290  FW_ASSERT(
291  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
292  static_cast<FwAssertArgType>(portNum)
293  );
294 
295  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
296  }
297 
298 #if FW_ENABLE_TEXT_LOGGING == 1
299 
300  void BufferManagerComponentBase ::
301  set_textEventOut_OutputPort(
302  FwIndexType portNum,
303  Fw::InputSerializePort* port
304  )
305  {
306  FW_ASSERT(
307  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
308  static_cast<FwAssertArgType>(portNum)
309  );
310 
311  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
312  }
313 
314 #endif
315 
318  FwIndexType portNum,
319  Fw::InputSerializePort* port
320  )
321  {
322  FW_ASSERT(
323  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
324  static_cast<FwAssertArgType>(portNum)
325  );
326 
327  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
328  }
329 
332  FwIndexType portNum,
333  Fw::InputSerializePort* port
334  )
335  {
336  FW_ASSERT(
337  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
338  static_cast<FwAssertArgType>(portNum)
339  );
340 
341  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
342  }
343 
344 #endif
345 
346  // ----------------------------------------------------------------------
347  // Component construction and destruction
348  // ----------------------------------------------------------------------
349 
351  BufferManagerComponentBase(const char* compName) :
352  Fw::PassiveComponentBase(compName)
353  {
354  this->m_NoBuffsAvailableThrottle = 0;
355  this->m_NullEmptyBufferThrottle = 0;
356  }
357 
360  {
361 
362  }
363 
364  // ----------------------------------------------------------------------
365  // Connection status queries for special output ports
366  // ----------------------------------------------------------------------
367 
370  {
371  FW_ASSERT(
372  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
373  static_cast<FwAssertArgType>(portNum)
374  );
375 
376  return this->m_eventOut_OutputPort[portNum].isConnected();
377  }
378 
379 #if FW_ENABLE_TEXT_LOGGING == 1
380 
381  bool BufferManagerComponentBase ::
382  isConnected_textEventOut_OutputPort(FwIndexType portNum)
383  {
384  FW_ASSERT(
385  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
386  static_cast<FwAssertArgType>(portNum)
387  );
388 
389  return this->m_textEventOut_OutputPort[portNum].isConnected();
390  }
391 
392 #endif
393 
396  {
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  return this->m_timeCaller_OutputPort[portNum].isConnected();
403  }
404 
407  {
408  FW_ASSERT(
409  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
410  static_cast<FwAssertArgType>(portNum)
411  );
412 
413  return this->m_tlmOut_OutputPort[portNum].isConnected();
414  }
415 
416  // ----------------------------------------------------------------------
417  // Port handler base-class functions for typed input ports
418  //
419  // Call these functions directly to bypass the corresponding ports
420  // ----------------------------------------------------------------------
421 
424  FwIndexType portNum,
425  FwSizeType size
426  )
427  {
428  // Make sure port number is valid
429  FW_ASSERT(
430  (0 <= portNum) && (portNum < this->getNum_bufferGetCallee_InputPorts()),
431  static_cast<FwAssertArgType>(portNum)
432  );
433 
434  Fw::Buffer retVal;
435 
436  // Lock guard mutex before calling
437  this->lock();
438 
439  // Call handler function
440  retVal = this->bufferGetCallee_handler(
441  portNum,
442  size
443  );
444 
445  // Unlock guard mutex
446  this->unLock();
447 
448  return retVal;
449  }
450 
453  FwIndexType portNum,
454  Fw::Buffer& fwBuffer
455  )
456  {
457  // Make sure port number is valid
458  FW_ASSERT(
459  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
460  static_cast<FwAssertArgType>(portNum)
461  );
462 
463  // Lock guard mutex before calling
464  this->lock();
465 
466  // Call handler function
467  this->bufferSendIn_handler(
468  portNum,
469  fwBuffer
470  );
471 
472  // Unlock guard mutex
473  this->unLock();
474  }
475 
478  FwIndexType portNum,
479  U32 context
480  )
481  {
482  // Make sure port number is valid
483  FW_ASSERT(
484  (0 <= portNum) && (portNum < this->getNum_schedIn_InputPorts()),
485  static_cast<FwAssertArgType>(portNum)
486  );
487 
488  // Call handler function
489  this->schedIn_handler(
490  portNum,
491  context
492  );
493  }
494 
495  // ----------------------------------------------------------------------
496  // Event logging functions
497  // ----------------------------------------------------------------------
498 
501  {
502  // Check throttle value
503  if (this->m_NoBuffsAvailableThrottle >= EVENTID_NOBUFFSAVAILABLE_THROTTLE) {
504  return;
505  }
506  else {
507  this->m_NoBuffsAvailableThrottle++;
508  }
509 
510  // Get the time
511  Fw::Time _logTime;
512  if (this->m_timeCaller_OutputPort[0].isConnected()) {
513  this->m_timeCaller_OutputPort[0].invoke(_logTime);
514  }
515 
516  FwEventIdType _id = static_cast<FwEventIdType>(0);
517 
518  _id = this->getIdBase() + EVENTID_NOBUFFSAVAILABLE;
519 
520  // Emit the event on the log port
521  if (this->m_eventOut_OutputPort[0].isConnected()) {
522  Fw::LogBuffer _logBuff;
524 
525 #if FW_AMPCS_COMPATIBLE
526  // Serialize the number of arguments
527  _status = _logBuff.serializeFrom(static_cast<U8>(1));
528  FW_ASSERT(
529  _status == Fw::FW_SERIALIZE_OK,
530  static_cast<FwAssertArgType>(_status)
531  );
532 #endif
533 
534 #if FW_AMPCS_COMPATIBLE
535  // Serialize the argument size
536  _status = _logBuff.serializeFrom(
537  static_cast<U8>(sizeof(FwSizeType))
538  );
539  FW_ASSERT(
540  _status == Fw::FW_SERIALIZE_OK,
541  static_cast<FwAssertArgType>(_status)
542  );
543 #endif
544  _status = _logBuff.serializeFrom(size);
545  FW_ASSERT(
546  _status == Fw::FW_SERIALIZE_OK,
547  static_cast<FwAssertArgType>(_status)
548  );
549 
550  this->m_eventOut_OutputPort[0].invoke(
551  _id,
552  _logTime,
554  _logBuff
555  );
556  }
557 
558  // Emit the event on the text log port
559 #if FW_ENABLE_TEXT_LOGGING
560  if (this->m_textEventOut_OutputPort[0].isConnected()) {
561 #if FW_OBJECT_NAMES == 1
562  const char* _formatString =
563  "(%s) %s: No available buffers of size %" PRIu64 "";
564 #else
565  const char* _formatString =
566  "%s: No available buffers of size %" PRIu64 "";
567 #endif
568 
569  Fw::TextLogString _logString;
570  _logString.format(
571  _formatString,
572 #if FW_OBJECT_NAMES == 1
573  this->m_objName.toChar(),
574 #endif
575  "NoBuffsAvailable ",
576  size
577  );
578 
579  this->m_textEventOut_OutputPort[0].invoke(
580  _id,
581  _logTime,
583  _logString
584  );
585  }
586 #endif
587  }
588 
591  {
592  // Check throttle value
593  if (this->m_NullEmptyBufferThrottle >= EVENTID_NULLEMPTYBUFFER_THROTTLE) {
594  return;
595  }
596  else {
597  this->m_NullEmptyBufferThrottle++;
598  }
599 
600  // Get the time
601  Fw::Time _logTime;
602  if (this->m_timeCaller_OutputPort[0].isConnected()) {
603  this->m_timeCaller_OutputPort[0].invoke(_logTime);
604  }
605 
606  FwEventIdType _id = static_cast<FwEventIdType>(0);
607 
608  _id = this->getIdBase() + EVENTID_NULLEMPTYBUFFER;
609 
610  // Emit the event on the log port
611  if (this->m_eventOut_OutputPort[0].isConnected()) {
612  Fw::LogBuffer _logBuff;
613 
614 #if FW_AMPCS_COMPATIBLE
616  // Serialize the number of arguments
617  _status = _logBuff.serializeFrom(static_cast<U8>(0));
618  FW_ASSERT(
619  _status == Fw::FW_SERIALIZE_OK,
620  static_cast<FwAssertArgType>(_status)
621  );
622 #endif
623 
624  this->m_eventOut_OutputPort[0].invoke(
625  _id,
626  _logTime,
628  _logBuff
629  );
630  }
631 
632  // Emit the event on the text log port
633 #if FW_ENABLE_TEXT_LOGGING
634  if (this->m_textEventOut_OutputPort[0].isConnected()) {
635 #if FW_OBJECT_NAMES == 1
636  const char* _formatString =
637  "(%s) %s: Received null pointer and zero size buffer";
638 #else
639  const char* _formatString =
640  "%s: Received null pointer and zero size buffer";
641 #endif
642 
643  Fw::TextLogString _logString;
644  _logString.format(
645  _formatString,
646 #if FW_OBJECT_NAMES == 1
647  this->m_objName.toChar(),
648 #endif
649  "NullEmptyBuffer "
650  );
651 
652  this->m_textEventOut_OutputPort[0].invoke(
653  _id,
654  _logTime,
656  _logString
657  );
658  }
659 #endif
660  }
661 
662  // ----------------------------------------------------------------------
663  // Event throttle reset functions
664  // ----------------------------------------------------------------------
665 
668  {
669  // Reset throttle counter
670  this->m_NoBuffsAvailableThrottle = 0;
671  }
672 
675  {
676  // Reset throttle counter
677  this->m_NullEmptyBufferThrottle = 0;
678  }
679 
680  // ----------------------------------------------------------------------
681  // Telemetry write functions
682  // ----------------------------------------------------------------------
683 
686  U32 arg,
687  Fw::Time _tlmTime
688  )
689  {
690  // Check to see if it is the first time
691  if (not this->m_first_update_TotalBuffs) {
692  // Check to see if value has changed. If not, don't write it.
693  if (arg == this->m_last_TotalBuffs) {
694  return;
695  }
696  else {
697  this->m_last_TotalBuffs = arg;
698  }
699  }
700  else {
701  this->m_first_update_TotalBuffs = false;
702  this->m_last_TotalBuffs = arg;
703  }
704 
705  if (this->m_tlmOut_OutputPort[0].isConnected()) {
706  if (
707  this->m_timeCaller_OutputPort[0].isConnected() &&
708  (_tlmTime == Fw::ZERO_TIME)
709  ) {
710  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
711  }
712 
713  Fw::TlmBuffer _tlmBuff;
714  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
715  FW_ASSERT(
716  _stat == Fw::FW_SERIALIZE_OK,
717  static_cast<FwAssertArgType>(_stat)
718  );
719 
720  FwChanIdType _id;
721 
722  _id = this->getIdBase() + CHANNELID_TOTALBUFFS;
723 
724  this->m_tlmOut_OutputPort[0].invoke(
725  _id,
726  _tlmTime,
727  _tlmBuff
728  );
729  }
730  }
731 
734  U32 arg,
735  Fw::Time _tlmTime
736  )
737  {
738  // Check to see if it is the first time
739  if (not this->m_first_update_CurrBuffs) {
740  // Check to see if value has changed. If not, don't write it.
741  if (arg == this->m_last_CurrBuffs) {
742  return;
743  }
744  else {
745  this->m_last_CurrBuffs = arg;
746  }
747  }
748  else {
749  this->m_first_update_CurrBuffs = false;
750  this->m_last_CurrBuffs = arg;
751  }
752 
753  if (this->m_tlmOut_OutputPort[0].isConnected()) {
754  if (
755  this->m_timeCaller_OutputPort[0].isConnected() &&
756  (_tlmTime == Fw::ZERO_TIME)
757  ) {
758  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
759  }
760 
761  Fw::TlmBuffer _tlmBuff;
762  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
763  FW_ASSERT(
764  _stat == Fw::FW_SERIALIZE_OK,
765  static_cast<FwAssertArgType>(_stat)
766  );
767 
768  FwChanIdType _id;
769 
770  _id = this->getIdBase() + CHANNELID_CURRBUFFS;
771 
772  this->m_tlmOut_OutputPort[0].invoke(
773  _id,
774  _tlmTime,
775  _tlmBuff
776  );
777  }
778  }
779 
782  U32 arg,
783  Fw::Time _tlmTime
784  )
785  {
786  // Check to see if it is the first time
787  if (not this->m_first_update_HiBuffs) {
788  // Check to see if value has changed. If not, don't write it.
789  if (arg == this->m_last_HiBuffs) {
790  return;
791  }
792  else {
793  this->m_last_HiBuffs = arg;
794  }
795  }
796  else {
797  this->m_first_update_HiBuffs = false;
798  this->m_last_HiBuffs = arg;
799  }
800 
801  if (this->m_tlmOut_OutputPort[0].isConnected()) {
802  if (
803  this->m_timeCaller_OutputPort[0].isConnected() &&
804  (_tlmTime == Fw::ZERO_TIME)
805  ) {
806  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
807  }
808 
809  Fw::TlmBuffer _tlmBuff;
810  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
811  FW_ASSERT(
812  _stat == Fw::FW_SERIALIZE_OK,
813  static_cast<FwAssertArgType>(_stat)
814  );
815 
816  FwChanIdType _id;
817 
818  _id = this->getIdBase() + CHANNELID_HIBUFFS;
819 
820  this->m_tlmOut_OutputPort[0].invoke(
821  _id,
822  _tlmTime,
823  _tlmBuff
824  );
825  }
826  }
827 
830  U32 arg,
831  Fw::Time _tlmTime
832  )
833  {
834  // Check to see if it is the first time
835  if (not this->m_first_update_NoBuffs) {
836  // Check to see if value has changed. If not, don't write it.
837  if (arg == this->m_last_NoBuffs) {
838  return;
839  }
840  else {
841  this->m_last_NoBuffs = arg;
842  }
843  }
844  else {
845  this->m_first_update_NoBuffs = false;
846  this->m_last_NoBuffs = arg;
847  }
848 
849  if (this->m_tlmOut_OutputPort[0].isConnected()) {
850  if (
851  this->m_timeCaller_OutputPort[0].isConnected() &&
852  (_tlmTime == Fw::ZERO_TIME)
853  ) {
854  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
855  }
856 
857  Fw::TlmBuffer _tlmBuff;
858  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
859  FW_ASSERT(
860  _stat == Fw::FW_SERIALIZE_OK,
861  static_cast<FwAssertArgType>(_stat)
862  );
863 
864  FwChanIdType _id;
865 
866  _id = this->getIdBase() + CHANNELID_NOBUFFS;
867 
868  this->m_tlmOut_OutputPort[0].invoke(
869  _id,
870  _tlmTime,
871  _tlmBuff
872  );
873  }
874  }
875 
878  U32 arg,
879  Fw::Time _tlmTime
880  )
881  {
882  // Check to see if it is the first time
883  if (not this->m_first_update_EmptyBuffs) {
884  // Check to see if value has changed. If not, don't write it.
885  if (arg == this->m_last_EmptyBuffs) {
886  return;
887  }
888  else {
889  this->m_last_EmptyBuffs = arg;
890  }
891  }
892  else {
893  this->m_first_update_EmptyBuffs = false;
894  this->m_last_EmptyBuffs = arg;
895  }
896 
897  if (this->m_tlmOut_OutputPort[0].isConnected()) {
898  if (
899  this->m_timeCaller_OutputPort[0].isConnected() &&
900  (_tlmTime == Fw::ZERO_TIME)
901  ) {
902  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
903  }
904 
905  Fw::TlmBuffer _tlmBuff;
906  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
907  FW_ASSERT(
908  _stat == Fw::FW_SERIALIZE_OK,
909  static_cast<FwAssertArgType>(_stat)
910  );
911 
912  FwChanIdType _id;
913 
914  _id = this->getIdBase() + CHANNELID_EMPTYBUFFS;
915 
916  this->m_tlmOut_OutputPort[0].invoke(
917  _id,
918  _tlmTime,
919  _tlmBuff
920  );
921  }
922  }
923 
924  // ----------------------------------------------------------------------
925  // Time
926  // ----------------------------------------------------------------------
927 
929  getTime() const
930  {
931  if (this->m_timeCaller_OutputPort[0].isConnected()) {
932  Fw::Time _time;
933  this->m_timeCaller_OutputPort[0].invoke(_time);
934  return _time;
935  }
936  else {
937  return Fw::Time(TimeBase::TB_NONE, 0, 0);
938  }
939  }
940 
941  // ----------------------------------------------------------------------
942  // Mutex operations for guarded ports
943  //
944  // You can override these operations to provide more sophisticated
945  // synchronization
946  // ----------------------------------------------------------------------
947 
950  {
951  this->m_guardedPortMutex.lock();
952  }
953 
956  {
957  this->m_guardedPortMutex.unLock();
958  }
959 
960  // ----------------------------------------------------------------------
961  // Calls for messages received on typed input ports
962  // ----------------------------------------------------------------------
963 
964  Fw::Buffer BufferManagerComponentBase ::
965  m_p_bufferGetCallee_in(
966  Fw::PassiveComponentBase* callComp,
967  FwIndexType portNum,
968  FwSizeType size
969  )
970  {
971  FW_ASSERT(callComp);
972  BufferManagerComponentBase* compPtr = static_cast<BufferManagerComponentBase*>(callComp);
973  return compPtr->bufferGetCallee_handlerBase(
974  portNum,
975  size
976  );
977  }
978 
979  void BufferManagerComponentBase ::
980  m_p_bufferSendIn_in(
981  Fw::PassiveComponentBase* callComp,
982  FwIndexType portNum,
983  Fw::Buffer& fwBuffer
984  )
985  {
986  FW_ASSERT(callComp);
987  BufferManagerComponentBase* compPtr = static_cast<BufferManagerComponentBase*>(callComp);
988  compPtr->bufferSendIn_handlerBase(
989  portNum,
990  fwBuffer
991  );
992  }
993 
994  void BufferManagerComponentBase ::
995  m_p_schedIn_in(
996  Fw::PassiveComponentBase* callComp,
997  FwIndexType portNum,
998  U32 context
999  )
1000  {
1001  FW_ASSERT(callComp);
1002  BufferManagerComponentBase* compPtr = static_cast<BufferManagerComponentBase*>(callComp);
1003  compPtr->schedIn_handlerBase(
1004  portNum,
1005  context
1006  );
1007  }
1008 
1009 }
void log_WARNING_HI_NoBuffsAvailable(FwSizeType size)
Serialization/Deserialization operation was successful.
static constexpr FwIndexType getNum_bufferGetCallee_InputPorts()
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
virtual ~BufferManagerComponentBase()
Destroy BufferManagerComponentBase object.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
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.
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
static constexpr FwIndexType getNum_schedIn_InputPorts()
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
const Time ZERO_TIME
Definition: Time.cpp:5
virtual void bufferSendIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendIn.
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
No time base has been established (Required)
The buffer manager received a null pointer and zero-sized buffer as a return. Probably undetected fai...
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
Fw::InputBufferSendPort * get_bufferSendIn_InputPort(FwIndexType portNum)
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
FwIdType FwEventIdType
The type of an event identifier.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void init()
Initialization function.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void log_WARNING_HI_NoBuffsAvailable_ThrottleClear()
Reset throttle value for NoBuffsAvailable.
Fw::InputBufferGetPort * get_bufferGetCallee_InputPort(FwIndexType portNum)
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
FwIdType FwChanIdType
The type of a telemetry channel identifier.
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
The BufferManager was unable to allocate a requested buffer.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
A serious but recoverable event.
void tlmWrite_NoBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:38
static constexpr FwIndexType getNum_bufferSendIn_InputPorts()
void tlmWrite_CurrBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_HiBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
virtual void unLock()
Unlock the guarded mutex.
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void setPortNum(FwIndexType portNum)
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void tlmWrite_TotalBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
virtual void lock()
Lock the guarded mutex.
void init()
Initialization function.
static constexpr FwIndexType getNum_eventOut_OutputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
void tlmWrite_EmptyBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
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.
Implementation of malloc based allocator.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
#define FW_ASSERT(...)
Definition: Assert.hpp:14
BufferManagerComponentBase(const char *compName="")
Construct BufferManagerComponentBase object.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34