Public Member Functions | Static Public Member Functions | List of all members
Celartem::DjVu::MemoryData Class Reference

#include <djv_data.h>

Inheritance diagram for Celartem::DjVu::MemoryData:
Inheritance graph
[legend]

Public Member Functions

const u8getRawPtr () const
 
virtual size_t getSize () const
 
virtual AutoPtr< StoragegetReadOnlyStorage () const
 
virtual AutoPtr< Dataduplicate (bool inCompaction=false) const
 
virtual void compact ()
 
SimpleArray< u8 > & getSimpleArray ()
 
AutoPtr< MemoryStoragegetStorage ()
 
virtual void lock () const
 
virtual void unlock () const
 
- Public Member Functions inherited from Celartem::DjVu::Data
void decompressToMemory (SimpleArray< u8 > &outBuffer) const
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

Static Public Member Functions

static AutoPtr< MemoryDatacreate (size_t inSize=0, size_t inReserve=(size_t)-1, MemoryAllocator *inAllocator=NULL, size_t inAllocationUnit=0)
 
static AutoPtr< MemoryDatacreate (const void *inData, size_t inSize)
 
static AutoPtr< MemoryDatacreate (Storage *inStorage, uint64_t inOffset, size_t inSize)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

This implementation provides SimpleArray based data structure.

Member Function Documentation

virtual void Celartem::DjVu::MemoryData::compact ( )
inlinevirtual

Minimize the memory usage by removing reserved area.

Implements Celartem::DjVu::Data.

static AutoPtr<MemoryData> Celartem::DjVu::MemoryData::create ( size_t  inSize = 0,
size_t  inReserve = (size_t)-1,
MemoryAllocator inAllocator = NULL,
size_t  inAllocationUnit = 0 
)
inlinestatic

Creates a MemoryData instance on a memory.

Parameters
inSizeSpecifies the size of the array in number of entries.
inReserveSpecifies the reservation size of the array in number of entries. The reservation size is a parameter that controls relocation of the array. Although the larger reservation size assures you of the better speed performance of array resizing until the size surpasses the reservation size, it firstly request the reservation size of memory to the operating system.
inAllocatorSpecifies the MemoryAllocator instance that is used to allocate/deallocate memory blocks. It can be NULL and then SimpleArray uses the default allocator.
inAllocationUnitSpecifies the unit size for allocation. For more information, see SimpleArray::setAllocationUnit.
Returns
Pointer to the newly created MemoryData instance.
See Also
SimpleArray

Referenced by Celartem::DjVu::PageInfo::encodeINFOChunk().

static AutoPtr<MemoryData> Celartem::DjVu::MemoryData::create ( const void *  inData,
size_t  inSize 
)
inlinestatic

Creates a MemoryData instance by duplicating the specified data.

Parameters
inDataPointer to a buffer which contains the data.
inSizeThe size of the data.
Returns
Pointer to the newly created MemoryData instance.
static AutoPtr<MemoryData> Celartem::DjVu::MemoryData::create ( Storage inStorage,
uint64_t  inOffset,
size_t  inSize 
)
inlinestatic

Creates a MemoryData instance by loading data from the specified storage block.

Parameters
inStorageStorage which contains the data.
inOffsetThe data offset.
inSizeThe data size.
Returns
Pointer to the newly created MemoryData instance.
virtual AutoPtr<Data> Celartem::DjVu::MemoryData::duplicate ( bool  inCompaction = false) const
inlinevirtual

Duplicate the Data instance.

Parameters
inCompactionWhether the duplication process also does compaction of memory usage or not.
Returns
Pointer to the newly created Data instance.

Implements Celartem::DjVu::Data.

const u8* Celartem::DjVu::MemoryData::getRawPtr ( ) const
inline

Get the actual data.

Returns
The pointer to the data.

Referenced by Celartem::DjVu::DataLocker::lock().

virtual AutoPtr<Storage> Celartem::DjVu::MemoryData::getReadOnlyStorage ( ) const
inlinevirtual

Get readonly Storage access to the actual data.
The caller should not write to the stream but only reads the data from it. The Storage should be rewound to the beginning position.

Returns
Pointer to the Storage instance.

Implements Celartem::DjVu::Data.

SimpleArray<u8>& Celartem::DjVu::MemoryData::getSimpleArray ( )
inline

Get SimpleArray instance which manages actual data.

Returns
A reference to the SimpleArray instance.
virtual size_t Celartem::DjVu::MemoryData::getSize ( ) const
inlinevirtual

Get the size of the data.

Returns
The size of the data.

Implements Celartem::DjVu::Data.

AutoPtr<MemoryStorage> Celartem::DjVu::MemoryData::getStorage ( )
inline

Get Storage interface access to the memory data. This is just a helper method and it simply create MemoryStorage on the internal SimpleArray.

Returns
Pointer to the newly created MemoryStorage instance.
See Also
MemoryStorage
virtual void Celartem::DjVu::MemoryData::lock ( ) const
inlinevirtual

Locks the instance.
This method provides a synchronization mechanism for processing the instance between threads.
If you plan to use the instance in multi-threaded program, it's recommended to lock the instance before accessing the data.

See Also
unlock, Locker, Lockable

Implements Celartem::DjVu::Data.

virtual void Celartem::DjVu::MemoryData::unlock ( ) const
inlinevirtual

Releases the lock on the instance.

See Also
lock, Locker, Lockable

Implements Celartem::DjVu::Data.


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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo