Loading...
Searching...
No Matches
Magick::BlobRef Class Reference

## Public Member Functions

| BlobRef (const void *data_, const size_t length_)
size_t | decrease ()
void | increase ()

## Data Fields

Blob::Allocator | allocator
size_t | length
void * | data

## Private Member Functions

| BlobRef (const BlobRef &)

## Private Attributes

MutexLock | _mutexLock
size_t | _refCount

## Detailed Description

Definition at line 23 of file BlobRef.h.

## Constructor & Destructor Documentation

## BlobRef()

Magick::BlobRef::BlobRef | ( | const void * | data_,
|  | const size_t | length_ )

Definition at line 21 of file BlobRef.cpp.

: allocator(Magick::Blob::NewAllocator),
length(length_),
data((void*) NULL),
_mutexLock(),
_refCount(1)
{
if (data_ != (const void*) NULL)
{
data=new unsigned char[length_];
memcpy(data,data_,length_);
}
}

## ~BlobRef()

Magick::BlobRef::~BlobRef | ( | void |  | ) |

Definition at line 35 of file BlobRef.cpp.

{
if (allocator == Magick::Blob::NewAllocator)
{
delete[] static_cast<unsigned char*>(data);
data=(void *) NULL;
}
else if (allocator == Magick::Blob::MallocAllocator)
data=(void *) RelinquishMagickMemory(data);
}

## Member Function Documentation

## decrease()

size_t Magick::BlobRef::decrease | ( |  | ) |

Definition at line 46 of file BlobRef.cpp.

{
size_t
count;
_mutexLock.lock();
if (_refCount == 0)
{
_mutexLock.unlock();
throwExceptionExplicit(MagickCore::OptionError,
"Invalid call to decrease");
return(0);
}
count=--_refCount;
_mutexLock.unlock();
return(count);
}

## increase()

void Magick::BlobRef::increase | ( |  | ) |

Definition at line 64 of file BlobRef.cpp.

{
_mutexLock.lock();
_refCount++;
_mutexLock.unlock();
}

## Field Documentation

## _mutexLock

MutexLock Magick::BlobRef::_mutexLock

private

Definition at line 47 of file BlobRef.h.

## _refCount

size_t Magick::BlobRef::_refCount

private

Definition at line 48 of file BlobRef.h.

## allocator

Blob::Allocator Magick::BlobRef::allocator

Definition at line 39 of file BlobRef.h.

## data

void* Magick::BlobRef::data

Definition at line 41 of file BlobRef.h.

## length

size_t Magick::BlobRef::length

Definition at line 40 of file BlobRef.h.

The documentation for this class was generated from the following files:

- BlobRef.h
- BlobRef.cpp