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

myBlob Class Reference

Inheritance diagram for myBlob:

Inheritance graph
[legend]
Collaboration diagram for myBlob:

Collaboration graph
[legend]

Public Types

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

Public Member Functions

 myBlob (ifstream &stream_)
void base64 (const std::string base64_)
std::string base64 (void)
void base64 (const std::string base64_)
std::string base64 (void)
void update (const void *data_, size_t length_)
void update (const void *data_, size_t length_)
void updateNoCopy (void *data_, size_t length_, Allocator allocator_=NewAllocator)
void updateNoCopy (void *data_, size_t length_, Allocator allocator_=NewAllocator)
const void * data (void) const
const void * data (void) const
size_t length (void) const
size_t length (void) const

Member Enumeration Documentation

enum Magick::Blob::Allocator [inherited]
 

Enumeration values:
MallocAllocator 
NewAllocator 

Definition at line 24 of file Blob.h.

00025 { 00026 MallocAllocator, 00027 NewAllocator 00028 };

enum Magick::Blob::Allocator [inherited]
 

Enumeration values:
MallocAllocator 
NewAllocator 

Definition at line 24 of file Blob.h.

00025 { 00026 MallocAllocator, 00027 NewAllocator 00028 };


Constructor & Destructor Documentation

myBlob::myBlob ifstream &  stream_  )  [inline]
 

Definition at line 28 of file readWriteBlob.cpp.

00029 : Blob() 00030 { 00031 unsigned char* blobData = new unsigned char[100000]; 00032 char* c= reinterpret_cast<char *>(blobData); 00033 size_t blobLen=0; 00034 while( (blobLen< 100000) && stream_.get(*c) ) 00035 { 00036 c++; 00037 blobLen++; 00038 } 00039 if ((!stream_.eof()) || (blobLen == 0)) 00040 { 00041 cout << "Failed to stream into blob!" << endl; 00042 exit(1); 00043 } 00044 00045 // Insert data into blob 00046 updateNoCopy( reinterpret_cast<void*>(blobData), blobLen, 00047 Blob::NewAllocator ); 00048 }


Member Function Documentation

std::string Magick::Blob::base64 void   )  [inherited]
 

void Magick::Blob::base64 const std::string  base64_  )  [inherited]
 

std::string Magick::Blob::base64 void   )  [inherited]
 

Definition at line 97 of file Blob.cpp.

References Base64Encode(), Magick::Blob::data(), Magick::Blob::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_  )  [inherited]
 

Definition at line 84 of file Blob.cpp.

References Base64Decode(), Magick::Blob::length(), Magick::Blob::MallocAllocator, and Magick::Blob::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 [inherited]
 

const void * Magick::Blob::data void   )  const [inherited]
 

Definition at line 158 of file Blob.cpp.

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

Referenced by Magick::Blob::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 [inherited]
 

size_t Magick::Blob::length void   )  const [inherited]
 

Definition at line 164 of file Blob.cpp.

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

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

00165 { 00166 return _blobRef->_length; 00167 }

void Magick::Blob::update const void *  data_,
size_t  length_
[inherited]
 

void Magick::Blob::update const void *  data_,
size_t  length_
[inherited]
 

Definition at line 116 of file Blob.cpp.

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

Referenced by Magick::Blob::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
[inherited]
 

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

Definition at line 137 of file Blob.cpp.

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

Referenced by Magick::Blob::base64(), Magick::Blob::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:


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