Powered by Pair ImageMagick logo
Image Magick
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

Magick::Blob Class Reference

#include <Blob.h>

Inheritance diagram for Magick::Blob:

Inheritance graph
[legend]
Collaboration diagram for Magick::Blob:

Collaboration graph
[legend]

Public Types

enum  Allocator { MallocAllocator, NewAllocator }
enum  Allocator { MallocAllocator, NewAllocator }

Public Member Functions

 Blob (void)
 Blob (const void *data_, size_t length_)
 Blob (const Blob &blob_)
virtual ~Blob ()
Bloboperator= (const Blob &blob_)
void base64 (const std::string base64_)
std::string base64 (void)
void update (const void *data_, size_t length_)
void updateNoCopy (void *data_, size_t length_, Allocator allocator_=NewAllocator)
const void * data (void) const
size_t length (void) const
 Blob (void)
 Blob (const void *data_, size_t length_)
 Blob (const Blob &blob_)
virtual ~Blob ()
Bloboperator= (const Blob &blob_)
void base64 (const std::string base64_)
std::string base64 (void)
void update (const void *data_, size_t length_)
void updateNoCopy (void *data_, size_t length_, Allocator allocator_=NewAllocator)
const void * data (void) const
size_t length (void) const

Private Attributes

BlobRef_blobRef
BlobRef_blobRef

Member Enumeration Documentation

enum Magick::Blob::Allocator
 

Enumeration values:
MallocAllocator 
NewAllocator 

Definition at line 24 of file Blob.h.

00025 { 00026 MallocAllocator, 00027 NewAllocator 00028 };

enum Magick::Blob::Allocator
 

Enumeration values:
MallocAllocator 
NewAllocator 

Definition at line 24 of file Blob.h.

00025 { 00026 MallocAllocator, 00027 NewAllocator 00028 };


Constructor & Destructor Documentation

Magick::Blob::Blob void   ) 
 

Definition at line 21 of file Blob.cpp.

00022 : _blobRef(new Magick::BlobRef( 0, 0 )) 00023 { 00024 }

Magick::Blob::Blob const void *  data_,
size_t  length_
 

Definition at line 27 of file Blob.cpp.

00028 : _blobRef(new Magick::BlobRef( data_, length_ )) 00029 { 00030 }

Magick::Blob::Blob const Blob blob_  ) 
 

Definition at line 33 of file Blob.cpp.

References _blobRef, Magick::BlobRef::_mutexLock, and Magick::BlobRef::_refCount.

00034 : _blobRef(blob_._blobRef) 00035 { 00036 // Increase reference count 00037 Lock( &_blobRef->_mutexLock ); 00038 ++_blobRef->_refCount; 00039 }

Magick::Blob::~Blob  )  [virtual]
 

Definition at line 42 of file Blob.cpp.

References _blobRef, Magick::BlobRef::_mutexLock, and Magick::BlobRef::_refCount.

00043 { 00044 bool doDelete = false; 00045 { 00046 Lock( &_blobRef->_mutexLock ); 00047 if ( --_blobRef->_refCount == 0 ) 00048 doDelete = true; 00049 } 00050 00051 if ( doDelete ) 00052 { 00053 // Delete old blob reference with associated data 00054 delete _blobRef; 00055 } 00056 _blobRef=0; 00057 }

Magick::Blob::Blob void   ) 
 

Magick::Blob::Blob const void *  data_,
size_t  length_
 

Magick::Blob::Blob const Blob blob_  ) 
 

virtual Magick::Blob::~Blob  )  [virtual]
 


Member Function Documentation

std::string Magick::Blob::base64 void   ) 
 

void Magick::Blob::base64 const std::string  base64_  ) 
 

std::string Magick::Blob::base64 void   ) 
 

Definition at line 97 of file Blob.cpp.

References Base64Encode(), data(), length(), and RelinquishMagickMemory().

00098 { 00099 size_t encoded_length = 0; 00100 00101 char *encoded = 00102 Base64Encode(static_cast<const unsigned char*>(data()), length(), &encoded_length); 00103 00104 if(encoded) 00105 { 00106 std::string result(encoded,encoded_length); 00107 encoded=(char *) RelinquishMagickMemory(encoded); 00108 return result; 00109 } 00110 00111 return std::string(); 00112 }

Here is the call graph for this function:

void Magick::Blob::base64 const std::string  base64_  ) 
 

Definition at line 84 of file Blob.cpp.

References Base64Decode(), length(), MallocAllocator, and updateNoCopy().

