2005/5/9

     
 

class BasicArray

artefaktur
Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

BasicArray< T > Class Template Reference

#include <BasicArray.h>

Inheritance diagram for BasicArray< T >:

acdk::lang::Object acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch List of all members.

Detailed Description

template<class T>
class BasicArray< T >

BasicArray implements Java like arrays for basic types bool, char, byte, short, int, jlong, float and double Java usage: int[] iarray = new int[3]; iarray[0] = 1; ACDK usage: RintArray iarray = new intArray(3); iarray[0] = 1;.

Author:
Roger Rene Kommer
Version:
Revision
1.61
See also:
 Arrays.


Public Types

typedef T ElementType
typedef BasicArray< T > ArrayType
typedef T * iterator

Public Member Functions

 BasicArray (int count=0)
 standard constructor.

 BasicArray (int count, T firstelem)
 create array with given count of elements and fill with firstelem

 BasicArray (int count, T firstelem, T secelem)
 create pair array count should be 2

 BasicArray (const T *t, int size)
 construct basic array from native T pointer/array

template<class OT>  BasicArray (const BasicArray< OT > &other)
 cast constructor

 BasicArray (const BasicArray< T > &other)
 cast constructor

virtual ~BasicArray ()
int length () const
 returns the length of the array

int capacity () const
 return the capacity (>= length) of the array

const T * data () const
 returns a native pointer to the underlying array storage

T * data ()
 returns a native pointer to the underlying array storage

T & set (int idx, const T &t)
 sets element at given position
Exceptions:
ArrayIndexOutOfBoundsException 



const T & get (int idx) const
 get element at given position
Exceptions:
ArrayIndexOutOfBoundsException 



T & get (int idx)
 get element at given position
Exceptions:
ArrayIndexOutOfBoundsException 



T & operator[] (int idx) const
 get element at given position
Exceptions:
ArrayIndexOutOfBoundsException 



virtual bool equals (IN(RBasicArray< T >) ta)
 return true if size of arrays are equal and all elements are equal

virtual bool equals (IN(::acdk::lang::RObject) o)
 return true if object has same type of this array and size of arrays are equal and all elements are equal

virtual::acdk::lang::RObject clone ()
 creates a copy of this array

virtual::acdk::lang::RObject clone (::acdk::lang::sys::Allocator *alc)
 creates a copy of this array

void memset (T d)
 set all elements of this array to given d

void memset (T d, int offset, int l)
 set all elements of this array to given d

void memcpy (T *d, int offset, int len)
 copy given native array pointer data from given offset and length into this array

void ensureCapacity (int newSize)
 ensure that this array has given newSize this method doesn't modify the size of the array

void makeCapacity (int newSize)
void resize (int newSize)
 resize this array to given size if newSize is > as length() the values of the new elements is undefined

void append (T d)
 append the given value to this array

void insert (int idx, T newelem)
 insert the given newelem into given idx

void remove (int idx)
 removes element at given position

void concat (IN(RBasicArray< T >) s)
 append all elements of given array to this array

::acdk::lang::RString toString ()
 see in StringInline.h

int hashCode ()
 get hascode of this array

iterator begin ()
 native STL-like iterator

iterator end ()
 native STL-like iterator

pop_back ()
 STL style function.

popBack ()
 STL style function.

pop_front ()
 STL style function.

popFront ()
 STL style function.

back () const
 STL style function.

front () const
 STL style function.

void push_front (const T &t)
 STL style function.

void pushFront (const T &t)
 STL style function.

void push_back (const T &t)
 STL style function.

void pushBack (const T &t)
 STL style function.

int size () const
 STL style function.

bool empty () const
 STL style function.

peekBack (int idx)
 STL style function.

int findFirst (const T &el) const
 find the first element it is equal to given el return the index position of found element, return -1 if not found

int findLast (const T &el) const
 find the last element it is equal to given el return the index position of found element, return -1 if not found

const::acdk::lang::dmi::ClazzInfo * getElementClazzInfo ()
 return the ClazzInfo of the element

virtual::acdk::lang::dmi::ClazzInfo * getClazzInfo ()
 returns the ClazzInfo of this object instance must not be 0

