Developer Documentation
RAVL, Recognition And Vision Library
USER HOME PAGE CLASS LIST CONTENTS
Ravl - Core - Arrays - 1D - SArray1dC<class DataT>
 

  PUBLIC
SArray1dC::SArray1dC(void)
SArray1dC::SArray1dC(const SizeT)
SArray1dC::SArray1dC(const Slice1dC &,bool)
SArray1dC::SArray1dC(const PairC &)
SArray1dC::SArray1dC(const SArray1dC &)
SArray1dC::SArray1dC(DataT *,const SizeT,bool)
SArray1dC::SArray1dC(BufferC &,SizeT,SizeT)
SArray1dC::SArray1dC(const SArray1dC &,const SizeT,SizeT)
SArray1dC::SArray1dC(const BufferC &,const SizeBufferAccessC &)
SArray1dC::Copy(void) const
SArray1dC::Copy(UIntT) const
SArray1dC::CopyFrom(const Slice1dC &)
SArray1dC::operator =(const SArray1dC &)
SArray1dC::operator +(const SArray1dC &) const
SArray1dC::operator -(const SArray1dC &) const
SArray1dC::operator *(const SArray1dC &) const
SArray1dC::operator /(const SArray1dC &) const
SArray1dC::operator *(const DataT &) const
SArray1dC::operator /(const DataT &) const
SArray1dC::operator +(const DataT &) const
SArray1dC::operator -(const DataT &) const
SArray1dC::operator +=(const SArray1dC &)
SArray1dC::operator -=(const SArray1dC &)
SArray1dC::operator *=(const SArray1dC &)
SArray1dC::operator /=(const SArray1dC &)
SArray1dC::operator +=(const DataT &)
SArray1dC::operator -=(const DataT &)
SArray1dC::operator *=(const DataT &)
SArray1dC::operator /=(const DataT &)
SArray1dC::Sum(void) const
SArray1dC::SumSqr(void) const
SArray1dC::SArray1d(void) const
SArray1dC::SArray1d(void)
SArray1dC::Slice1d(void)
SArray1dC::Append(const SArray1dC &)
SArray1dC::Join(const SArray1dC &) const
SArray1dC::From(UIntT)
SArray1dC::From(UIntT,UIntT)
SArray1dC::After(UIntT)
SArray1dC::Buffer(void)
SArray1dC::Buffer(void) const
SArray1dC::Sort(void)
SArray1dC::operator ==(const SArray1dC &)
SArray1dC::Hash(void) const
SArray1dC::DataStart(void) const
SArray1dC::SArray1dC(BufferC &,DataT *,const SizeT)
SizeBufferAccessC::operator =(DataT *)
SizeBufferAccessC::DataStart(void) const
SizeBufferAccessC::Size(void) const
SizeBufferAccessC::Limits(void) const
SizeBufferAccessC::Range(void) const
SizeBufferAccessC::IMin(void) const
SizeBufferAccessC::IMax(void) const
SizeBufferAccessC::operator [](const IndexC) const
SizeBufferAccessC::operator [](const IndexC)
SizeBufferAccessC::SAccess(void) const
SizeBufferAccessC::IsEmpty(void) const
SizeBufferAccessC::Contains(IndexC) const
SizeBufferAccessC::ShrinkHigh(SizeT)
SizeBufferAccessC::Swap(SizeBufferAccessC &)
SizeBufferAccessC::Attach(const SizeBufferAccessC &)
SizeBufferAccessC::Attach(const BufferAccessC &,SizeT)
SizeBufferAccessC::operator +(SizeT) const
SizeBufferAccessC::Fill(const DataT &)
SizeBufferAccessC::CopyFrom(const SizeBufferAccessC &)
SizeBufferAccessC::Reverse(void)
SizeBufferAccessC::BufferFrom(UIntT)
SizeBufferAccessC::BufferFrom(UIntT,UIntT)
SizeBufferAccessC::operator ==(const SizeBufferAccessC &) const
SizeBufferAccessC::Copy(void) const
BufferAccessC::ReferenceElm(void) const
BufferAccessC::ReferenceVoid(void) const
BufferAccessC::IsValid(void) const
BufferAccessC::operator [](const IndexC) const
BufferAccessC::operator [](const IndexC)
BufferAccessC::operator +=(IndexC)
BufferAccessC::operator -=(IndexC)
BufferAccessC::operator -(IndexC) const
BufferAccessC::operator +(IndexC) const
BufferAccessC::operator ==(const BufferAccessC &) const
BufferAccessC::operator !=(const BufferAccessC &) const

   SArray1dC<class DataT>   
 
