VectorData Class Template Reference

VectorData Class. More...

Inheritance diagram for VectorData:

Inheritance graph
[legend]
Collaboration diagram for VectorData:

Collaboration graph
[legend]
List of all members.

STL compatibility

typedef T value_type
typedef T & reference
typedef const T & const_reference
typedef vectordataIterator iterator
typedef const vectordataIterator const_iterator
typedef size_t size_type
typedef ptrdiff_t difference_type
size_type max_size ()
bool empty ()
void push_back (const T &value)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
iterator erase (iterator pos)
void clear ()

Constructors

 VectorData ()
 VectorData (u_int size)
 VectorData (u_int size, T &value)
 VectorData (VectorData< T > &src, u_int idStart, u_int idEnd)
 VectorData (const T *r, u_int dim)
 VectorData (const VectorData &src)
VectorDataoperator= (const VectorData &src)
 ~VectorData ()

Informations about VectorData

u_int size () const
bool isView () const
bool operator== (const VectorData< T > &b)
bool operator!= (const VectorData< T > &b)

Operations on VectorData

void zeroing ()
void setAll (const T &value)
void erase (int id)
VectorData< T > & assign (u_int num, const T &value)
VectorData< T > & assign (const VectorData< T > &src)
VectorData< T > & assign (const VectorData< T > &src, u_int sizec)
VectorData< T > & assign_reverse (const VectorData< T > &src)
VectorData< int > & compare (const VectorData< T > &b, VectorData< int > &comparison)
T & operator[] (u_int index)
const T & operator[] (u_int index) const
T & at (u_int index)
const T & at (u_int index) const
void resize (u_int newsize)
void append (const T &value)
VectorData< T > & operator<< (const T &value)

Operations on VectorData views

void setView (u_int idStart, u_int idEnd)
void convertToView (VectorData< T > &src, u_int idStart, u_int idEnd)

Public Types

enum  t_notify

Protected Member Functions

T * rawdata () const
virtual void notify (const NotifyEvent &event)

Protected Attributes

u_int vsize
u_int allocated
T * data
bool view
u_int idstart
u_int idend
VectorDataobserved

Classes

class  vectordataIterator

Detailed Description

template<class T>
class nnfw::VectorData< T >

Motivation
Create a VectorData abstract type for storing data in dynamic and efficient way
Description
Warnings


Member Typedef Documentation

typedef T value_type

Value type

typedef T& reference

Reference type

typedef const T& const_reference

Const Reference type

typedef vectordataIterator iterator

Iterator

typedef const vectordataIterator const_iterator

Const Iterator

typedef size_t size_type

Size type

typedef ptrdiff_t difference_type

Difference pointer type


Member Enumeration Documentation

enum t_notify

Type of Notification


Constructor & Destructor Documentation

VectorData (  )  [inline]

Default Constructor

VectorData ( u_int  size  )  [inline]

Construct a vector of dimension size setting all values to defaul constructor of T

VectorData ( u_int  size,
T &  value 
) [inline]

Construct a vector of dimension size setting all the values as specified

VectorData ( VectorData< T > &  src,
u_int  idStart,
u_int  idEnd 
) [inline]

Construct a VectorData view

VectorData ( const T *  r,
u_int  dim 
) [inline]

Construct by copying data from const T* vector

VectorData ( const VectorData< T > &  src  )  [inline]

The Copy-Constructor always allocate new memory and copies the data, even if the source VectorData is a view. Hence, a copy of a VectorData view is not a view but a new copy of data viewed by source.

Parameters:
src the VectorData to be copied

~VectorData (  )  [inline]

Destructor


Member Function Documentation

VectorData& operator= ( const VectorData< T > &  src  )  [inline]

The assignment operator, check the size of itself and resize itself if necessary, and copy the data using the assing method.
This not change the nature of this VectorData, if it's a view the source data are assigned to the data viewed and this remains a VectorData view of the same VectorData.

