8#ifndef INCLUDED_BDLMA_BUFFERMANAGER
9#define INCLUDED_BDLMA_BUFFERMANAGER
280#include <bdlscm_version.h>
319 unsigned char d_alignmentAndMask;
322 unsigned char d_alignmentOrMask;
377 template <
class TYPE>
383 template <
class TYPE>
485, d_alignmentAndMask( strategy !=
bsls::Alignment::BSLS_MAXIMUM
486 ?
bsls::AlignmentUtil::BSLS_MAX_ALIGNMENT - 1
488, d_alignmentOrMask( strategy !=
bsls::Alignment::BSLS_BYTEALIGNED
489 ?
bsls::AlignmentUtil::BSLS_MAX_ALIGNMENT
495BufferManager::BufferManager(
char *buffer,
499, d_bufferSize(bufferSize)
501, d_alignmentAndMask( strategy !=
bsls::Alignment::BSLS_MAXIMUM
502 ?
bsls::AlignmentUtil::BSLS_MAX_ALIGNMENT - 1
504, d_alignmentOrMask( strategy !=
bsls::Alignment::BSLS_BYTEALIGNED
505 ?
bsls::AlignmentUtil::BSLS_MAX_ALIGNMENT
518 || (0 == d_buffer_p && 0 == d_bufferSize));
529 char *address = d_buffer_p + d_cursor;
538 return address + offset;
553 char *address = d_buffer_p + d_cursor;
557 d_cursor = d_cursor + offset + size;
558 return address + offset;
566#ifndef BSLS_PLATFORM_CMP_SUN
569 const_cast<TYPE *
>(object)->~TYPE();
588 char *oldBuffer = d_buffer_p;
589 d_buffer_p = newBuffer;
590 d_bufferSize = newBufferSize;
615 : 1 == d_alignmentOrMask
646 return static_cast<int>(
660 char *address = d_buffer_p + d_cursor;
664 return d_cursor + offset + size <= d_bufferSize;
Definition bdlma_buffermanager.h:307
char * replaceBuffer(char *newBuffer, bsls::Types::size_type newBufferSize)
Definition bdlma_buffermanager.h:582
bsls::Types::size_type truncate(void *address, bsls::Types::size_type originalSize, bsls::Types::size_type newSize)
void reset()
Definition bdlma_buffermanager.h:603
~BufferManager()
Destroy this buffer manager.
Definition bdlma_buffermanager.h:513
void * allocateRaw(bsls::Types::size_type size)
Definition bdlma_buffermanager.h:545
bool hasSufficientCapacity(bsls::Types::size_type size) const
Definition bdlma_buffermanager.h:652
int calculateAlignmentOffsetFromSize(const void *address, bsls::Types::size_type size) const
Definition bdlma_buffermanager.h:633
void deleteObject(const TYPE *object)
Definition bdlma_buffermanager.h:576
bsls::Types::size_type bufferSize() const
Definition bdlma_buffermanager.h:627
void release()
Definition bdlma_buffermanager.h:597
bsls::Alignment::Strategy alignmentStrategy() const
Definition bdlma_buffermanager.h:612
void deleteObjectRaw(const TYPE *object)
Definition bdlma_buffermanager.h:563
bsls::Types::size_type expand(void *address, bsls::Types::size_type size)
char * buffer() const
Definition bdlma_buffermanager.h:621
void * allocate(bsls::Types::size_type size)
Definition bdlma_buffermanager.h:523
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlma_alignedallocator.h:276
Definition bdlt_iso8601util.h:691
Strategy
Types of alignment strategy.
Definition bsls_alignment.h:239
@ BSLS_NATURAL
Definition bsls_alignment.h:246
@ BSLS_MAXIMUM
Definition bsls_alignment.h:242
@ BSLS_BYTEALIGNED
Definition bsls_alignment.h:250
std::size_t size_type
Definition bsls_types.h:124
std::ptrdiff_t IntPtr
Definition bsls_types.h:130