BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlma_memoryblockdescriptor

Detailed Description

Outline

Purpose

Provide a class describing a block of memory.

Classes

See also

Description

This component defines an in-core value-semantic class for describing a block of memory, namely bdlma::MemoryBlockDescriptor. Each descriptor object contains the address of the block of memory and the size of the block. The distinguished "null" descriptor contains an address and a size that are both 0.

Usage

This section illustrates intended use of this component.

Example 1: Basic Usage

This example demonstrates how to create and test the state of a bdlma::MemoryBlockDescriptor.

char buffer[100];
bdlma::MemoryBlockDescriptor a(buffer, sizeof buffer);
assert(!a.isNull());
assert(buffer == a.address());
assert(sizeof buffer == a.size());
assert( b.isNull());
assert(0 == b.address());
assert(0 == b.size());
assert(a != b);
b = a;
assert(!b.isNull());
assert(buffer == b.address());
assert(sizeof buffer == b.size());
assert(a == b);
Definition bdlma_memoryblockdescriptor.h:110
size_type size() const
Return the size of the memory block described by this object.
Definition bdlma_memoryblockdescriptor.h:246
bool isNull() const
Definition bdlma_memoryblockdescriptor.h:252
void * address() const
Definition bdlma_memoryblockdescriptor.h:239