Public Member Functions | Static Public Member Functions

Celartem::DataArray< T > Class Template Reference

#include <cel_dsarray.h>

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

List of all members.

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)

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)

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:
inSize Specifies the size of the array in number of entries.
inReserve Specifies 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
See also:
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 (  )  [inline, static]

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
template<typename T >
static AutoPtr<DataArray<T> > Celartem::DataArray< T >::create ( size_t  inSize,
size_t  inReserve = (size_t)-1 
) [inline, static]

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 
) [inline, static]

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

Parameters:
inStream The stream from which the instance information is read.
inLevel The de-serialization level. In the top level, this value is 0.
inEndian The 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 [inline, virtual]

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:
inDataArray Pointer 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:
inBuffer An array to be duplicated.
inSize The size of the array.
inEndian The 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 [inline, virtual]

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:
t The value to fill with.
See also:
zeroClear
See also:
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
See also:
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 >
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 >
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 >
virtual size_t Celartem::DataArray< T >::getSize (  )  const [inline, virtual]

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 [inline, virtual]

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

template<typename T >
virtual u16 Celartem::DataArray< T >::getType (  )  const [inline, virtual]

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

template<typename T >
virtual const void* Celartem::DataArray< T >::getVoidPtr (  )  const [inline, virtual]

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 [inline, virtual]

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:
t Value 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:
inSize Specifies the new size of the array in number of entries.
See also:
resize, allocate
See also:
SimpleArray::reallocate
template<typename T >
void Celartem::DataArray< T >::reserve ( size_t  inSize  )  [inline]

This method changes the reservation size of the array.

Parameters:
inSize Specifies 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:
inSize Specifies the new size of the array in number of entries.
See also:
reallocate
See also:
SimpleArray::resize
template<typename T >
virtual void Celartem::DataArray< T >::serialize ( Stream inStream,
size_t  inLevel,
Endian  inEndian 
) [inline, virtual]

This method serializes a DataArray instance into the specified storage.

Parameters:
inStream The stream to which the instance information is written.
inLevel The serialization level. In the top level, this value is 0.
inEndian The endianness used to write the data.

Implements Celartem::Serializable.

template<typename T >
virtual void Celartem::DataArray< T >::setTag ( u16  tag  )  [inline, virtual]

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

template<typename T >
virtual void Celartem::DataArray< T >::setType ( u16  type  )  [inline, virtual]

This method is for compatibility with TIFF 6.0 Specification.

Implements Celartem::BasicDataArray.

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:
inDataArray Pointer 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 >::swap ( SimpleArray< T > &  inSa  )  [inline]

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

Parameters:
inSa The 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 >::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
See also:
SimpleArray::zeroClear

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:17.
Caminova Logo