Public Member Functions | Static Public Member Functions | List of all members
Celartem::DataArray< T > Class Template Reference

#include <cel_dsarray.h>

Inheritance diagram for Celartem::DataArray< T >:
Inheritance graph
[legend]

Public Member Functions

virtual void serialize (Stream *inStream, size_t inLevel, Endian inEndian)
 
virtual AutoPtr< Serializableduplicate () const
 
virtual AutoPtr< DataArray< T > > duplicateDataArray () const
 
SimpleArray< T > & getReference ()
 
const SimpleArray< T > & getReference () const
 
T * getPtr ()
 
const T * getPtr () const
 
virtual const void * getVoidPtr () const
 
T & at (size_t pos)
 
const T & at (size_t pos) const
 
virtual bool isValid () const
 
virtual size_t getSize () const
 
void allocate (size_t inSize, size_t inReserve=(size_t)-1)
 
void reserve (size_t inSize)
 
void reallocate (size_t inSize)
 
void resize (size_t inSize)
 
void free ()
 
void duplicate (const SimpleArray< T > &inSa)
 
void duplicate (const Serializable *inDataArray)
 
void duplicate (const T *inBuffer, size_t inSize, Endian inEndian=endianHost)
 
void fill (const T &t)
 
void zeroClear ()
 
void swap (SimpleArray< T > &inSa)
 
void swap (Serializable *inDataArray)
 
void push_back (T &t)
 
pop_back ()
 
virtual u16 getTag () const
 
virtual void setTag (u16 tag)
 
virtual u16 getType () const
 
virtual void setType (u16 type)
 
- Public Member Functions inherited from Celartem::BasicDataArray
virtual size_t getAsInt (size_t inIndex) const
 
virtual double getAsDouble (size_t inIndex) const
 
virtual TIFF_RATIONAL getAsRational (size_t inIndex) const
 
- Public Member Functions inherited from Celartem::Serializable
const GuidgetClassId () const
 
String getClassName () 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< Serializabledeserialize (Stream *inStream, size_t inLevel, Endian inEndian)
 
static AutoPtr< DataArray< T > > create ()
 
static AutoPtr< DataArray< T > > create (size_t inSize, size_t inReserve=(size_t)-1)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

template<typename T>
class Celartem::DataArray< T >

DataArray is a Serializable version of SimpleArray. This class contains SimpleArray and it provides almost all methods supported by SimpleArray. For template parameter T, this class uses StoragePolicy to determine how to deal with T instances.

See Also
SimpleArray, Serializable, DataTraits, StoragePolicy
BasicDataArray

Member Function Documentation

template<typename T>
void Celartem::DataArray< T >::allocate ( size_t  inSize,
size_t  inReserve = (size_t)-1 
)
inline

This method allocates the array.
This method firstly frees all the contents on the array and renew the array itself; if you want to keep the contents during the reconstruction of the array, use reallocate or resize.

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.
See Also
reallocate, resize
SimpleArray::allocate
template<typename T>
T& Celartem::DataArray< T >::at ( size_t  pos)
inline

This method provides access to the array entries. Since DataArray is Serializable derivative class, it is usually used via AutoPtr<DataStore> and could not provide [] array operator, this method provides the same function to it.

See Also
SimpleArray
template<typename T>
const T& Celartem::DataArray< T >::at ( size_t  pos) const
inline

This method provides access to the array entries. Since DataArray is Serializable derivative class, it is usually used via AutoPtr<DataStore> and could not provide [] array operator, this method provides the same function to it.

See Also
SimpleArray
template<typename T>
static AutoPtr<DataArray<T> > Celartem::DataArray< T >::create ( )
inlinestatic

This function creates a new DataArray<T> instance. The SimpleArray instance held by this instance is set SimpleArray::strictCleanup attributes.

Returns
Pointer to the newly created DataArray<T> instance.
See Also
SimpleArray
SimpleArray::strictCleanup

Referenced by Celartem::DataArray< T >::deserialize().

template<typename T>
static AutoPtr<DataArray<T> > Celartem::DataArray< T >::create ( size_t  inSize,
size_t  inReserve = (size_t)-1 
)
inlinestatic

