Gecode::Instance::Value Class Reference
A value: scalar or nested (possibly ragged) array. More...
#include <gecode/instance/impl.hpp>
Public Member Functions | |
| Value (void) | |
| The empty integer list. | |
| Value (ValueType t) | |
| Scalar of type t whose leaf is still to be added. | |
| bool | is_scalar (void) const |
| Test whether scalar. | |
| bool | is_number (void) const |
| Test whether numeric scalar. | |
| int | leaves (void) const |
| Return number of leaves. | |
| int | size (void) const |
| Return length of outermost list. | |
| double | as_double (int i=0) const |
| Return value of numeric scalar or leaf i as a double. | |
| void | to_float (void) |
| Convert integer leaves to floats. | |
| void | push (const Value &s) |
| Append the value of scalar s, adapting the type. | |
| bool | is_empty_list (void) const |
| Test whether this is an empty list. | |
| void | clear_list (ValueType t) |
| Make this the empty list of type t, keeping the memory for reuse. | |
| void | index (void) |
| Compute starts, needed by range. | |
| void | range (int level, int pos, int &from, int &to) const |
| Find leaf range of list pos at level level. | |
Static Public Member Functions | |
| static Value | integer (long long int v) |
| Integer scalar. | |
| static Value | real (double v) |
| Float scalar. | |
| static Value | string (const std::string &v) |
| String scalar. | |
Public Attributes | |
| ValueType | type |
| Type of the leaves. | |
| int | depth |
| Nesting depth (0 for scalars). | |
| Seq< Seq< int > > | lengths |
| List lengths per level. | |
| Seq< Seq< int > > | starts |
| Start of each list among the lists or leaves one level down (see index). | |
| Seq< long long int > | ints |
| Integer leaves. | |
| Seq< double > | reals |
| Float leaves. | |
| Seq< std::string > | strs |
| String leaves. | |
Detailed Description
A value: scalar or nested (possibly ragged) array.
The leaves are stored in a flat array of the value's type. The structure of a value of depth d is given by d levels of list lengths: level 0 has a single entry (the length of the outermost list), level k has one entry per list at depth k. The lengths at the last level sum to the number of leaves.
Constructor & Destructor Documentation
◆ Value() [1/2]
|
inline |
◆ Value() [2/2]
|
inlineexplicit |
Member Function Documentation
◆ integer()
|
inlinestatic |
◆ real()
|
inlinestatic |
◆ string()
|
inlinestatic |
◆ is_scalar()
|
inline |
◆ is_number()
|
inline |
◆ leaves()
|
inline |
◆ size()
|
inline |
◆ as_double()
|
inline |
◆ to_float()
|
inline |
◆ push()
|
inline |
◆ is_empty_list()
|
inline |
◆ clear_list()
|
inline |
◆ index()
| void Gecode::Instance::Value::index | ( | void | ) |
Compute starts, needed by range.
◆ range()
| void Gecode::Instance::Value::range | ( | int | level, |
| int | pos, | ||
| int & | from, | ||
| int & | to ) const |
Find leaf range of list pos at level level.
Member Data Documentation
◆ type
| ValueType Gecode::Instance::Value::type |
◆ depth
| int Gecode::Instance::Value::depth |
◆ lengths
◆ starts
◆ ints
| Seq<long long int> Gecode::Instance::Value::ints |
◆ reals
◆ strs
| Seq<std::string> Gecode::Instance::Value::strs |
The documentation for this class was generated from the following file:
- gecode/instance/impl.hpp