00085 { 00086 size_t length; 00087 00088 unsigned char *decoded = 00089 Base64Decode( base64_.c_str(), &length ); 00090 00091 if(decoded) 00092 updateNoCopy( static_cast<void*>(decoded), length, 00093 Magick::Blob::MallocAllocator ); 00094 }

Here is the call graph for this function:

const void* Magick::Blob::data void   )  const
 

const void * Magick::Blob::data void   )  const
 

Definition at line 158 of file Blob.cpp.

References _blobRef, and Magick::BlobRef::_data.

Referenced by base64(), Magick::Image::iptcProfile(), Magick::Image::ping(), Magick::Image::profile(), Magick::Image::read(), and Magick::readImages().

00159 { 00160 return _blobRef->_data; 00161 }

size_t Magick::Blob::length void   )  const
 

size_t Magick::Blob::length void   )  const
 

Definition at line 164 of file Blob.cpp.

References _blobRef, and Magick::BlobRef::_length.

Referenced by base64(), Magick::Image::iptcProfile(), Magick::Image::ping(), Magick::Image::profile(), Magick::Image::read(), and Magick::readImages().

00165 { 00166 return _blobRef->_length; 00167 }

Blob& Magick::Blob::operator= const Blob blob_  ) 
 

Magick::Blob & Magick::Blob::operator= const Blob blob_  ) 
 

Definition at line 60 of file Blob.cpp.

References _blobRef, Magick::BlobRef::_mutexLock, and Magick::BlobRef::_refCount.

00061 { 00062 if(this != &blob_) 00063 { 00064 { 00065 Lock( &blob_._blobRef->_mutexLock ); 00066 ++blob_._blobRef->_refCount; 00067 } 00068 bool doDelete = false; 00069 { 00070 Lock( &_blobRef->_mutexLock ); 00071 if ( --_blobRef->_refCount == 0 ) 00072 doDelete = true; 00073 } 00074 if ( doDelete ) 00075 { 00076 delete _blobRef; 00077 } 00078 _blobRef = blob_._blobRef; 00079 } 00080 return *this; 00081 }

void Magick::Blob::update const void *  data_,
size_t  length_
 

void Magick::Blob::update const void *  data_,
size_t  length_
 

Definition at line 116 of file Blob.cpp.

References _blobRef, Magick::BlobRef::_mutexLock, Magick::BlobRef::_refCount, and update().

Referenced by update().

00117 { 00118 bool doDelete = false; 00119 { 00120 Lock( &_blobRef->_mutexLock ); 00121 if ( --_blobRef->_refCount == 0 ) 00122 doDelete = true; 00123 } 00124 if ( doDelete ) 00125 { 00126 // Delete old blob reference with associated data 00127 delete _blobRef; 00128 } 00129 00130 _blobRef = new Magick::BlobRef( data_, length_ ); 00131 }

Here is the call graph for this function:

void Magick::Blob::updateNoCopy void *  data_,
size_t  length_,
Allocator  allocator_ = NewAllocator
 

void Magick::Blob::updateNoCopy void *  data_,
size_t  length_,
Allocator  allocator_ = NewAllocator
 

Definition at line 137 of file Blob.cpp.

References Magick::BlobRef::_allocator, _blobRef, Magick::BlobRef::_data, Magick::BlobRef::_length, Magick::BlobRef::_mutexLock, Magick::BlobRef::_refCount, and updateNoCopy().

Referenced by base64(), updateNoCopy(), Magick::Image::write(), and Magick::writeImages().

00139 { 00140 bool doDelete = false; 00141 { 00142 Lock( &_blobRef->_mutexLock ); 00143 if ( --_blobRef->_refCount == 0 ) 00144 doDelete = true; 00145 } 00146 if ( doDelete ) 00147 { 00148 // Delete old blob reference with associated data 00149 delete _blobRef; 00150 } 00151 _blobRef = new Magick::BlobRef( 0, 0 ); 00152 _blobRef->_data = data_; 00153 _blobRef->_length = length_; 00154 _blobRef->_allocator = allocator_; 00155 }

Here is the call graph for this function:


Field Documentation

BlobRef* Magick::Blob::_blobRef [private]
 

Definition at line 77 of file Blob.h.

BlobRef* Magick::Blob::_blobRef [private]
 

Definition at line 77 of file Blob.h.

Referenced by Blob(), data(), length(), operator=(), update(), updateNoCopy(), and ~Blob().


The documentation for this class was generated from the following files:
Generated on Mon Oct 25 13:47:11 2004 for ImageMagick by doxygen 1.3.7
ImageMagick Copyright © 2004, ImageMagick Studio LLC