BCP_vec_change< T > Class Template Reference

This class stores a vector explicitly or relatively to another vector. More...

#include <BCP_vector_change.hpp>

Collaboration diagram for BCP_vec_change< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Constructors and destructor



 BCP_vec_change (const BCP_storage_t st)
 Construct a vector change that's empty and is of the given storage.
 BCP_vec_change (const T *first, const T *last)
 Construct an explicit description describing the vector bounded by the two iterators.
 BCP_vec_change (const BCP_vec_change< T > &old_vec, const BCP_vec_change< T > &new_vec, const BCP_vec< int > &del_pos)
 Construct a relative description.
 BCP_vec_change (const BCP_vec_change< T > &old_vec, const BCP_vec_change< T > &new_vec, const BCP_vec< int > &del_pos, const double etol)
 Construct a relative description.
 BCP_vec_change (BCP_buffer &buf)
 Construct the object by unpacking it from a buffer.
 ~BCP_vec_change ()
 The destructor need not do anything.
Query methods



BCP_storage_t storage () const
 Return the storage type of the vector.
const BCP_vec< T > & explicit_vector () const
 Return a const reference to the vector if it is explicitly stored, otherwise throw an exception.
int storage_size () const
 Return how much memory it'll take to pack this info.
Modifying methods



void update (const BCP_vec_change< T > &change)
 Update the current vector with the argument vector.
Packing and unpacking



void pack (BCP_buffer &buf) const
 Pack the data into a buffer.
void unpack (BCP_buffer &buf)
 Unpack the data from a buffer.

Private Attributes

BCP_storage_t _storage
 The storage type of the the vector.
BCP_vec< int > _del_pos
 Empty in case of explicit storage.
BCP_vec< int > _change_pos
 Empty in case of explicit storage.
BCP_vec< T > _values
 In case of explicit storage these are the values in the vector.

Detailed Description

template<class T>
class BCP_vec_change< T >

This class stores a vector explicitly or relatively to another vector.

The class can be used when we want to store a sequence of vectors in as small a space as possible. The first vector must be stored explicitly, the others can be either explicit ones or stored with respect to the previous vector.

Definition at line 20 of file BCP_vector_change.hpp.


Constructor & Destructor Documentation

template<class T>
BCP_vec_change< T >::BCP_vec_change ( const BCP_storage_t  st  )  [inline]

Construct a vector change that's empty and is of the given storage.

If the storage is explicit then this creates an explicit vector with no entry. If it is relative, then the data describes that there is no change with respect to the parent vector.

Definition at line 43 of file BCP_vector_change.hpp.

template<class T>
BCP_vec_change< T >::BCP_vec_change ( const T *  first,
const T *  last 
) [inline]

Construct an explicit description describing the vector bounded by the two iterators.

Definition at line 47 of file BCP_vector_change.hpp.

template<class T>
BCP_vec_change< T >::BCP_vec_change ( const BCP_vec_change< T > &  old_vec,
const BCP_vec_change< T > &  new_vec,
const BCP_vec< int > &  del_pos 
) [inline]

Construct a relative description.

Parameters:
new_vec the vector that should result after the change is applied to
old_vec the original vector
del_pos specifies which entries are to be deleted from old_vec before the change in this object can be applied.

Definition at line 59 of file BCP_vector_change.hpp.

template<class T>
BCP_vec_change< T >::BCP_vec_change ( const BCP_vec_change< T > &  old_vec,
const BCP_vec_change< T > &  new_vec,
const BCP_vec< int > &  del_pos,
const double  etol 
) [inline]

Construct a relative description.

Same as the previous constructor, except that there is an extra argument, the epsilon tolerance for equality testing. This makes sense only if is double, so this constructor should be used only in that case.

Definition at line 100 of file BCP_vector_change.hpp.

template<class T>
BCP_vec_change< T >::BCP_vec_change ( BCP_buffer buf  )  [inline]

Construct the object by unpacking it from a buffer.

Definition at line 137 of file BCP_vector_change.hpp.

template<class T>
BCP_vec_change< T >::~BCP_vec_change (  )  [inline]

The destructor need not do anything.

Definition at line 142 of file BCP_vector_change.hpp.


Member Function Documentation

template<class T>
BCP_storage_t BCP_vec_change< T >::storage (  )  const [inline]

Return the storage type of the vector.

Definition at line 148 of file BCP_vector_change.hpp.

template<class T>
const BCP_vec<T>& BCP_vec_change< T >::explicit_vector (  )  const [inline]

Return a const reference to the vector if it is explicitly stored, otherwise throw an exception.

Definition at line 152 of file BCP_vector_change.hpp.

template<class T>
int BCP_vec_change< T >::storage_size (  )  const [inline]

Return how much memory it'll take to pack this info.

It is used when comparing which sort of storage is smaller

Definition at line 161 of file BCP_vector_change.hpp.

template<class T>
void BCP_vec_change< T >::update ( const BCP_vec_change< T > &  change  )  [inline]

Update the current vector with the argument vector.

If the argument vector is explicit then just replace the current vector. If it is relative and the current vector is explicit, then perform the update. Otherwise throw an exception (the operation is impossible.)

Definition at line 175 of file BCP_vector_change.hpp.

template<class T>
void BCP_vec_change< T >::pack ( BCP_buffer buf  )  const [inline]

Pack the data into a buffer.

Definition at line 208 of file BCP_vector_change.hpp.

template<class T>
void BCP_vec_change< T >::unpack ( BCP_buffer buf  )  [inline]

Unpack the data from a buffer.

Definition at line 213 of file BCP_vector_change.hpp.


Member Data Documentation

template<class T>
BCP_storage_t BCP_vec_change< T >::_storage [private]

The storage type of the the vector.

Definition at line 23 of file BCP_vector_change.hpp.

template<class T>
BCP_vec<int> BCP_vec_change< T >::_del_pos [private]

Empty in case of explicit storage.

Otherwise these entries are to be deleted from the parent vector.

Definition at line 26 of file BCP_vector_change.hpp.

template<class T>
BCP_vec<int> BCP_vec_change< T >::_change_pos [private]

Empty in case of explicit storage.

Otherwise these entries are to be changed in the parent vector after the ones to be deleted are gone.

Definition at line 30 of file BCP_vector_change.hpp.

template<class T>
BCP_vec<T> BCP_vec_change< T >::_values [private]

In case of explicit storage these are the values in the vector.

Otherwise the first _change_pos.size() entries are the new values for the changed entries and the rest are new entries.

Definition at line 34 of file BCP_vector_change.hpp.


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

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1