3#ifndef _BCP_VECTOR_CHANGE_H
4#define _BCP_VECTOR_CHANGE_H
49 _values.
append(first, last);
65 const int new_size = nv.
size();
66 const int old_size = ov.
size();
67 const int del_size = del_pos.
size();
69 for (i = 0, j = 0, k = 0; i < old_size && k < del_size; ++i) {
70 if (del_pos[k] == i) {
79 if (old_size - i > new_size - j)
81old_vec has entries not in new_vec but not listed in del_pos.\n");
82 for ( ; i < old_size; ++i, ++j) {
87 const int change_size = _change_pos.
size();
88 _values.
reserve(change_size + new_size - j);
89 for (i = 0; i < change_size; ++i) {
106 const int new_size = nv.
size();
107 const int old_size = ov.
size();
108 const int del_size = del_pos.
size();
110 for (i = 0, j = 0, k = 0; i < old_size && k < del_size; ++i) {
111 if (del_pos[k] == i) {
115 if (
CoinAbs(ov[i] - nv[j]) > etol) {
120 if (old_size - i > new_size - j)
122old_vec has entries not in new_vec but not listed in del_pos.\n");
123 for ( ; i < old_size; ++i, ++j) {
124 if (
CoinAbs(ov[i] - nv[j]) > etol) {
128 const int change_size = _change_pos.
size();
129 _values.
reserve(change_size + new_size - j);
130 for (i = 0; i < change_size; ++i) {
155BCP_vec_change::explicit_vector() : non-explicit storage!\n");
162 return (_del_pos.
size() + _change_pos.
size()) *
sizeof(int) +
163 _values.
size() *
sizeof(T);
181 _values = change._values;
194trying to update a non-explicit storage with another non-explicit!\n");
196 const int ch_size = change._change_pos.
size();
197 for (
int i = 0; i < ch_size; ++i) {
198 _values[change._change_pos[i]] = change._values[i];
200 _values.
append(change._values.entry(ch_size), change._values.end());
209 const int st = _storage;
BCP_storage_t
This enumerative constant describes how to store certain data for a search tree node.
@ BCP_Storage_NoData
No data is stored.
@ BCP_Storage_Explicit
The data stored is an explicit listing of values.
@ BCP_Storage_WrtParent
The data stored is with respect to the same kind of data in the parent of the search tree node.
This class describes the message buffer used for all processes of BCP.
BCP_buffer & pack(const T &value)
Pack a single object of type T.
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
Currently there isn't any error handling in BCP.
This class stores a vector explicitly or relatively to another vector.
void unpack(BCP_buffer &buf)
Unpack the data from a buffer.
BCP_vec_change(const BCP_storage_t st)
Construct a vector change that's empty and is of the given storage.
void update(const BCP_vec_change< T > &change)
Update the current vector with the argument vector.
BCP_storage_t storage() const
Return the storage type of the vector.
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 T *first, const T *last)
Construct an explicit description describing the vector bounded by the two iterators.
void pack(BCP_buffer &buf) const
Pack the data into a buffer.
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.
const BCP_vec< T > & explicit_vector() const
Return a const reference to the vector if it is explicitly stored, otherwise throw an exception.
BCP_vec_change(BCP_buffer &buf)
Construct the object by unpacking it from a buffer.
int storage_size() const
Return how much memory it'll take to pack this info.
~BCP_vec_change()
The destructor need not do anything.
The class BCP_vec serves the same purpose as the vector class in the standard template library.
void clear()
Delete every entry.
void push_back(const_reference x)
Append x to the end of the vector.
void append(const BCP_vec< T > &x)
Append the entries in x to the end of the vector.
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
void erase_by_index(const BCP_vec< int > &positions)
Erase the entries indexed by indices.
iterator end()
Return an iterator to the end of the object.
size_t size() const
Return the current number of entries.
iterator entry(const int i)
Return an iterator to the i-th entry.
void reserve(const size_t n)
Reallocate the object to make space for n entries.