Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set | ||
|
||
#include <const_int_ptr_array.h>
Public Member Functions | |
template<typename Integer> | |
ConstIntPtrArray (const std::vector< T * > &ptrs, const std::vector< Integer > &values) | |
Build from 2 vectors. Copy the data internally. | |
template<typename Integer> | |
ConstIntPtrArray (T *const *ptrs, const Integer *const values, int size) | |
Build from 2 vectors. Copy the data internally. | |
ConstIntPtrArray (std::vector< Cell > *const data) | |
Build from one data vector. Takes ownership of the vector. | |
std::vector< Cell > * | Release () |
This code releases the ownership of the data into the returned vector. | |
int | size () const |
Size of the array. This is not valid after Release() has been called. | |
int64 | value (int64 index) const |
Returns the value at position index. | |
T * | ptr (int64 index) const |
Returns the instance of T* at position index. | |
std::vector< Cell > * | Copy () const |
Returns a copy of the data. Usually used to create a new ConstIntPtrArray. | |
std::vector< Cell > * | SortedCopy (bool increasing) const |
This will create a new data holder with the mapping sorted by values. | |
std::vector< Cell > * | SortedCopyAggregateValues (bool increasing, bool remove_zeros) const |
This will create a new data holder with the mapping sorted by values. | |
string | DebugString () const |
Pretty print. | |
Classes | |
struct | Cell |
A cell is used to store pairs of <T, int64>. More... | |
struct | CompareValuesGT |
Comparison helpers. This one sorts in a decreasing way. More... | |
struct | CompareValuesLT |
Comparison helpers. This one sorts in a increasing way. More... |
This is useful inside constraints and expressions. The constructors, except the one with the pointer to a vector of cells will copy the data internally and will not take ownership of the data passed in argument. Its goals are:
Definition at line 47 of file const_int_ptr_array.h.
operations_research::ConstIntPtrArray< T >::ConstIntPtrArray | ( | const std::vector< T * > & | ptrs, | |
const std::vector< Integer > & | values | |||
) | [inline] |
Build from 2 vectors. Copy the data internally.
Definition at line 75 of file const_int_ptr_array.h.
operations_research::ConstIntPtrArray< T >::ConstIntPtrArray | ( | T *const * | ptrs, | |
const Integer *const | values, | |||
int | size | |||
) | [inline] |
Build from 2 vectors. Copy the data internally.
Definition at line 86 of file const_int_ptr_array.h.
operations_research::ConstIntPtrArray< T >::ConstIntPtrArray | ( | std::vector< Cell > *const | data | ) | [inline, explicit] |
Build from one data vector. Takes ownership of the vector.
Definition at line 96 of file const_int_ptr_array.h.
std::vector<Cell>* operations_research::ConstIntPtrArray< T >::Release | ( | ) | [inline] |
This code releases the ownership of the data into the returned vector.
After this method is called, data_ points to a null vector.
Definition at line 100 of file const_int_ptr_array.h.
int operations_research::ConstIntPtrArray< T >::size | ( | ) | const [inline] |
Size of the array. This is not valid after Release() has been called.
Definition at line 105 of file const_int_ptr_array.h.
int64 operations_research::ConstIntPtrArray< T >::value | ( | int64 | index | ) | const [inline] |
T* operations_research::ConstIntPtrArray< T >::ptr | ( | int64 | index | ) | const [inline] |
Returns the instance of T* at position index.
This is not valid after Release() has been called.
Definition at line 118 of file const_int_ptr_array.h.
std::vector<Cell>* operations_research::ConstIntPtrArray< T >::Copy | ( | ) | const [inline] |
Returns a copy of the data. Usually used to create a new ConstIntPtrArray.
Definition at line 124 of file const_int_ptr_array.h.
std::vector<Cell>* operations_research::ConstIntPtrArray< T >::SortedCopy | ( | bool | increasing | ) | const [inline] |
This will create a new data holder with the mapping sorted by values.
Definition at line 130 of file const_int_ptr_array.h.
std::vector<Cell>* operations_research::ConstIntPtrArray< T >::SortedCopyAggregateValues | ( | bool | increasing, | |
bool | remove_zeros | |||
) | const [inline] |
This will create a new data holder with the mapping sorted by values.
Furthermore, it will regroup and sum values attached to the same pointer to T. Finally, it can remove pairs with a value of zero.
Definition at line 140 of file const_int_ptr_array.h.
string operations_research::ConstIntPtrArray< T >::DebugString | ( | ) | const [inline] |