#include <ustl.h>
Inheritance diagram for ustl::memlink:
Public Types | |
typedef value_type * | pointer |
typedef cmemlink::pointer | const_pointer |
typedef cmemlink::const_iterator | const_iterator |
typedef pointer | iterator |
Public Member Functions | |
memlink (void) | |
Initializes both links to point to NULL,0. | |
memlink (void *p, size_type n) | |
Initializes both links to point to p , n . | |
memlink (const void *p, size_type n) | |
Initializes the const link to point to p , n . Non-const link is NULL. | |
memlink (const memlink &l) | |
Copies information from l . | |
memlink (const cmemlink &l) | |
Copies information from l . | |
void | link (const void *p, size_type n) |
Attaches the object to pointer p of size n . | |
void | link (void *p, size_type n) |
Initializes both links to point to p , n . | |
void | link (const cmemlink &l) |
Links to l . | |
void | link (memlink &l) |
Links to l . | |
void | link (const void *first, const void *last) |
Links to iterator range first - last . | |
void | link (void *first, void *last) |
Links to iterator range first - last . | |
virtual void | unlink (void) |
Resets all members to 0. | |
void | copy (const cmemlink &l) |
Copies from l . | |
void | copy (const void *p, size_type n) |
Copies begin from p , n to the linked block. | |
void | copy (iterator offset, const void *p, size_type n) |
Copies data from p , n to the linked block starting at start . | |
pointer | data (void) |
Returns a modifiable pointer to the block. | |
size_type | writable_size (void) const |
Returns the size of the writable area. | |
const memlink & | operator= (const cmemlink &l) |
Copies information from l . | |
const memlink & | operator= (const memlink &l) |
Copies information from l . | |
void | swap (memlink &l) |
Exchanges the contents with l . | |
iterator | begin (void) |
Returns a modifiable pointer to the block. | |
iterator | end (void) |
Returns a modifiable pointer to the end of the block. | |
const_iterator | begin (void) const |
Returns a const pointer to the block. | |
const_iterator | end (void) const |
Returns a const pointer to the end of the block. | |
void | fill (iterator start, const void *p, size_type elsize, size_type elCount=1) |
void | insert (iterator start, size_type size) |
void | erase (iterator start, size_type size) |
void | read (istream &is) |
Reads the object from stream s . | |
Protected Member Functions | |
virtual void | constructBlock (void *, size_type) const |
Override to initialize malloc'ed space, like calling constructors, for example. | |
virtual void | destructBlock (void *, size_type) const |
Override to deinitialize malloc'ed space, like calling destructors, for example. |
Use this class the way you would a pointer to an allocated unstructured block. The pointer and block size are available through member functions and cast operator. The begin in the block may be modified, but the block is static in size.
void* p = malloc (46721); memlink a, b; a.link (p, 46721); assert (a.size() == 46721)); b = a; assert (b.size() == 46721)); assert (b.begin() + 34 == a.begin + 34); assert (0 == memcmp (a, b, 12)); a.fill (673, b, 42, 67); b.erase (87, 12);
|
Shifts the data in the linked block from Reimplemented in ustl::memblock, ustl::ostream, ustl::string, ustl::vector< T >, and ustl::vector< pair< K, V > >. |
|
Fills the linked block with the given pattern.
|
|
Shifts the data in the linked block from Reimplemented in ustl::memblock, and ustl::ostream. |
|
Attaches the object to pointer
If Reimplemented from ustl::cmemlink. Reimplemented in ustl::vector< T >, and ustl::vector< pair< K, V > >. |