coin-Bcp
Private Attributes | List of all members
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]

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. More...
 
 BCP_vec_change (const T *first, const T *last)
 Construct an explicit description describing the vector bounded by the two iterators. More...
 
 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. More...
 
 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. More...
 
 BCP_vec_change (BCP_buffer &buf)
 Construct the object by unpacking it from a buffer. More...
 
 ~BCP_vec_change ()
 The destructor need not do anything. More...
 
Query methods
BCP_storage_t storage () const
 Return the storage type of the vector. More...
 
const BCP_vec< T > & explicit_vector () const
 Return a const reference to the vector if it is explicitly stored, otherwise throw an exception. More...
 
int storage_size () const
 Return how much memory it'll take to pack this info. More...
 
Modifying methods
void update (const BCP_vec_change< T > &change)
 Update the current vector with the argument vector. More...
 
Packing and unpacking
void pack (BCP_buffer &buf) const
 Pack the data into a buffer. More...
 
void unpack (BCP_buffer &buf)
 Unpack the data from a buffer. More...
 

Private Attributes

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

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_vecthe vector that should result after the change is applied to
old_vecthe original vector
del_posspecifies 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.

Referenced by BCP_warmstart_dual::storage(), BCP_warmstart_primaldual::storage(), and BCP_vec_change< char >::update().

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.

Referenced by BCP_vec_change< char >::BCP_vec_change().

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.

Referenced by BCP_warmstart_dual::storage_size(), BCP_warmstart_basis::storage_size(), and BCP_warmstart_primaldual::storage_size().

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.

Referenced by BCP_warmstart_dual::pack(), BCP_warmstart_basis::pack(), and BCP_warmstart_primaldual::pack().

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.

Referenced by BCP_vec_change< char >::BCP_vec_change().

Member Data Documentation

template<class T>
BCP_storage_t BCP_vec_change< T >::_storage
private
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.

Referenced by BCP_vec_change< char >::pack(), BCP_vec_change< char >::storage_size(), BCP_vec_change< char >::unpack(), and BCP_vec_change< char >::update().

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.

Referenced by BCP_vec_change< char >::BCP_vec_change(), BCP_vec_change< char >::pack(), BCP_vec_change< char >::storage_size(), BCP_vec_change< char >::unpack(), and BCP_vec_change< char >::update().

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.

Referenced by BCP_vec_change< char >::BCP_vec_change(), BCP_vec_change< char >::explicit_vector(), BCP_vec_change< char >::pack(), BCP_vec_change< char >::storage_size(), BCP_vec_change< char >::unpack(), and BCP_vec_change< char >::update().


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