User Documentation
RAVL, Recognition And Vision Library
DEVELOP HOME PAGE CLASS LIST CONTENTS
Ravl - Core - Arrays - 1D - Array1dC<class DataT>
 

  PUBLIC
Array1dC::Array1dC(void)
Array1dC::Array1dC(const Slice1dC &,bool)
Array1dC::Array1dC(SizeT)
Array1dC::Array1dC(IndexC,IndexC)
Array1dC::Array1dC(IntT,IntT)
Array1dC::Array1dC(const IndexRangeC &)
Array1dC::Array1dC(istream &)
Array1dC::Array1dC(const Array1dC &)
Array1dC::Array1dC(DataT *,const IndexRangeC &,bool)
Array1dC::Array1dC(BufferC &,const IndexRangeC &)
Array1dC::Array1dC(BufferC &,const RangeBufferAccessC &)
Array1dC::Array1dC(const Array1dC &,const IndexRangeC &)
Array1dC::Array1dC(const Array1dC &,IndexC)
Array1dC::Array1dC(const SArray1dC &)
Array1dC::Copy(void) const
Array1dC::Copy(const Array1dC &)
Array1dC::Copy(const IndexRangeC &,const IndexC)
Array1dC::Copy(const IndexC,const Array1dC &)
Array1dC::Copy(const Slice1dC &)
Array1dC::operator =(const Array1dC &)
Array1dC::Array1d(void) const
Array1dC::Array1d(void)
Array1dC::SArray1d(bool)
Array1dC::Slice1d(void)
Array1dC::Extend(SizeT) const
Array1dC::Append(const Array1dC &)
Array1dC::IsSharing(const Array1dC &) const
Array1dC::Buffer(void)
Array1dC::Buffer(void) const
Array1dC::operator +(const Array1dC &) const
Array1dC::operator -(const Array1dC &) const
Array1dC::operator *(const Array1dC &) const
Array1dC::operator /(const Array1dC &) const
Array1dC::operator *(const DataT &) const
Array1dC::operator /(const DataT &) const
Array1dC::operator +(const DataT &) const
Array1dC::operator -(const DataT &) const
Array1dC::operator +=(const Array1dC &)
Array1dC::operator -=(const Array1dC &)
Array1dC::operator *=(const Array1dC &)
Array1dC::operator /=(const Array1dC &)
Array1dC::operator +=(const DataT &)
Array1dC::operator -=(const DataT &)
Array1dC::operator *=(const DataT &)
Array1dC::operator /=(const DataT &)
Array1dC::SumSqr(void) const
Array1dC::Sum(void) const
Array1dC::Apply(DataT (*op)(const DataT & func) ) const
Array1dC::ApplyIP(void (*op)(DataT & func) )
Array1dC::From(IndexC)
Array1dC::From(IndexC,UIntT)
Array1dC::After(IndexC)
Array1dC::SetIMin(IndexC)
Array1dC::SetIMax(IndexC)
RangeBufferAccessC::operator =(DataT *)
RangeBufferAccessC::DataStart(void)
RangeBufferAccessC::DataStart(void) const
RangeBufferAccessC::Size(void) const
RangeBufferAccessC::Range(void) const
RangeBufferAccessC::IMin(void) const
RangeBufferAccessC::IMax(void) const
RangeBufferAccessC::operator [](IndexC) const
RangeBufferAccessC::operator [](IndexC)
RangeBufferAccessC::RAccess(void) const
RangeBufferAccessC::IsEmpty(void) const
RangeBufferAccessC::Contains(IndexC) const
RangeBufferAccessC::IsOverlapping(const RangeBufferAccessC &) const
RangeBufferAccessC::operator +=(SizeT)
RangeBufferAccessC::operator +(SizeT) const
RangeBufferAccessC::ShrinkHigh(SizeT)
RangeBufferAccessC::ShiftIndexes(IndexC)
RangeBufferAccessC::SetSubRange(IndexC,IndexC)
RangeBufferAccessC::Swap(RangeBufferAccessC &)
RangeBufferAccessC::Swap(IndexC,IndexC)
RangeBufferAccessC::Attach(const RangeBufferAccessC &)
RangeBufferAccessC::Attach(const BufferAccessC &,const IndexRangeC &)
RangeBufferAccessC::BufferFrom(IndexC)
RangeBufferAccessC::BufferFrom(IndexC,UIntT)
RangeBufferAccessC::Fill(const DataT &)
RangeBufferAccessC::Reverse(void)
RangeBufferAccessC::operator ==(const RangeBufferAccessC &) 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

   Array1dC<class DataT>   
 
1 Dimensional array
 
include "Ravl/Array1d.hh"
Created:2/12/1993 
User Level:Basic
Library:RavlCore
Example:exArray1d.cc
In Scope:RavlN

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

BIG OBJECT

Parent Classes: Enumerated types:
enum ExtensionT { SoftExt, HardExt } ;

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

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

typedef Array1dIterC<DataT> IteratorT;
Type of iterator.

Variables:
Methods:

Type definitions.

Constructors, copy, assigment, and destructor
Array1dC()
Creates an empty array.