A simple 1 dimensional array
 
include "Ravl/SArray1d.hh"
Created:21/2/1996 
Source file:Ravl/Core/Container/SArray/SArray1d.hh
User Level:Advanced
Library:RavlCore
In Scope:RavlN

Comments:
The class SArray1dC is a simple reference counted container with a fixed number of items which can accessed randomly using indexing. The item is expected to have a default constructor, a copy constructor, and an assigment. The class SArray1dC is a big object, eg. it has a reference counter.

Parent Classes: Derived Classes: Typedefs:
typedef DataT ElementT;
Allow function templates to find type of array.

typedef IndexC KeyT;
Allow function templates to find type of index.

typedef SArray1dIterC<DataT> IteratorT;
Type of iterator.

Variables:
BufferC buff;
The reference counted storage.

Methods:

Constructors, assigment, and destructor
SArray1dC()
Create an array of zero length

SArray1dC(const SizeT dim)
Creates an uninitialized array with the range <0, 'dim'-1>.

SArray1dC(const Slice1dC<DataT> & slice,bool alwaysCopy = true)
Make an array from a slice.
This will create an array with the values from the slice. if the stride of the slice is not 1, and alwaysCopy is true the a copy is done.

SArray1dC(const PairC<DataT> & pr)
Creates an array with two elements from a PairC object.

SArray1dC(const SArray1dC<DataT> & vv)
Another access to the array 'vv'.

SArray1dC(DataT * data,const SizeT dim,bool removable = true)
The array is created from the memory location 'data' with the range of access in <0, 'dim'-1>.
If flag 'removable' is false, 'data' is not deallocated during destructing of the array.

SArray1dC(BufferC<DataT> & bf,SizeT dim,SizeT offsetInBuff = 0)
Creates the array of size 'dim' using the buffer 'bf'.
Use buffer 'bf', make access of 'dim' elements. the start of the buffer should be 'offsetInBuff' elements into the buffer.

SArray1dC(const SArray1dC<DataT> & vv,const SizeT dim,SizeT offsetInBuff = 0)
The subarray of the 'vv' with size 'dim'.

SArray1dC(const BufferC<DataT> & vv,const SizeBufferAccessC<DataT> & sbf)
Construct from a buffer an size buffer access.

SArray1dC<DataT> Copy() const
Creates a new physical copy of the array.

SArray1dC<DataT> Copy(UIntT extend) const
Creates a new physical copy of the array.
'extend' extra elements initalised by the default constuctor are appended to the end of the array.

void CopyFrom(const Slice1dC<DataT> & slice)
Copy contents of slice into array.
The first element of the slice is copied to element 0 of this array, second to 1 etc. If this array isn't large enough an exception is thrown.

const SArray1dC<DataT> & operator =(const SArray1dC<DataT> & vv)
Assign this handle to the data in VV.

SArray1dC<DataT> operator +(const SArray1dC<DataT> & arr) const
Sums 2 numerical arrays.
The operator returns the result as a new array.

SArray1dC<DataT> operator -(const SArray1dC<DataT> & arr) const
Subtract 2 numerical arrays.
The operator returns the result as a new array.

SArray1dC<DataT> operator *(const SArray1dC<DataT> & arr) const
Mutliplies 2 numerical arrays.
The operator returns the result as a new array.

