Public Member Functions | List of all members
Celartem::SimpleArray< T, copyPolicy > Class Template Reference

#include <cel_memory.h>

Inheritance diagram for Celartem::SimpleArray< T, copyPolicy >:
Inheritance graph
[legend]

Public Member Functions

 SimpleArray (size_t inSize=0, size_t inReserve=AUTO_SIZE, MemoryAllocator *inAllocator=NULL, size_t inAllocationUnit=0)
 
 SimpleArray (const SimpleArray &inSa)
 
 ~SimpleArray ()
 
void init (size_t inSize=0, size_t inReserve=0, MemoryAllocator *inAllocator=NULL, size_t inAllocationUnit=0)
 
SimpleArrayoperator= (const SimpleArray &inSa)
 
void strictCleanup (bool doIt=true)
 
void setAllocationUnit (size_t inAllocationUnit)
 
size_t getAllocationUnit ()
 
MemoryAllocatorgetAllocator () const
 
T * getPtr ()
 
const T * getPtr () const
 
size_t getSize () const
 
size_t getReservedSize () const
 
bool isValid () const
 
T & operator[] (size_t inPos)
 
const T & operator[] (size_t inPos) const
 
void allocate (size_t inSize, size_t inReserve=AUTO_SIZE)
 
void reserve (size_t inSize)
 
void reallocate (size_t inSize)
 
void resize (size_t inSize)
 
void compact ()
 
void free ()
 
void clear ()
 
void remove (size_t inPos, size_t inCount)
 
void insertEmptyElementsAt (size_t inPos, size_t inCount)
 
T & insertAt (size_t inIndex, const T &inElement)
 
T & insert (const T *it, const T &inElement)
 
void insert (const T *it, size_t inCount, const T *inElements)
 
void insertAt (size_t inPos, size_t inCount, const T *inElements)
 
void insertAt (size_t inPos, const SimpleArray &inElements)
 
void prepend (size_t inCount, const T *inElements)
 
void prepend (const SimpleArray &inElements)
 
void append (size_t inCount, const T *inElements)
 
void append (const SimpleArray &inElements)
 
void duplicate (const SimpleArray &inSa, bool inNeedCompaction=false)
 
void duplicate (const T *inBuffer, size_t inSize)
 
void duplicate (const T *inBuffer, size_t inSize, Endian inEndian)
 
void fill (const T &t)
 
template<typename U >
void fill (const U &u)
 
void zeroClear ()
 
int indexOf (const T &t) const
 
template<typename U >
int indexOf (const U &u) const
 
void swap (SimpleArray &inSa)
 
void push_back (const T &t)
 
template<typename U >
void push_back (const U &t)
 
pop_back ()
 
void push_front (const T &t)
 
template<typename U >
void push_front (const U &t)
 
pop_front ()
 
T * begin ()
 
T * end ()
 
T * last ()
 
const T * begin () const
 
const T * end () const
 
const T * last () const
 
T & front ()
 
const T & front () const
 
T & back ()
 
const T & back () const
 

Detailed Description

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
class Celartem::SimpleArray< T, copyPolicy >

SimpleArray is a simplified substitution to std::vector. This class does not need T(const T& t) type constructor but T() .
The second template parameter copyPolicy is one of the CopyPolicy enumeration and it specifies how to copy the instance if needed. The default for this value is DataTraits::copyPolicy for T.
If copyPolicy is byConstructor, SimpleArray copies the instance in the usual way, using copy-constuctor. Although this scheme is normal and simple enough, it may down the performance of array operations if the T is simple types such as int, long, ... In these cases, copyPolicy should be changed into byMemcpy. With byMemcpy , copy operations are done with std::memcpy and it may increases the performance of the array operations. byMemcpy is default for the type like int, long ... (types which are called POD).
Another option, named noCopy is to deal with the structs/classes that do not have copy-constructor, with such data, SimpleArray could not resize the array and it only can allocate and free.
Although SimpleArray class itself is thread-safe, you should synchronize the operations if an instance is used between threads.

See Also
CopyPolicy, DataTraits.

Constructor & Destructor Documentation

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
Celartem::SimpleArray< T, copyPolicy >::SimpleArray ( size_t  inSize = 0,
size_t  inReserve = AUTO_SIZE,
MemoryAllocator inAllocator = NULL,
size_t  inAllocationUnit = 0 
)
inlineexplicit

This constructor initializes the SimpleArray instance by the specified size; it does almost same as init method.

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 setAllocationUnit.
See Also
MemoryAllocator, init, setAllocationUnit, MemoryStorage
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
Celartem::SimpleArray< T, copyPolicy >::SimpleArray ( const SimpleArray< T, copyPolicy > &  inSa)
inline