This function creates a new DataArray<T> instance. The SimpleArray instance held by this instance is set SimpleArray::strictCleanup attributes.

Returns
Pointer to the newly created DataArray<T> instance.
See Also
SimpleArray
allocate, SimpleArray::strictCleanup
template<typename T>
static AutoPtr<Serializable> Celartem::DataArray< T >::deserialize ( Stream inStream,
size_t  inLevel,
Endian  inEndian 
)
inlinestatic

This method deserializes a DataArray<T> instance from the specified storage.

Parameters
inStreamThe stream from which the instance information is read.
inLevelThe de-serialization level. In the top level, this value is 0.
inEndianThe endianness used to read the data.
Returns
Pointer to the newly created Serializable instance.
template<typename T>
virtual AutoPtr<Serializable> Celartem::DataArray< T >::duplicate ( ) const
inlinevirtual

This method duplicates the DataArray<T> instance.

Returns
Pointer to the newly created Serializable instance.

Implements Celartem::Serializable.

template<typename T>
void Celartem::DataArray< T >::duplicate ( const SimpleArray< T > &  inSa)
inline

This method also set strictCleanup attributes to this instance after duplication. The tag/type associated to the instance will be cleared.

See Also
SimpleArray::duplicate(const SimpleArray&)
SimpleArray::strictCleanup
template<typename T>
void Celartem::DataArray< T >::duplicate ( const Serializable inDataArray)
inline

This method duplicates the specified array.

Parameters
inDataArrayPointer to the DataArray<T> instance to be duplicated. This method also set strictCleanup attributes to this instance after duplication.
See Also
duplicate
SimpleArray::strictCleanup
template<typename T>
void Celartem::DataArray< T >::duplicate ( const T *  inBuffer,
size_t  inSize,
Endian  inEndian = endianHost 
)
inline

This method duplicates the specified array.

Parameters
inBufferAn array to be duplicated.
inSizeThe size of the array.
inEndianThe endianness of the specified buffer. This method also set strictCleanup attributes to this instance after duplication. The tag/type associated to the instance will be cleared.
See Also
SimpleArray::duplicate(const T*,size_t,Endian)
SimpleArray::strictCleanup
template<typename T>
virtual AutoPtr<DataArray<T> > Celartem::DataArray< T >::duplicateDataArray ( ) const
inlinevirtual

This method duplicates the DataArray<T> instance.

Returns
Pointer to the newly created DataArray instance.
template<typename T>
void Celartem::DataArray< T >::fill ( const T &  t)
inline

This method is a general version of fill function; fill(0) fills all array with 0.

Parameters
tThe value to fill with.
See Also
zeroClear
SimpleArray::fill
template<typename T>
void Celartem::DataArray< T >::free ( )
inline

This method releases the memory.
Please note that since this method really deallocates the memory block associated with this SimpleArray instance, it does not keep the reservation size after the call. If you want to preserve the allocated memory for it, use reallocate (0) rather than this method.
Please note that this method keeps the current memory allocation unit. To revert the value to the default, use setAllocationUnit method.

See Also
reserve, allocate, reallocate
SimpleArray::free
template<typename T>
T* Celartem::DataArray< T >::getPtr ( )
inline

This method returns raw pointer to the array.

Returns
Raw pointer to the array.
See Also
SimpleArray::getPtr
template<typename T>
const T* Celartem::DataArray< T >::getPtr ( ) const
inline

This method returns raw pointer to the array.

Returns
Raw pointer to the array.
See Also
SimpleArray::getPtr
template<typename T>
SimpleArray<T>& Celartem::DataArray< T >::getReference ( )
inline

This method returns the reference to the holding SimpleArray instance.

Returns
Reference to the SimpleArray instance.
template<typename T>
const SimpleArray<T>& Celartem::DataArray< T >::getReference ( ) const
inline

This method returns the reference to the holding SimpleArray instance. (const version)

Returns
Reference to the SimpleArray instance.
template<typename T>
virtual size_t Celartem::DataArray< T >::getSize ( ) const
inlinevirtual

