ot_lib::ot_vector Class Reference

OT_LIB Vector class. More...

#include <ot_lib.h>

Inheritance diagram for ot_lib::ot_vector:

ot_lib::ot_obj vector

List of all members.

Public Member Functions

 ot_vector (int s=0)
 ot_vector (const ot_vector &c)
virtual ~ot_vector ()
 Destructor.
ot_objdup (void) const
void asXml (ostream &s=cout, int i=0) const
bool asData (ostream &s) const
const ot_objget (int pos) const
 Get the element at position pos (0..Size-1).
ot_objgetPtr (int pos)
 Get the element at position pos (0..Size-1).
bool set (int pos, const ot_obj *o)
 Insert an ot_object into the array.
bool set (int pos, const ot_obj &o)
 Insert an ot_object into the array.
bool erase (const ot_obj *o)
 Erase an object from the array.
ot_vectoroperator= (const ot_vector &c)
 Assign op.
bool operator== (const ot_vector &c)
 Eq op.
bool operator!= (const ot_vector &v)
 Operator !=.
bool operator== (const ot_obj *o) const
 Eq op.


Detailed Description

OT_LIB Vector class.

This class implement a vector of OT objects. When an object is inserted, this class clone the input object and insert the copy. The destructor free all the object preset into the array.


Constructor & Destructor Documentation

ot_lib::ot_vector::ot_vector ( int  s = 0  ) 

Parameters:
size size of the array

ot_lib::ot_vector::ot_vector ( const ot_vector c  ) 

Copy constructor

Parameters:
c Object to copy

virtual ot_lib::ot_vector::~ot_vector (  )  [virtual]

Destructor.


Member Function Documentation

ot_obj* ot_lib::ot_vector::dup ( void   )  const [virtual]

Duplicate the object Clone the array and all the objects contained.

Returns:
The new object

Implements ot_lib::ot_obj.

void ot_lib::ot_vector::asXml ( ostream &  s = cout,
int  i = 0 
) const [virtual]

Print the XML rappresentation of object into string

Parameters:
s the output string
i The indent spaces

Implements ot_lib::ot_obj.

bool ot_lib::ot_vector::asData ( ostream &  s  )  const [virtual]

Build a binary image of object

Parameters:
s The output stream

Implements ot_lib::ot_obj.

const ot_obj* ot_lib::ot_vector::get ( int  pos  )  const

Get the element at position pos (0..Size-1).

Return the pointer to the object at the postion pos.

Parameters:
pos The object position in the array (0..Size-1)
Returns:
Pointer to the requested object or 0 if fail

ot_obj* ot_lib::ot_vector::getPtr ( int  pos  ) 

Get the element at position pos (0..Size-1).

Return the pointer to the object at the postion pos.

Warning:
Remember that the returned object is a reference of the object contained in the array,if you modify it, modify also the object contained into the array.
Parameters:
pos The object position in the array (0..Size-1)
Returns:
Pointer to ot_object or 0 if fail

bool ot_lib::ot_vector::set ( int  pos,
const ot_obj o 
)

Insert an ot_object into the array.

This function make the copy of the input object and then insert it in the array.

Parameters:
pos The object position in array (0..Size-1)
o The object to insert
Returns:
False if the function fail else True

bool ot_lib::ot_vector::set ( int  pos,
const ot_obj o 
)

Insert an ot_object into the array.

This function make the copy of the input object and then insert it in the array.

Parameters:
pos The object position in array (0..Size-1)
o The object to insert
Returns:
False if the function fail else True

bool ot_lib::ot_vector::erase ( const ot_obj o  ) 

Erase an object from the array.

Erase an obect from the array

Parameters:
o The object to erase
Returns:
False if the function fail else the object pointer

ot_vector& ot_lib::ot_vector::operator= ( const ot_vector c  ) 

Assign op.

bool ot_lib::ot_vector::operator== ( const ot_vector c  ) 

Eq op.

bool ot_lib::ot_vector::operator!= ( const ot_vector v  ) 

Operator !=.

bool ot_lib::ot_vector::operator== ( const ot_obj o  )  const [inline, virtual]

Eq op.

Implements ot_lib::ot_obj.


The documentation for this class was generated from the following file:

Generated on Sun May 4 12:42:45 2008 for OT_LIB 4.1 by  doxygen 1.5.5