Array1dC(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.

Array1dC(SizeT dim)
An array with the range <0, 'dim'-1>.

Array1dC(IndexC min,IndexC max)
An array with the range .

Array1dC(IntT min,IntT max)
An array with the range .

Array1dC(const IndexRangeC & range)
An array with the range <'range'.Min(), 'range'.Max()>.

Array1dC(istream & s)
Creates an 1-dimensional array from the input stream.

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

Array1dC(DataT * data,const IndexRangeC & range,bool removable = true)
An array is created from the memory location 'data' with the range of access in <'range'.Min(), 'range'.Max()>.


'data' is assumed to point to the location 'range.min()'

If flag 'removable' is false, 'data' is not deallocated during destructing of the array, unless 'removable' is set to true.


Array1dC(BufferC<DataT> & bf,const IndexRangeC & range)
Creates the array with limits 'range' using the buffer 'bf'.

Array1dC(BufferC<DataT> & bf,const RangeBufferAccessC<DataT> & rbf)
Creates the array in 'bf' using access rbf..

Array1dC(const Array1dC<DataT> & vv,const IndexRangeC & range)
The subarray of the 'vv' with the 'range'.

Array1dC(const Array1dC<DataT> & vv,IndexC origin)
Create a new access to array vv with the origin at the given offset.

Array1dC(const SArray1dC<DataT> & oth)
Construct an array from a SArray1dC.
Note: This does NOT make a copy, it just creates another access to the buffer.

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

Array1dC<DataT> & Copy(const Array1dC<DataT> & orig)
Copies values from the 'orig' array into this array.
Only items from the overlapping part of the ranges are copied. The function returns this array.

Array1dC<DataT> & Copy(const IndexRangeC & r,const IndexC off)
Copies values from the index range 'r' into the new position with the offset 'off'.
Only those items which original position and destination are inside of the index range of this array are copied.

Array1dC<DataT> & Copy(const IndexC off,const Array1dC<DataT> & a)
Copies the maximum possible part of array 'a' into this array.
The first element of array 'a' is placed into the element of this array with index 'off'. The functio returns this array.

Array1dC<DataT> & Copy(const Slice1dC<DataT> & data)
Copy data from slice into this array.

const Array1dC<DataT> & operator =(const Array1dC<DataT> & vv)
Assigment, as for a BIG_OBJECT.
Access to the object elements. ------------------------------

const Array1dC<DataT> & Array1d() const
Access to the whole array.

Array1dC<DataT> & Array1d()
Access to the whole array.

SArray1dC<DataT> SArray1d(bool doShift = false)
Create an access as an sarray.
NB. This does NOT copy the data, it only make a new access to it. If doShift is true element IMin() will become element 0 of the SArray while the size stays the same. Otherwise if the array does not contain element '0' an error will occure in check mode, when optimised is enabled an empty array will be returned.

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

Array representation modifications.
Array1dC<DataT> Extend(SizeT n) const
Returns the array whose range is extended by adding 'n' items with default value from both limits of the range.
This array value are copied into the same index positions in the returned array.

Array1dC<DataT> & Append(const Array1dC<DataT> & a)
This array is extended by the length of the array 'a' and the contents of both arrays are copied to it.
The function supports empty arrays. Logical operations. -------------------

bool IsSharing(const Array1dC<DataT> & arr) const
Returns true if this array and the array 'arr' are subarrays of the the same array.

Special operations.
BufferC<DataT> & Buffer()
Access buffer in which data is stored.

const BufferC<DataT> & Buffer() const
Access buffer in which data is stored.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Array1dC<DataT> Apply(DataT (*op)(const DataT & func) ) const
Apply a function to each item in the array.
The results are put in a new array.

Array1dC<DataT> & ApplyIP(void (*op)(DataT & func) )
Apply a function In Place to each item in the array.
the changes are made to this array.

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

Array1dC<DataT> From(IndexC offset,UIntT size)
Return array from offset for size elements..
If offset is larger than the array an empty array is returned.

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

bool SetIMin(IndexC imin)
Attempt to change the start of the array.
This checks the index is within the allocated buffer.

bool SetIMax(IndexC imax)
Attempty to change the end of the array.
This checks the index is within the allocated buffer.

#include "Ravl/RBfAcc.hh"
const RangeBufferAccessC<DataT> & operator =(DataT * bp)
Changes the reference element to the element pointed by 'bp'.
Access to the object -------------------- inline const BufferAccessC & Access(void) const; Returns this object.

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

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

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

const 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 [](IndexC i) const
Read-only access to the ('i'+1)-th element of the buffer.

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

const RangeBufferAccessC<DataT> & RAccess(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'.

bool IsOverlapping(const RangeBufferAccessC<DataT> & acc) const
Returns TRUE if this access has an item with the same index as an item of the access 'acc'. Modifications of the access ---------------------------

const RangeBufferAccessC<DataT> & operator +=(SizeT i)
Changes indeces of the access to be 'i' units higher.

RangeBufferAccessC<DataT> operator +(SizeT i) const
Creates the new access object with the indeces 'i' units higher than those used in this access object.

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

void ShiftIndexes(IndexC offset)
All indexes of the items will be changed by 'offset'.
The range will be shifted by -offset.

void SetSubRange(IndexC newMin,IndexC newMax)
Constrain the indexs that can be accessed from the array.
The range of indexes of this array will be constrained to cover the index range at most.

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

void Swap(IndexC i1,IndexC i2)
Exchanges the contents of elements with indeces 'i1' and 'i2'.

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

void Attach(const BufferAccessC<DataT> & b,const IndexRangeC & r)
Changes this buffer access to have the access rights as 'b' limited by range 'r'. so the first element in 'b' is accessed at 'r.Min()'.

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

RangeBufferAccessC<DataT> BufferFrom(IndexC 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. Modifications of the buffer contents ------------------------------------

void Fill(const DataT & d)
Fill the buffer with the value 'd'.

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

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

#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: 2/12/1993, Documentation by CxxDoc: Tue Aug 13 09:59:02 2002