Public Member Functions

Celartem::DjVu::DataLocker Class Reference

#include <djv_data.h>

List of all members.

Public Member Functions

 DataLocker ()
 DataLocker (const Data *inData)
 ~DataLocker ()
const u8getPtr () const
size_t getSize () const
 operator const u8 * () const
void lock (const Data *inData)
void release ()

Detailed Description

This class provides easy access to the data on memory.
If the Data instance passed is a MemoryData, this class uses the memory block on that instance whereas allocates a temporary memory block if not a MemoryData.

const Data* data = chunk->getData();
DataLocker lock(data);
const char* p = lock.getPtr();
size_t size = lock.getSize();

Constructor & Destructor Documentation

Celartem::DjVu::DataLocker::DataLocker (  )  [inline]

Initialize without locking any Data.

Celartem::DjVu::DataLocker::DataLocker ( const Data inData  )  [inline, explicit]

Initialize by locking a Data.

Parameters:
inData A Data instance to lock.
Celartem::DjVu::DataLocker::~DataLocker (  )  [inline]

Destruct the lock (release the lock).


Member Function Documentation

const u8* Celartem::DjVu::DataLocker::getPtr (  )  const [inline]

Get pointer to the locked memory block.

Returns:
Pointer to the locked memory block. The memory block will be invalidate after releasing this lock.
See also:
getSize
size_t Celartem::DjVu::DataLocker::getSize (  )  const [inline]

Get the size of the locked memory block.

void Celartem::DjVu::DataLocker::lock ( const Data inData  )  [inline]

Lock a Data. The memory block can be obtained by calling getPtr.

Parameters:
inData A Data instance to lock.
See also:
getPtr

Referenced by DataLocker().

Celartem::DjVu::DataLocker::operator const u8 * (  )  const [inline]

Get pointer to the locked memory block.

Returns:
Pointer to the locked memory block. The memory block will be invalidate after releasing this lock.
See also:
getPtr, getSize
void Celartem::DjVu::DataLocker::release (  )  [inline]

Unlock the Data instance.

Referenced by lock(), and ~DataLocker().


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

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:20.
Caminova Logo