This method returns the size of array in number of entries.

Returns
The number of entries.
See Also
SimpleArray::getSize

Implements Celartem::BasicDataArray.

template<typename T>
virtual u16 Celartem::DataArray< T >::getTag ( ) const
inlinevirtual

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

template<typename T>
virtual u16 Celartem::DataArray< T >::getType ( ) const
inlinevirtual

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

template<typename T>
virtual const void* Celartem::DataArray< T >::getVoidPtr ( ) const
inlinevirtual

This method returns the pointer to the internal data.

Returns
Pointer to the internal data.

Implements Celartem::BasicDataArray.

template<typename T>
virtual bool Celartem::DataArray< T >::isValid ( ) const
inlinevirtual

This method checks whether the array is valid or not.

Returns
true if the array is valid, otherwise false.
See Also
SimpleArray::isValid

Implements Celartem::BasicDataArray.

template<typename T>
T Celartem::DataArray< T >::pop_back ( )
inline

This method is almost identical to vector::pop_back .

Returns
The value that was on the tail of the array.
See Also
SimpleArray::pop_back
template<typename T>
void Celartem::DataArray< T >::push_back ( T &  t)
inline

This method is almost identical to vector::push_back .

Parameters
tValue to add.
See Also
SimpleArray::push_back
template<typename T>
void Celartem::DataArray< T >::reallocate ( size_t  inSize)
inline

This method reallocates the array. This method keeps the contents on the array during the reconstruction of the array and it is slower than allocate method; if you don't want to keep the contents, use allocate instead.
resize is just an alias of this method and the behavior is identical to this method.

Parameters
inSizeSpecifies the new size of the array in number of entries.
See Also
resize, allocate
SimpleArray::reallocate
template<typename T>
void Celartem::DataArray< T >::reserve ( size_t  inSize)
inline

This method changes the reservation size of the array.

Parameters
inSizeSpecifies 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.
See Also
SimpleArray::reserve
template<typename T>
void Celartem::DataArray< T >::resize ( size_t  inSize)
inline

This method reallocates the array. This method is identical to reallocate method. See reallocate for more information.
This method is provided for the compatibility with std::vector.

Parameters
inSizeSpecifies the new size of the array in number of entries.
See Also
reallocate
SimpleArray::resize
template<typename T>
virtual void Celartem::DataArray< T >::serialize ( Stream inStream,
size_t  inLevel,
Endian  inEndian 
)
inlinevirtual

This method serializes a DataArray instance into the specified storage.

Parameters
inStreamThe stream to which the instance information is written.
inLevelThe serialization level. In the top level, this value is 0.
inEndianThe endianness used to write the data.

Implements Celartem::Serializable.

template<typename T>
virtual void Celartem::DataArray< T >::setTag ( u16  tag)
inlinevirtual

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

template<typename T>
virtual void Celartem::DataArray< T >::setType ( u16  type)
inlinevirtual

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

template<typename T>
void Celartem::DataArray< T >::swap ( SimpleArray< T > &  inSa)
inline

This method swaps the contents of the array with the specified array instance.

Parameters
inSaThe SimpleArray instance with which this instance will exchange the contents. This method also set strictCleanup attributes to this instance after duplication. The tag/type information associated to the instance will be cleared.
See Also
SimpleArray::swap(SimpleArray&)
SimpleArray::strictCleanup
template<typename T>
void Celartem::DataArray< T >::swap ( Serializable inDataArray)
inline

This method swaps the contents of the array with the specified array instance.

Parameters
inDataArrayPointer to the DataArray<T> instance with which this instance will exchange the contents. This method also set strictCleanup attributes to this instance after duplication.
See Also
SimpleArray::swap(SimpleArray&)
SimpleArray::strictCleanup
template<typename T>
void Celartem::DataArray< T >::zeroClear ( )
inline

This method zero-clears the array in the way of std::memset . This is very dangerous method and you should consider that you should use fill instead of it.

See Also
fill
SimpleArray::zeroClear

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:06.
Cuminas Logo