SArray1dC<DataT> operator /(const SArray1dC<DataT> & arr) const
Divides 2 numerical arrays.
The operator returns the result as a new array.

SArray1dC<DataT> operator *(const DataT & number) const
Multiplys the array by the 'number'.
The operator returns the result as a new array.

SArray1dC<DataT> operator /(const DataT & number) const
Divides all array items by the 'number'.
The operator returns the result as a new array.

SArray1dC<DataT> operator +(const DataT & number) const
Adds 'number' to the array.
The operator returns the result as a new array.

SArray1dC<DataT> operator -(const DataT & number) const
Subtracts 'number' from all array items.
The operator returns the result as a new array.

const SArray1dC<DataT> & operator +=(const SArray1dC<DataT> & arr)
Adds the 2nd array to this array.

const SArray1dC<DataT> & operator -=(const SArray1dC<DataT> & arr)
Subtracts the 2nd array from this array.

const SArray1dC<DataT> & operator *=(const SArray1dC<DataT> & arr)
Multiplies the 2nd array to this array.

const SArray1dC<DataT> & operator /=(const SArray1dC<DataT> & arr)
Divides the 2nd array from this array.

const SArray1dC<DataT> & operator +=(const DataT & number)
Adds 'number' to all array items.

const SArray1dC<DataT> & operator -=(const DataT & number)
Subtracts 'number' from all array items.

const SArray1dC<DataT> & operator *=(const DataT & number)
Multiplies the array by the 'number'.

const SArray1dC<DataT> & operator /=(const DataT & number)
Divides the array elements by the 'number'.

DataT Sum() const
Calculate the sum of all elements in the array

DataT SumSqr() const
Calculate the sum of the squares of all elements in the array

Access to the object and its parts.
const SArray1dC<DataT> & SArray1d() const
Access to the whole constant array.

SArray1dC<DataT> & SArray1d()
Access to the whole array.

Slice1dC<DataT> Slice1d()
Access array as a slice.

Modifications of the representation
SArray1dC<DataT> & Append(const SArray1dC<DataT> & a)
This array is extended by the length of the array 'a' and the contents of both arrays are copied to it. Empty arrays are handled correctly.

SArray1dC<DataT> Join(const SArray1dC<DataT> & Oth) const
Join this Array and another into a new Array which is returned. This does not change either of its arguments. This is placed in the array first, followed by 'Oth'.

SArray1dC<DataT> From(UIntT offset)
Return array from offset to the end of the array.
If offset is larger than the array an empty array is returned,

SArray1dC<DataT> From(UIntT offset,UIntT size)
Return array from offset to the end of the array.
If offset is larger than the array an empty array is returned,

SArray1dC<DataT> After(UIntT offset)
Return array after offset to the end of the array.
If offset is larger than the array an empty array is returned,

Special operations
BufferC<DataT> & Buffer()
Access base data buffer.
Experts only.

const BufferC<DataT> & Buffer() const
Constant access base data buffer.
Experts only.

void Sort()
Sort the array in place.
This does a simple bubble sort. FIXME:- we could do with something better!

bool operator ==(const SArray1dC<DataT> & vv)
Comparison operator
Returns true if the two arrays are the same length and their contents are identical.

UIntT Hash() const
Compute a hash value for the array.

DataT * DataStart() const
Returns the address of element 0.
If the array has zero length a null pointer may be returned.

SArray1dC(BufferC<DataT> & bf,DataT * start,const SizeT dim)
Creates the array of size 'dim' using the buffer 'bf', with 0'th element at start.
Used for building SArray's from Arrays.

#include "Ravl/SBfAcc.hh"
const SizeBufferAccessC<DataT> & operator =(DataT * bp)
Changes the reference element to the element pointed by 'bp'. Access to the object --------------------

DataT * DataStart() const
Returns the address of the first element of the buffer.

SizeT Size() const
Returns the number of elements of the array.