virtual::acdk::lang::RClass getClass ()
::acdk::lang::RClass getMemberClass ()

Static Public Member Functions

::acdk::lang::RObject create_instance ()
::acdk::lang::RObject create_arrayInstance (T dummy)
acdk::lang::dmi::ClazzInfoclazzInfo ()
 return the ClazzInfo for this class will be re-implemented for each class by methods generated by acdkmc

::acdk::lang::RClass GetClass ()

Protected Attributes

T * _data
int _length
int _capacity


Member Typedef Documentation

template<class T>
typedef BasicArray<T> BasicArray< T >::ArrayType
 

template<class T>
typedef T BasicArray< T >::ElementType
 

template<class T>
typedef T* BasicArray< T >::iterator
 


Constructor & Destructor Documentation

template<class T>
BasicArray< T >::BasicArray int  count = 0  )  [inline]
 

standard constructor.

if count > 0 the elements will be undefied

template<class T>
BasicArray< T >::BasicArray int  count,
firstelem
[inline]
 

create array with given count of elements and fill with firstelem

template<class T>
BasicArray< T >::BasicArray int  count,
firstelem,
secelem
[inline]
 

create pair array count should be 2

template<class T>
BasicArray< T >::BasicArray const T *  t,
int  size
[inline]
 

construct basic array from native T pointer/array

template<class T>
template<class OT>
BasicArray< T >::BasicArray const BasicArray< OT > &  other  )  [inline]
 

cast constructor

template<class T>
BasicArray< T >::BasicArray const BasicArray< T > &  other  )  [inline]
 

cast constructor

template<class T>
virtual BasicArray< T >::~BasicArray  )  [inline, virtual]
 


Member Function Documentation

template<class T>
void BasicArray< T >::append d  )  [inline]
 

append the given value to this array

template<class T>
T BasicArray< T >::back  )  const [inline]
 

STL style function.

template<class T>
iterator BasicArray< T >::begin  )  [inline]
 

native STL-like iterator

template<class T>
int BasicArray< T >::capacity  )  const [inline]
 

return the capacity (>= length) of the array

template<class T>
acdk::lang::dmi::ClazzInfo * BasicArray< T >::clazzInfo  )  [inline, static]
 

return the ClazzInfo for this class will be re-implemented for each class by methods generated by acdkmc

Reimplemented from acdk::lang::ObjectBase.

template<class T>
virtual ::acdk::lang::RObject BasicArray< T >::clone ::acdk::lang::sys::Allocator alc  )  [inline]
 

creates a copy of this array

template<class T>
virtual ::acdk::lang::RObject BasicArray< T >::clone  )  [inline, virtual]
 

creates a copy of this array

Reimplemented from acdk::lang::Object.

template<class T>
void BasicArray< T >::concat IN(RBasicArray< T >)  s  )  [inline]
 

append all elements of given array to this array

template<class T>
::acdk::lang::RObject BasicArray< T >::create_arrayInstance dummy  )  [inline, static]
 

template<class T>
::acdk::lang::RObject BasicArray< T >::create_instance  )  [inline, static]
 

Reimplemented from acdk::lang::Object.

template<class T>
T* BasicArray< T >::data  )  [inline]
 

returns a native pointer to the underlying array storage

template<class T>
const T* BasicArray< T >::data  )  const [inline]
 

returns a native pointer to the underlying array storage

template<class T>
bool BasicArray< T >::empty  )  const [inline]
 

STL style function.

template<class T>
iterator BasicArray< T >::end  )  [inline]
 

native STL-like iterator

template<class T>
void BasicArray< T >::ensureCapacity int  newSize  )  [inline]
 

ensure that this array has given newSize this method doesn't modify the size of the array

template<class T>
virtual bool BasicArray< T >::equals IN(::acdk::lang::RObject o  )  [inline, virtual]
 

return true if object has same type of this array and size of arrays are equal and all elements are equal

template<class T>
virtual bool BasicArray< T >::equals IN(RBasicArray< T >)  ta  )  [inline, virtual]
 

return true if size of arrays are equal and all elements are equal

template<class T>
int BasicArray< T >::findFirst const T &  el  )  const [inline]
 

find the first element it is equal to given el return the index position of found element, return -1 if not found

