This class stores a vector explicitly or relatively to another vector. More...
#include <BCP_vector_change.hpp>
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... | |
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.
|
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.
|
inline |
Construct an explicit description describing the vector bounded by the two iterators.
Definition at line 47 of file BCP_vector_change.hpp.
|
inline |
Construct a relative description.
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.
|
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.
|
inline |
Construct the object by unpacking it from a buffer.
Definition at line 137 of file BCP_vector_change.hpp.
|
inline |
The destructor need not do anything.
Definition at line 142 of file BCP_vector_change.hpp.
|
inline |
Return the storage type of the vector.
Definition at line 148 of file BCP_vector_change.hpp.
|
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.
|
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.
|
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.
|
inline |
Pack the data into a buffer.
Definition at line 208 of file BCP_vector_change.hpp.
|
inline |
Unpack the data from a buffer.
Definition at line 213 of file BCP_vector_change.hpp.
|
private |
The storage type of the the vector.
Definition at line 23 of file BCP_vector_change.hpp.
|
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.
|
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.
|
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.