28 const char *
const compName
59 if (not this->m_cleaned) {
62 this->m_buffers[entry].buff.~Buffer();
64 this->m_cleaned =
true;
66 this->m_allocator->
deallocate(this->m_memId,this->m_buffers);
67 this->m_setup =
false;
76 void BufferManagerComponentImpl ::
94 U32
id = context & 0xFFFF;
95 U32 mgrId = context >> 16;
98 id < this->m_numStructs,
102 mgrId == this->m_mgrId,
107 true == this->m_buffers[
id].allocated,
111 reinterpret_cast<U8*
>(fwBuffer.
getData()) >= this->m_buffers[
id].memory,
115 reinterpret_cast<U8*
>(fwBuffer.
getData()) < (this->m_buffers[
id].memory + this->m_buffers[
id].size),
120 fwBuffer.
getSize() <= this->m_buffers[
id].size,
124 this->m_buffers[id].allocated =
false;
129 bufferGetCallee_handler(
139 if ((not this->m_buffers[buff].allocated) and (size <= this->m_buffers[buff].size)) {
140 this->m_buffers[buff].allocated =
true;
142 if (this->m_currBuffs > this->m_highWater) {
143 this->m_highWater = this->m_currBuffs;
166 this->m_mgrId = mgrId;
167 this->m_memId = memId;
168 this->m_allocator = &allocator;
170 memset(&this->m_bufferBins,0,
sizeof(this->m_bufferBins));
172 this->m_bufferBins = bins;
176 this->m_numStructs = 0;
188 bool recoverable =
false;
191 void *memory = allocator.
allocate(memId,allocatedSize,recoverable);
195 memorySize == allocatedSize,
199 this->m_buffers =
static_cast<AllocatedBuffer*
>(memory);
202 U8* bufferMem =
reinterpret_cast<U8*
>(&this->m_buffers[this->m_numStructs]);
211 U32 context = (this->m_mgrId << 16) | currStruct;
212 (void)
new(&this->m_buffers[currStruct].buff)
Fw::Buffer(bufferMem,this->m_bufferBins.
bins[bin].
bufferSize,context);
213 this->m_buffers[currStruct].allocated =
false;
214 this->m_buffers[currStruct].memory = bufferMem;
215 this->m_buffers[currStruct].size = this->m_bufferBins.
bins[bin].
bufferSize;
223 U8*
const CURR_PTR = bufferMem;
224 U8*
const END_PTR =
static_cast<U8*
>(memory) + memorySize;
230 currStruct == this->m_numStructs,
234 this->m_setup =
true;
237 void BufferManagerComponentImpl ::
PlatformPointerCastType POINTER_CAST
PlatformIntType NATIVE_INT_TYPE
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
PlatformAssertArgType FwAssertArgType
C++-compatible configuration header for fprime configuration.
virtual void deallocate(const NATIVE_UINT_TYPE identifier, void *ptr)=0
Deallocate memory.
virtual void * allocate(const NATIVE_UINT_TYPE identifier, NATIVE_UINT_TYPE &size, bool &recoverable)=0
Allocate memory.
Auto-generated base for BufferManager component.
void log_WARNING_HI_ZeroSizeBuffer()
void tlmWrite_HiBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_NoBuffsAvailable(U32 size)
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 tlmWrite_CurrBuffs(U32 arg, Fw::Time _tlmTime=Fw::Time())
~BufferManagerComponentImpl()
void setup(NATIVE_UINT_TYPE mgrID, NATIVE_UINT_TYPE memID, Fw::MemAllocator &allocator, const BufferBins &bins)
set up configuration
BufferManagerComponentImpl(const char *const compName)
static const NATIVE_UINT_TYPE BUFFERMGR_MAX_NUM_BINS
NATIVE_UINT_TYPE numBuffers
number of buffers in this bin. Set to zero for unused bins.
NATIVE_UINT_TYPE bufferSize
size of the buffers in this bin. Set to zero for unused bins.
BufferBin bins[BUFFERMGR_MAX_NUM_BINS]
set of bins to define buffers