8#ifndef INCLUDED_BDLBB_BLOB
9#define INCLUDED_BDLBB_BLOB
422#include <bdlscm_version.h>
433#include <bsl_iosfwd.h>
434#include <bsl_memory.h>
435#include <bsl_vector.h>
437#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
568 bsl::ostream&
print(bsl::ostream& stream,
570 int spacesPerLevel = 4)
const;
662 int d_preDataIndexLength;
686 void slowSetLength(
int length);
691 int assertInvariants()
const;
1073: d_buffer(original.d_buffer)
1074, d_size(original.d_size)
1081: d_buffer(MoveUtil::move(MoveUtil::access(original).d_buffer))
1082, d_size(MoveUtil::move(MoveUtil::access(original).d_size))
1084 MoveUtil::access(original).d_size = 0;
1117 return d_buffer.
get();
1131 return lhs.d_buffer.get() == rhs.d_buffer.get() &&
1132 lhs.d_size == rhs.d_size;
1138 return lhs.d_buffer.get() != rhs.d_buffer.get() ||
1139 lhs.d_size != rhs.d_size;
1183 size_t newCapacity =
static_cast<size_t>(
numBuffers);
1184 if (newCapacity > d_buffers.capacity()) {
1185 size_t geometric = d_buffers.capacity() * 2;
1186 newCapacity = geometric > newCapacity ? geometric : newCapacity;
1187 d_buffers.reserve(newCapacity);
1195 return d_buffers.get_allocator().mechanism();
1204 return d_buffers[index];
1210 return d_bufferFactory_p;
1216 return d_dataLength - d_preDataIndexLength;
1222 return d_dataLength;
1228 return static_cast<int>(d_buffers.size());
1234 return d_dataIndex + 1;
Definition bdlbb_blob.h:616
virtual ~BlobBufferFactory()
Destroy this blob buffer factory.
virtual void allocate(BlobBuffer *buffer)=0
Definition bdlbb_blob.h:455
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
BlobBuffer trim(int toSize)
void reset(bslmf::MovableRef< bsl::shared_ptr< char > > buffer, int size)
bsl::shared_ptr< char > & buffer()
Definition bdlbb_blob.h:1094
void reset(const bsl::shared_ptr< char > &buffer, int size)
void reset()
Reset this blob buffer to its default-constructed state.
friend bool operator!=(const BlobBuffer &, const BlobBuffer &)
~BlobBuffer()
Destroy this blob buffer.
Definition bdlbb_blob.h:1088
BlobBuffer()
Definition bdlbb_blob.h:1047
friend bool operator==(const BlobBuffer &, const BlobBuffer &)
BlobBuffer & operator=(const BlobBuffer &rhs)
char * data() const
Definition bdlbb_blob.h:1115
BlobBuffer & operator=(bslmf::MovableRef< BlobBuffer > rhs)
int size() const
Return the size of the buffer represented by this object.
Definition bdlbb_blob.h:1121
void setSize(int size)
Definition bdlbb_blob.h:1100
void swap(BlobBuffer &other)
Definition bdlbb_blob.h:642
void prependDataBuffer(const BlobBuffer &buffer)
Definition bdlbb_blob.h:1171
int lastDataBufferLength() const
Definition bdlbb_blob.h:1214
void removeAll()
Remove all blob buffers from this blob, and set its length to 0.
int length() const
Return the length of this blob.
Definition bdlbb_blob.h:1220
bslma::Allocator * allocator() const
Return the allocator used by this object to supply memory.
Definition bdlbb_blob.h:1193
int numDataBuffers() const
Return the number of blob buffers containing data in this blob.
Definition bdlbb_blob.h:1232
friend bool operator==(const Blob &, const Blob &)
void removeBuffer(int index)
Blob(BlobBufferFactory *factory, bslma::Allocator *basicAllocator=0)
Blob(bslma::Allocator *basicAllocator=0)
void insertBuffer(int index, bslmf::MovableRef< BlobBuffer > buffer)
const BlobBuffer & buffer(int index) const
Definition bdlbb_blob.h:1199
void appendDataBuffer(bslmf::MovableRef< BlobBuffer > buffer)
Blob(const BlobBuffer *buffers, int numBuffers, BlobBufferFactory *factory, bslma::Allocator *basicAllocator=0)
void moveAndAppendDataBuffers(Blob *srcBlob)
void appendBuffer(bslmf::MovableRef< BlobBuffer > buffer)
void insertBuffer(int index, const BlobBuffer &buffer)
Definition bdlbb_blob.h:1164
void moveBuffers(Blob *srcBlob)
Blob(bslmf::MovableRef< Blob > original) BSLS_KEYWORD_NOEXCEPT
int numBuffers() const
Return the number of blob buffers held by this blob.
Definition bdlbb_blob.h:1226
BlobBuffer trimLastDataBuffer()
Blob(const Blob &original, bslma::Allocator *basicAllocator=0)
void appendDataBuffer(const BlobBuffer &buffer)
Definition bdlbb_blob.h:1157
friend bool operator!=(const Blob &, const Blob &)
void appendBuffer(const BlobBuffer &buffer)
Definition bdlbb_blob.h:1150
Blob(bslmf::MovableRef< Blob > original, bslma::Allocator *basicAllocator)
Blob & operator=(bslmf::MovableRef< Blob > rhs)
void moveDataBuffers(Blob *srcBlob)
Blob & operator=(const Blob &rhs)
void prependDataBuffer(bslmf::MovableRef< BlobBuffer > buffer)
~Blob()
Destroy this blob.
Blob(const Blob &original, BlobBufferFactory *factory, bslma::Allocator *basicAllocator=0)
void removeUnusedBuffers()
int totalSize() const
Definition bdlbb_blob.h:1238
void setLength(int length)
void replaceDataBuffer(int index, const BlobBuffer &buffer)
BlobBufferFactory * factory() const
Return the factory used by this object.
Definition bdlbb_blob.h:1208
void reserveBufferCapacity(int numBuffers)
Definition bdlbb_blob.h:1178
void removeBuffers(int index, int numBuffers)
void swapBufferRaw(int index, BlobBuffer *srcBuffer)
Definition bslstl_sharedptr.h:1830
element_type * get() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_sharedptr.h:5574
Definition bslstl_vector.h:1025
AllocatorTraits::size_type size_type
Definition bslstl_vector.h:1052
Definition bslma_allocator.h:457
Definition bslmf_movableref.h:751
#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
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
Definition bdlbb_blob.h:442
bsl::ostream & operator<<(bsl::ostream &stream, const BlobBuffer &buffer)
bool operator!=(const BlobBuffer &lhs, const BlobBuffer &rhs)
bool operator==(const BlobBuffer &lhs, const BlobBuffer &rhs)
Definition balxml_encoderoptions.h:68
Definition bdlbb_blob.h:576
Definition bslma_usesbslmaallocator.h:343
Definition bslmf_isbitwisemoveable.h:718
Definition bslmf_movableref.h:791
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1060