template<class T>
int BasicArray< T >::findLast const T &  el  )  const [inline]
 

find the last element it is equal to given el return the index position of found element, return -1 if not found

template<class T>
T BasicArray< T >::front  )  const [inline]
 

STL style function.

template<class T>
T& BasicArray< T >::get int  idx  )  [inline]
 

get element at given position

Exceptions:
ArrayIndexOutOfBoundsException 

template<class T>
const T& BasicArray< T >::get int  idx  )  const [inline]
 

get element at given position

Exceptions:
ArrayIndexOutOfBoundsException 

template<class T>
acdk::lang::RClass BasicArray< T >::getClass  )  [inline, virtual]
 

Reimplemented from acdk::lang::Object.

template<class T>
acdk::lang::RClass BasicArray< T >::GetClass  )  [inline, static]
 

Reimplemented from acdk::lang::Object.

template<class T>
virtual ::acdk::lang::dmi::ClazzInfo* BasicArray< T >::getClazzInfo  )  [inline, virtual]
 

returns the ClazzInfo of this object instance must not be 0

Implements acdk::lang::dmi::StdDispatch.

template<class T>
const ::acdk::lang::dmi::ClazzInfo* BasicArray< T >::getElementClazzInfo  )  [inline]
 

return the ClazzInfo of the element

template<class T>
acdk::lang::RClass BasicArray< T >::getMemberClass  )  [inline]
 

template<class T>
int BasicArray< T >::hashCode  )  [inline, virtual]
 

get hascode of this array

Reimplemented from acdk::lang::Object.

template<class T>
void BasicArray< T >::insert int  idx,
newelem
[inline]
 

insert the given newelem into given idx

template<class T>
int BasicArray< T >::length  )  const [inline]
 

returns the length of the array

template<class T>
void BasicArray< T >::makeCapacity int  newSize  )  [inline]
 

template<class T>
void BasicArray< T >::memcpy T *  d,
int  offset,
int  len
[inline]
 

copy given native array pointer data from given offset and length into this array

template<class T>
void BasicArray< T >::memset d,
int  offset,
int  l
[inline]
 

set all elements of this array to given d

template<class T>
void BasicArray< T >::memset d  )  [inline]
 

set all elements of this array to given d

template<class T>
T& BasicArray< T >::operator[] int  idx  )  const [inline]
 

get element at given position

Exceptions:
ArrayIndexOutOfBoundsException 

template<class T>
T BasicArray< T >::peekBack int  idx  )  [inline]
 

STL style function.

template<class T>
T BasicArray< T >::pop_back  )  [inline]
 

STL style function.

template<class T>
T BasicArray< T >::pop_front  )  [inline]
 

STL style function.

template<class T>
T BasicArray< T >::popBack  )  [inline]
 

STL style function.

template<class T>
T BasicArray< T >::popFront  )  [inline]
 

STL style function.

template<class T>
void BasicArray< T >::push_back const T &  t  )  [inline]
 

STL style function.

template<class T>
void BasicArray< T >::push_front const T &  t  )  [inline]
 

STL style function.

template<class T>
void BasicArray< T >::pushBack const T &  t  )  [inline]
 

STL style function.

template<class T>
void BasicArray< T >::pushFront const T &  t  )  [inline]
 

STL style function.

template<class T>
void BasicArray< T >::remove int  idx  )  [inline]
 

removes element at given position

template<class T>
void BasicArray< T >::resize int  newSize  )  [inline]
 

resize this array to given size if newSize is > as length() the values of the new elements is undefined

template<class T>
T& BasicArray< T >::set int  idx,
const T &  t
[inline]
 

sets element at given position

Exceptions:
ArrayIndexOutOfBoundsException 

template<class T>
int BasicArray< T >::size  )  const [inline]
 

STL style function.

template<typename T>
acdk::lang::RString BasicArray< T >::toString  )  [inline, virtual]
 

see in StringInline.h

Reimplemented from acdk::lang::Object.


Member Data Documentation

template<class T>
int BasicArray< T >::_capacity [protected]
 

template<class T>
T* BasicArray< T >::_data [protected]
 

template<class T>
int BasicArray< T >::_length [protected]