Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBBlob


RWDBBlob RWCollectable

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/db/blob.h>

RWDBBlob b;          // default; zero capacity and length
RWDBBlob b(2048);
RWDBBlob b((void*)&myGif.data(),myGif.size());

Description

Most database vendors supply one or more datatypes that can store binary data of any length. These datatypes are commonly known as Binary Large Objects, or Blobs. DBTools.h++ stores data of these types as RWDBBlob. Class RWDBBlob provides storage and rudimentary access to the binary data. Applications may want to derive from RWDBBlob to add semantics to the data.

This class is implemented using a technique called copy on write. With this technique, the copy constructor and assignment operators still reference the old object and hence are very fast. An actual copy is made only when a write is performed, that is, if the object is about to be changed. The net result is excellent performance, but with easy-to-understand value semantics.

The member function putBytes() is used to populate an RWDBBlob. This method is safe and robust, but can be inconvenient in cases where large objects have already been loaded into memory. The constructor RWDBBlob(void* data, size_t length) is provided to allow applications to wrap existing data blocks in an RWDBBlob interface. Blobs built with this constructor do not manage the memory addressed by the data pointer; your application continues to be responsible for it.

RWDBBlob inherits from class RWCollectable. The virtual functions of the base class RWCollectable have been redefined.

Public Constructors

RWDBBlob();
RWDBBlob(size_t size);
RWDBBlob(void* data, size_t length);
RWDBBlob(const RWDBBlob& blob);

Public Member Operator

virtual RWDBBlob&
operator=(const RWDBBlob& blob);

Public Member Functions

void
acquire() const;
virtual RWspace
binaryStoreSize()const;
size_t
capacity()const;
void
clear(size_t size=0);
virtual int
compareTo(const RWCollectable* c) const; 
unsigned char*
data() const;
void
getBytes(void* buffer, size_t size, 
         size_t offset = 0) const; 
virtual unsigned
hash()const;
virtual RWClassID
isA()const;
virtual RWBoolean
isEqual(const RWCollectable* c) const;
size_t
length() const;
void
putBytes(const void* buffer, size_t size, size_t offset = 0
         size_t resize = 256);
void
release() const;
virtual void
restoreGuts(RWFile& file) const;
virtual void
restoreGuts(RWvistream& stream) const;
virtual void
saveGuts(RWFile& file) const;
virtual void
saveGuts(RWvostream& stream) const;


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.