This constructor initializes the SimpleArray instance with the data copied from the other instance.

Parameters
inSaAn array to be duplicated. This constructor really copies the memory block held by the instance.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
Celartem::SimpleArray< T, copyPolicy >::~SimpleArray ( )
inline

Deletes the array.

Member Function Documentation

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::allocate ( size_t  inSize,
size_t  inReserve = AUTO_SIZE 
)
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

Referenced by Celartem::DjVu::PackedBitmap::allocate(), Celartem::DataArray< T >::allocate(), Celartem::DataArray< T >::deserialize(), Celartem::SimpleArray< AutoPtr< Bookmark > >::duplicate(), Celartem::SimpleArray< AutoPtr< Bookmark > >::init(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::SimpleArray().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::append ( size_t  inCount,
const T *  inElements 
)
inline

This method inserts the specified number of elements to the end of the array.

Parameters
inCountThe number of the elements in inElements.
inElementsThe elements to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::append ( const SimpleArray< T, copyPolicy > &  inElements)
inline

This method inserts the specified number of elements to the end of the array.

Parameters
inElementsThe elements to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T& Celartem::SimpleArray< T, copyPolicy >::back ( )
inline

This method is for the compatibility with STL algorithms.

Returns
Reference to the last element in the array. This reference is identical to array[getSize() - 1] .
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
const T& Celartem::SimpleArray< T, copyPolicy >::back ( ) const
inline

This method is for the compatibility with STL algorithms.

Returns
Reference to the last element in the array. This reference is identical to array[getSize() - 1] .
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T* Celartem::SimpleArray< T, copyPolicy >::begin ( )
inline

This method is for the compatibility with STL algorithms.

Returns
Pointer to the first element in the array. This pointer is identical to &array[0] .

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::front().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
const T* Celartem::SimpleArray< T, copyPolicy >::begin ( ) const
inline

This method is for the compatibility with STL algorithms.

Returns
Pointer to the first element in the array. This pointer is identical to &array[0] .
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::clear ( )
inline

This method release the memory.
This is just an alias of free method.

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::compact ( )
inline

This method reduces memory consumption by deallocating the unused reserved area.
Please note that compaction actually moves the location of the array and it may take relatively long time.

See Also
reserve, allocate, reallocate, resize

Referenced by Celartem::DjVu::MemoryData::compact().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::duplicate ( const SimpleArray< T, copyPolicy > &  inSa,
bool  inNeedCompaction = false 
)
inline

This method duplicates the specified array.

Parameters
inSaAn array to be duplicated.
inNeedCompactionWhether compaction (removing reserved area) is needed or not.

Referenced by Celartem::DataArray< T >::duplicate(), Celartem::SimpleArray< AutoPtr< Bookmark > >::operator=(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::SimpleArray().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::duplicate ( const T *  inBuffer,
size_t  inSize 
)
inline

This method duplicates the specified array.

Parameters
inBufferAn array to be duplicated.
inSizeThe size of the array.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::duplicate ( const T *  inBuffer,
size_t  inSize,
Endian  inEndian 
)
inline

This method duplicates the specified array.

Parameters
inBufferAn array to be duplicated.
inSizeThe size of the array.
inEndianThe endianness of the specified buffer.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T* Celartem::SimpleArray< T, copyPolicy >::end ( )
inline

This method is for the compatibility with STL algorithms.

Returns
Pointer to the end of the array. This pointer is identical to &array[array.getSize()] .

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::remove().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
const T* Celartem::SimpleArray< T, copyPolicy >::end ( ) const
inline

This method is for the compatibility with STL algorithms.

Returns
Pointer to the end of the array. This pointer is identical to &array[array.getSize()] .
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::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

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

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
template<typename U >
void Celartem::SimpleArray< T, copyPolicy >::fill ( const U &  u)
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
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::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

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::allocate(), Celartem::SimpleArray< AutoPtr< Bookmark > >::clear(), Celartem::SimpleArray< AutoPtr< Bookmark > >::compact(), Celartem::SimpleArray< AutoPtr< Bookmark > >::duplicate(), Celartem::DataArray< T >::free(), Celartem::DjVu::IFF::Layout::init(), Celartem::SimpleArray< AutoPtr< Bookmark > >::init(), Celartem::SimpleArray< AutoPtr< Bookmark > >::insertEmptyElementsAt(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::~SimpleArray().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T& Celartem::SimpleArray< T, copyPolicy >::front ( )
inline

This method is for the compatibility with STL algorithms.

Returns
Reference to the first element in the array. This reference is identical to array[0] .
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
const T& Celartem::SimpleArray< T, copyPolicy >::front ( ) const
inline

This method is for the compatibility with STL algorithms.

Returns
Reference to the first element in the array. This reference is identical to array[0] .
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
size_t Celartem::SimpleArray< T, copyPolicy >::getAllocationUnit ( )
inline

This method is to obtain the current memory allocation unit.

Returns
The current memory allocation unit.
See Also
setAllocationUnit, reallocate
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
MemoryAllocator* Celartem::SimpleArray< T, copyPolicy >::getAllocator ( ) const
inline

This method is to get MemoryAllocator instance used within the instance.

Returns
Pointer to the MemoryAllocator instance.

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::free(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::getReservedSize().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T* Celartem::SimpleArray< T, copyPolicy >::getPtr ( )
inline

This method returns raw pointer to the array.

Returns
Raw pointer to the array.

Referenced by Celartem::DataArray< T >::getPtr(), Celartem::DjVu::MemoryData::getRawPtr(), and Celartem::DataArray< T >::getVoidPtr().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
const T* Celartem::SimpleArray< T, copyPolicy >::getPtr ( ) const
inline

This method returns const raw pointer to the array.

Returns
Raw pointer (read-only) to the array.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
size_t Celartem::SimpleArray< T, copyPolicy >::getReservedSize ( ) const
inline
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
size_t Celartem::SimpleArray< T, copyPolicy >::getSize ( ) const
inline
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
int Celartem::SimpleArray< T, copyPolicy >::indexOf ( const T &  t) const
inline

This method returns the index of the specified item.

Returns
0-based index of the first found item. If none is found, returns -1.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
template<typename U >
int Celartem::SimpleArray< T, copyPolicy >::indexOf ( const U &  u) const
inline

This method returns the index of the specified item.

Returns
0-based index of the first found item. If none is found, returns -1.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::init ( size_t  inSize = 0,
size_t  inReserve = 0,
MemoryAllocator inAllocator = NULL,
size_t  inAllocationUnit = 0 
)
inline

This method initializes the SimpleArray instance by the specified size. No other method can replace the allocator except the constructor.

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 setAllocationUnit.
See Also
MemoryAllocator, SimpleArray, setAllocationUnit
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T& Celartem::SimpleArray< T, copyPolicy >::insert ( const T *  it,
const T &  inElement 
)
inline

This method inserts the specified number of elements to the specified position.

Parameters
itIt indicates the position on which new elements are inserted.
inElementThe element to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::insert ( const T *  it,
size_t  inCount,
const T *  inElements 
)
inline

This method inserts the specified number of elements to the specified position.

Parameters
itIt indicates the position on which new elements are inserted.
inCountThe number of the elements in inElements.
inElementsThe elements to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T& Celartem::SimpleArray< T, copyPolicy >::insertAt ( size_t  inIndex,
const T &  inElement 
)
inline

This method inserts the specified number of elements to the specified position.

Parameters
inIndexIt indicates the position on which new elements are inserted.
inElementThe element to insert.

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::append(), Celartem::SimpleArray< AutoPtr< Bookmark > >::insert(), Celartem::SimpleArray< AutoPtr< Bookmark > >::insertAt(), Celartem::SimpleArray< AutoPtr< Bookmark > >::prepend(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::push_front().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::insertAt ( size_t  inPos,
size_t  inCount,
const T *  inElements 
)
inline

This method inserts the specified number of elements to the specified position.

Parameters
inPosIt indicates the position on which new elements are inserted.
inCountThe number of the elements in inElements.
inElementsThe elements to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::insertAt ( size_t  inPos,
const SimpleArray< T, copyPolicy > &  inElements 
)
inline

This method inserts the specified number of elements to the specified position.

Parameters
inPosIt indicates the position on which new elements are inserted.
inElementsThe elements to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::insertEmptyElementsAt ( size_t  inPos,
size_t  inCount 
)
inline

This method inserts the specified number of elements to the specified position.

Parameters
inPosIt indicates the position on which new elements are inserted.
inCountThe number of the new elements.

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::insert(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::insertAt().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
bool Celartem::SimpleArray< T, copyPolicy >::isValid ( ) const
inline

This method checks whether the array is valid or not.

Returns
true if the array is valid, otherwise false.

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

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T* Celartem::SimpleArray< T, copyPolicy >::last ( )
inline

This method is for the compatibility with STL algorithms.

Returns
Pointer to the last element in the array. This pointer is identical to &array[array.getSize() - 1] .

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::back().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
const T* Celartem::SimpleArray< T, copyPolicy >::last ( ) const
inline

This method is for the compatibility with STL algorithms.

Returns
Pointer to the last element in the array. This pointer is identical to &array[array.getSize() - 1] .
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
SimpleArray& Celartem::SimpleArray< T, copyPolicy >::operator= ( const SimpleArray< T, copyPolicy > &  inSa)
inline

This method copies the specified instance.

Parameters
inSaAn array to be duplicated. This constructor really copies the memory block held by the instance.
Returns
Reference to this instance (*this).
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T& Celartem::SimpleArray< T, copyPolicy >::operator[] ( size_t  inPos)
inline

This method provides the array interface.

Parameters
inPosIndex to an entry.
Returns
The reference to the specified entry.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
const T& Celartem::SimpleArray< T, copyPolicy >::operator[] ( size_t  inPos) const
inline

This method provides the array interface (for read).

Parameters
inPosIndex to an entry.
Returns
A const reference to the specified entry.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T Celartem::SimpleArray< T, copyPolicy >::pop_back ( )
inline

This method is almost identical to vector::pop_back .

Returns
The value that was on the tail of the array.

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

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
T Celartem::SimpleArray< T, copyPolicy >::pop_front ( )
inline

This method is almost identical to deque::pop_front .
Please note that this method is much slower than pop_back.

Returns
The value that was on the tail of the array.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::prepend ( size_t  inCount,
const T *  inElements 
)
inline

This method inserts the specified number of elements to the beginning of the array.

Parameters
inCountThe number of the elements in inElements.
inElementsThe elements to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::prepend ( const SimpleArray< T, copyPolicy > &  inElements)
inline

This method inserts the specified number of elements to the beginning of the array.

Parameters
inElementsThe elements to insert.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::push_back ( const T &  t)
inline

This method is almost identical to vector::push_back .

Parameters
tValue to add.

Referenced by Celartem::DataArray< T >::push_back(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::push_back().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
template<typename U >
void Celartem::SimpleArray< T, copyPolicy >::push_back ( const U &  t)
inline

This method is almost identical to vector::push_back .

Parameters
tValue to add.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::push_front ( const T &  t)
inline

This method is almost identical to deque::push_front .

Parameters
tValue to add.

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::push_front().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
template<typename U >
void Celartem::SimpleArray< T, copyPolicy >::push_front ( const U &  t)
inline

This method is almost identical to deque::push_front .

Parameters
tValue to add.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::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

Referenced by Celartem::DataArray< T >::resize(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::resize().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::remove ( size_t  inPos,
size_t  inCount 
)
inline

This method removes elements of the specified range and moves the elements after them toward the front of the array.

Parameters
inPosThe index of the first element to remove.
inCountThe number of elements to remove.
template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::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.

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

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::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

Referenced by Celartem::Base64T< Base64Traits >::decode(), Celartem::SimpleArray< AutoPtr< Bookmark > >::pop_back(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::push_back().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::setAllocationUnit ( size_t  inAllocationUnit)
inline

This method is to set the memory allocation unit which is used during reallocation calls.

Parameters
inAllocationUnitSpecifies the unit size for allocation. This is not the size in bytes but the count of elements.
A large value makes reallocate calls faster but result in the larger memory consumption. For use with MemoryStorage, we recommend you should choose a large value for it. 0 means using the default.
See Also
reallocate

Referenced by Celartem::SimpleArray< AutoPtr< Bookmark > >::init(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::SimpleArray().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::strictCleanup ( bool  doIt = true)
inline

This method is to control whether the array will be zero-cleared or not in the destruction/reallocation phase. You should do zero-clear of the memory block if you store some sensitive information such as user credential.

Parameters
doIttrue to do zero-clear in the destruction/reallocation phase. false to disable zero-clear.

Referenced by Celartem::DataArray< T >::duplicate(), Celartem::DataArray< T >::swap(), and Celartem::SimpleArray< AutoPtr< Bookmark > >::swap().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::swap ( SimpleArray< T, copyPolicy > &  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.

Referenced by Celartem::DjVu::PackedBitmap::swap(), and Celartem::DataArray< T >::swap().

template<class T, CopyPolicy copyPolicy = DataTraits<T>::copyPolicy>
void Celartem::SimpleArray< T, copyPolicy >::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

Referenced by Celartem::DjVu::PackedBitmap::zeroClear(), and Celartem::DataArray< T >::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