Parameters:
src the VectorData to be copied

u_int size (  )  const [inline]

Return the size of VectorData

bool isView (  )  const [inline]

Return True if it is a VectorData view

bool operator== ( const VectorData< T > &  b  )  [inline]

Equal Operator

bool operator!= ( const VectorData< T > &  b  )  [inline]

Not-Equal Operator

void zeroing (  )  [inline]

Set all values to default value of T, in other words to T()

void setAll ( const T &  value  )  [inline]

Set all values to value

void erase ( int  id  )  [inline]

Erase the element at position specified

VectorData<T>& assign ( u_int  num,
const T &  value 
) [inline]

Assign to first num element the value passed

VectorData<T>& assign ( const VectorData< T > &  src  )  [inline]

Assignment method. The sizes of VectorData must be the same

VectorData<T>& assign ( const VectorData< T > &  src,
u_int  sizec 
) [inline]

Assignment method allow to copy data from a VectorData to another VectorData with different size.

Parameters:
sizec the size of data to be assigned

VectorData<T>& assign_reverse ( const VectorData< T > &  src  )  [inline]

Reverse Assignment method. The sizes of VectorData must be the same

VectorData<int>& compare ( const VectorData< T > &  b,
VectorData< int > &  comparison 
) [inline]

Element-by-element comparison between the two VectorData. It returns a boolean array of the same size, with elements set to true (1) where the values are the same, and elements set to false (0) where they are not.

Parameters:
b the 'right' VectorData to compare with itself
comparison the VectorData where to register the results (this is returned by method)
Warning:
This method require that the template class T has the operator== defined

T& operator[] ( u_int  index  )  [inline]

Indexing operator

Warning:
Boundary check activated only when DEBUG if defined

const T& operator[] ( u_int  index  )  const [inline]

Indexing operator (Const Version)

Warning:
Boundary check activated only when DEBUG if defined

T& at ( u_int  index  )  [inline]

Accessing method

Warning:
Boundary check activated only when DEBUG if defined

const T& at ( u_int  index  )  const [inline]

Accessing method (Const Version)

Warning:
Boundary check activated only when DEBUG if defined

void resize ( u_int  newsize  )  [inline]

Resize the VectorData

void append ( const T &  value  )  [inline]

Append an element; the dimesion increase by one

VectorData<T>& operator<< ( const T &  value  )  [inline]

Append Operator; the dimesion increase by one

void setView ( u_int  idStart,
u_int  idEnd 
) [inline]

Configure the indexes of starting and ending of this VectorData view.
If VectorData is not a view, then it will shows an error message

void convertToView ( VectorData< T > &  src,
u_int  idStart,
u_int  idEnd 
) [inline]

Convert this VectorData to a view of VectorData src passed

size_type max_size (  )  [inline]

Max size allowed

bool empty (  )  [inline]

Is Empty

void push_back ( const T &  value  )  [inline]

Append an element

iterator begin (  )  [inline]

Iterator at initial position

const_iterator begin (  )  const [inline]

Iterator at initial position

iterator end (  )  [inline]

Iterator at past-end position

const_iterator end (  )  const [inline]

Iterator at past-end position

iterator erase ( iterator  pos  )  [inline]

Erase method

void clear (  )  [inline]

Erase All elements

T* rawdata (  )  const [inline, protected]

Raw Data

Reimplemented in RealVec.

virtual void notify ( const NotifyEvent event  )  [inline, protected, virtual]

Notify to viewers that 'data' is changed

Implements Observer.


Member Data Documentation

u_int vsize [protected]

The actual size of VectorData

u_int allocated [protected]

The allocated space

T* data [protected]

Data

bool view [protected]

Is View

u_int idstart [protected]

start index

u_int idend [protected]

end index

VectorData* observed [protected]

Observed VectorData


The documentation for this class was generated from the following file:
BerliOS Developer Logo Valid XHTML 1.0 Transitional Valid CSS!