IndexRangeC Limits() const
Returns the usable range of indeces expressed by this object.

IndexRangeC Range() const
Returns the usable range of indeces expressed by this object.

IndexC IMin() const
Returns the minimum index of the range of this access.

IndexC IMax() const
Returns the maximum index of the range of this access.

const DataT & operator [](const IndexC i) const
Read-only access to the ('i'+1)-th element of the buffer.

DataT & operator [](const IndexC i)
Read-write access to the ('i'+1)-th element of the buffer.

const SizeBufferAccessC<DataT> & SAccess(void) const
Returns this object. Logical functions -----------------

bool IsEmpty() const
Returns TRUE if the size of the array is zero.

bool Contains(IndexC i) const
Returns TRUE if the array contains an item with the index 'i'. Modifications of the access ---------------------------

SizeT ShrinkHigh(SizeT k)
Changes the number of elements by subtracting the last 'k' elements.

const SizeBufferAccessC<DataT> & Swap(SizeBufferAccessC<DataT> & a)
Exchanges the contents of this buffer with buffer 'a'.

void Attach(const SizeBufferAccessC<DataT> & b)
Changes this buffer access to have the same access rights as 'b'.

void Attach(const BufferAccessC<DataT> & b,SizeT size)
Changes this buffer access to have the access rights as 'b' limited for 'size' elements.

SizeBufferAccessC<DataT> operator +(SizeT i) const
Creates the new access object shifted 'i' elements to the right (towards next elements). The size is descreased to fit the the original range of this access. Modifications of the buffer contents ------------------------------------

void Fill(const DataT & d)
'd' value is assigned to all elements of the buffer.

void CopyFrom(const SizeBufferAccessC<DataT> & oth)
Copy contents of another buffer into this one.
NB. Buffers MUST be the same length.

void Reverse()
Reverse the order of elements in this array in place.

SizeBufferAccessC<DataT> BufferFrom(UIntT first)
Get an access for this buffer starting from the 'first' element to the end of the buffer.

SizeBufferAccessC<DataT> BufferFrom(UIntT first,UIntT len)
Get an access for this buffer starting from the 'first' element for 'len' elements.
An error will be generated if the requested buffer isn't contains within this one.

bool operator ==(const SizeBufferAccessC<DataT> & ba) const
Are two accesses the same ?

SizeBufferAccessC<DataT> Copy(void) const
Returns a physical copy of this access pointing to the physical copy of the accessed buffer in the range accessible by this access. The new copy is necessary to attach to reference counted buffer or to delete at the end of the life of this object.

#include "Ravl/BufferAccess.hh"
DataT * ReferenceElm() const
Returns the pointer to the reference element of the attached buffer. The reference element need not to be the valid element of the buffer.

void * ReferenceVoid() const
Returns the pointer to the reference element of the attached buffer. The reference element need not to be the valid element of the buffer. The function is intended to be used in printing.

bool IsValid() const
Returns TRUE if this buffer access is not a default access object.

const DataT & operator [](const IndexC i) const
Read-only access to the ('i'+1)-th element of the buffer.

DataT & operator [](const IndexC i)
Read-write access to the ('i'+1)-th element of the buffer.

const BufferAccessC<DataT> & operator +=(IndexC ind)
Inplace Add index to start position.

const BufferAccessC<DataT> & operator -=(IndexC ind)
Inplace Subtract index from start position.

BufferAccessC<DataT> operator -(IndexC ind) const
Substract value from position, and return it as a new value.

BufferAccessC<DataT> operator +(IndexC ind) const
Substract value from position, and return it as a new value.

bool operator ==(const BufferAccessC<DataT> & ba) const
Are two accesses the same ?

bool operator !=(const BufferAccessC<DataT> & ba) const
Are two accesses the same ?


Maintainer:Radek Marik, Created: 21/2/1996, Documentation by CxxDoc: Tue Aug 13 09:59:30 2002