Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

propertyservice::mobilerobot::Vector< T, comps > Class Template Reference

#include <Vector.h>

List of all members.


Detailed Description

template<class T, int comps>
class propertyservice::mobilerobot::Vector< T, comps >

Vector is a base class for data that can be represented as a few scalars.

A vector can consist of elements of any primitive type, and it may have any number of components - or dimensions, whichever. The main purpose of the Vector class is to provide a convenient way of serializing and deserializing vector-type robot properties using XML.

It is possible to perform arithmetic operations on Vectors. The + and - operators are defined for Vectors and for the content type. Furthermore, the * and / operators are defined for the content type. Thus, operations like Vector<double,3> * double, Vector<double3> - Vector<double,3> are possible.


Public Methods

 Vector ()
 Create an empty vector with all elements initialized to zero.

 Vector (T firstElement,...)
 Initialize a vector with the given elements.

 Vector (const Vector &other)
 The copy constructor.

Vector & operator= (const Vector &other)
 Copy a vector.

Vector & operator= (T scalar)
 Set all elements in a vector to a scalar.

Vector & operator+= (const Vector &other)
 Add another vector to this vector (element-wise).

Vector & operator-= (const Vector &other)
 Subtract another vector from this vector (element-wise).

T & operator[] (int index)
 Get the vector element at index.

const T & operator[] (int index) const
 Get the vector element at index (const version).

Vector & operator+= (T value)
 Add a scalar value to each element.

Vector & operator-= (T value)
 Subtract a scalar value from each element.

Vector & operator *= (T value)
 Multiply each element by a scalar value.

Vector & operator/= (T value)
 Divide each element by a scalar value.


Public Attributes

componentArray [comps]
 The components of this vector in an array.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.