Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

FD::Vector< T > Class Template Reference

#include <Vector.h>

Inheritance diagram for FD::Vector< T >:

Inheritance graph
[legend]
Collaboration diagram for FD::Vector< T >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef T basicType
 You can always get the type of the Vector elements by using typename Vector<T>::basicType.

Public Member Functions

 Vector ()
 Default constructor, size of the vector is 0.
 Vector (const Vector< T > &v)
 Copy constructor.
 Vector (size_t n, const T &x=T())
 ~Vector ()
 Destructor.
virtual size_t vsize () const
 return vector size
virtual bool vempty () const
 return true if vector empty
void prettyPrint (std::ostream &out=std::cout) const
void printOn (std::ostream &out) const
void readFrom (std::istream &in=std::cin)
virtual void serialize (std::ostream &out) const
virtual void unserialize (std::istream &in)
virtual void destroy ()
 destroy() will be called by the vector pool to permanently delete a Vector<T> object
std::string getClassName ()
ObjectRef range (size_t startInd, size_t endInd)
virtual ObjectRef getIndex (int pos)
virtual void setIndex (int pos, ObjectRef val)
virtual ObjectRef clone ()
 clone default implementation
template<>
void printOn (std::ostream &out) const
template<>
void destroy ()

Static Public Member Functions

static Vector< T > * alloc (size_t size)
static std::string GetClassName ()

Detailed Description

template<class T>
class FD::Vector< T >

The (template) Overflow Vector type, it adds functionnality to the basic vector<T> type, including serialisation and unserialisation
Author:
Jean-Marc Valin


Constructor & Destructor Documentation

template<class T>
FD::Vector< T >::Vector size_t  n,
const T &  x = T()
[inline, explicit]
 

Constructor with a size and an initialization value.

Parameters:
n the size of the vector
x the initialization value


Member Function Documentation

template<class T>
Vector< T > * FD::Vector< T >::alloc size_t  size  )  [inline, static]
 

alloc() is called to allocate a vector on the vector pool. The vector, if not used will be placed in the vector pool to be reused later.

Parameters:
size size of the vector.

template<class T>
ObjectRef FD::Vector< T >::clone  )  [inline, virtual]
 

clone default implementation

Clone the vector and return an identical copy (deep copy)

Implements FD::BaseVector.

template<>
void FD::Vector< FuzzyRule * >::destroy  )  [inline, virtual]
 

Causes the object to be destroyed, it might be redefined for an object pool

Reimplemented from FD::Object.

template<class T>
std::string FD::Vector< T >::getClassName  )  [inline]
 

Returns the class name : Vector<T>

Returns:
string the class name

template<class T>
static std::string FD::Vector< T >::GetClassName  )  [inline, static]
 

Returns the class name : Vector<T>

Returns:
string the class name

template<class T>
ObjectRef FD::Vector< T >::getIndex int  pos  )  [inline, virtual]
 

Returns an element at a desired position in the vector

Parameters:
pos the position in the vector
Returns:
ObjectRef Element at the desired position

Implements FD::BaseVector.

template<class T>
void FD::Vector< T >::prettyPrint std::ostream &  out = std::cout  )  const [virtual]
 

Formatted output (only values) for Vectors
Format : element0 element1 ... element(size-1)

Reimplemented from FD::Object.

template<>
void FD::Vector< FuzzyRule * >::printOn std::ostream &  out  )  const [inline, virtual]
 

Generic print function

Implements FD::Object.

template<class T>
void FD::Vector< T >::printOn std::ostream &  out  )  const [virtual]
 

Formatted output in the FlowDesigner format
Format : <Vector<T> element0 element1 ... element(size - 1) >

Parameters:
out the output stream

Implements FD::Object.

template<class T>
ObjectRef FD::Vector< T >::range size_t  startInd,
size_t  endInd
[inline, virtual]
 

Returns a new vector containing data from start to end indexes.

Parameters:
startInd start index
endInd end index
Returns:
ObjectRef the newly allocated vector

Implements FD::BaseVector.

template<class T>
void FD::Vector< T >::readFrom std::istream &  in = std::cin  )  [inline, virtual]
 

Formatted input in the FlowDesigner format
Format : <Vector<T> element0 element1 ... element(size - 1) >

Parameters:
in the input stream

Reimplemented from FD::Object.

template<class T>
void FD::Vector< T >::serialize std::ostream &  out  )  const [inline, virtual]
 

Binary output in the FlowDesigner format
Format : {Vector<T> |element0;element1;...; element(size - 1) }

Parameters:
out the output stream

Reimplemented from FD::Object.

template<class T>
void FD::Vector< T >::setIndex int  pos,
ObjectRef  val
[inline, virtual]
 

Set an element value at the desired position

Parameters:
pos The position in the vector
val The value to put at the desired position

Implements FD::BaseVector.

template<class T>
void FD::Vector< T >::unserialize std::istream &  in  )  [inline, virtual]
 

Binary input in the FlowDesigner format
Format : {Vector<T> |element0;element1;...; element(size - 1) }

Parameters:
in the input stream

Reimplemented from FD::Object.


The documentation for this class was generated from the following file:
Generated on Wed Oct 5 14:30:12 2005 for FlowDesigner by  doxygen 1.4.4