libnebular::Blob Class Reference
[User API]

Binary Long OBject. More...

#include <libnebular.hpp>

List of all members.

Classes

class  Impl_

Public Member Functions

char * getDataReadWrite ()
 Data with read-write access.
const char * getDataReadOnly () const
 Data with read-only access.
size_t getDataHash () const
 Data hash.
Integer getDataRoom () const
 Current memory room size (maximum allowed data size that can be achieved without memory reallocations).
void setDataSize (Integer newSize)
 Sets size information about data.
Integer getDataSize () const
 Data size.
void mAlloc (Integer newSize)
 Allocates memory by C++ new operator.
void attach (void *newMemory, Integer newDataRoom)
 Attach memory with given size newDataRoom, but don't own it.
void prepareForSize (Integer newDataSize)
 Reallocates memory for demanded size (if can) and sets this size to Blob.
bool isCanBeReroomed () const
 Whether we can change memory room size.
void assign (Integer newSize, const char *newData)
 Assigns new data newData with size newSize.
bool isSubseqFromCurPos (std::istream &inStream) const
 Whether std::istream inStream elements are subsequence (starting from current inStream position) of *this.
void cleanupData ()
 Cleans up data, frees allocated memory.
void forsakeData ()
 Says that data aren't meaningful for us.
 Blob (Integer newSize, const char *newData)
 Assigns newData with newSize to newly-constructed Blob.
 Blob ()
 ~Blob ()

Static Public Member Functions

static Blob createAndMAlloc (Integer newSize)
 Creates Blob with some memory allocated by C++ new.
static Blob createAndAttach (void *newMemory, Integer newDataRoom)
 Creates Blob with some memory attached.

Detailed Description

Binary Long OBject.

"Consists of" char elements. Shared ownership, copy on demand.

All memory operations seems to be safe (because of boost::shared_ptr usage) unless you don't destroy "attached" memory region by yourself.

Design note:
It's good to store actual data size here too (I could store that only in property map... Although i choose also here.)

CopyConstructible. Default copy constructor is used.

Assignable. Default assignment is used.

Definition at line 159 of file libnebular.hpp.


Constructor & Destructor Documentation

libnebular::Blob::Blob ( Integer  newSize,
const char *  newData 
)

Assigns newData with newSize to newly-constructed Blob.

Definition at line 181 of file picture-prop-container.cpp.

Here is the call graph for this function:

libnebular::Blob::Blob (  ) 

Definition at line 175 of file picture-prop-container.cpp.

libnebular::Blob::~Blob (  ) 

Definition at line 189 of file picture-prop-container.cpp.


Member Function Documentation

void libnebular::Blob::assign ( Integer  newSize,
const char *  newData 
)

Assigns new data newData with size newSize.

Memory is reallocated when needed (as in prepareForSize())

Definition at line 152 of file picture-prop-container.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void libnebular::Blob::attach ( void *  newMemory,
Integer  newDataRoom 
)

Attach memory with given size newDataRoom, but don't own it.

Definition at line 124 of file picture-prop-container.cpp.

Here is the caller graph for this function:

void libnebular::Blob::cleanupData (  ) 

Cleans up data, frees allocated memory.

Definition at line 98 of file picture-prop-container.cpp.

Here is the caller graph for this function:

Blob libnebular::Blob::createAndAttach ( void *  newMemory,
Integer  newDataRoom 
) [static]

Creates Blob with some memory attached.

Definition at line 196 of file picture-prop-container.cpp.

Here is the call graph for this function:

Blob libnebular::Blob::createAndMAlloc ( Integer  newSize  )  [static]

Creates Blob with some memory allocated by C++ new.

Definition at line 191 of file picture-prop-container.cpp.

Here is the call graph for this function:

void libnebular::Blob::forsakeData (  ) 

Says that data aren't meaningful for us.

If there are data and they are shared with other Blob (remember copy-on-demand strategy), *this declines data ownership by cleanupData().

Used before reuse data room to ensure that reuse is safe or, otherwise, give up reuse.

Definition at line 92 of file picture-prop-container.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

size_t libnebular::Blob::getDataHash (  )  const

Data hash.

Currently computed by boost::hash_range().

Definition at line 81 of file picture-prop-container.cpp.

Here is the call graph for this function:

const char * libnebular::Blob::getDataReadOnly (  )  const

Data with read-only access.

Definition at line 77 of file picture-prop-container.cpp.

Here is the caller graph for this function:

char * libnebular::Blob::getDataReadWrite (  ) 

Data with read-write access.

Definition at line 59 of file picture-prop-container.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Integer libnebular::Blob::getDataRoom (  )  const

Current memory room size (maximum allowed data size that can be achieved without memory reallocations).

Definition at line 88 of file picture-prop-container.cpp.

Here is the caller graph for this function:

Integer libnebular::Blob::getDataSize (  )  const

Data size.

Definition at line 105 of file picture-prop-container.cpp.

Here is the caller graph for this function:

bool libnebular::Blob::isCanBeReroomed (  )  const

Whether we can change memory room size.

Note:
In Blob::prepareForSize() there's assumed that it's true only when memory is Blob::mAlloc()-ed and not Blob::attach()-ed.

Definition at line 148 of file picture-prop-container.cpp.

Here is the caller graph for this function:

bool libnebular::Blob::isSubseqFromCurPos ( std::istream &  inStream  )  const

Whether std::istream inStream elements are subsequence (starting from current inStream position) of *this.

Definition at line 157 of file picture-prop-container.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void libnebular::Blob::mAlloc ( Integer  newSize  ) 

Allocates memory by C++ new operator.

Definition at line 116 of file picture-prop-container.cpp.

Here is the caller graph for this function:

void libnebular::Blob::prepareForSize ( Integer  newDataSize  ) 

Reallocates memory for demanded size (if can) and sets this size to Blob.

Will reallocate even if there is enough room (for memory saving reasons).

If there's no ability to reallocate memory (in case when memory was attach()-ed), Error is thrown

There's assumption that it's true only when memory is Blob::mAlloc()-ed and not Blob::attach()-ed.

Definition at line 132 of file picture-prop-container.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void libnebular::Blob::setDataSize ( Integer  newSize  ) 

Sets size information about data.

Attention:
Dangerous; try to use prepareForSize() instead

Definition at line 109 of file picture-prop-container.cpp.

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Sun May 29 18:23:57 2011 for libnebular by  doxygen 1.6.3