Generated on for Gecode by doxygen 1.17.0

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.

Definition at line 255 of file impl.hpp.

Constructor & Destructor Documentation

◆ Value() [1/2]

Gecode::Instance::Value::Value ( void )
inline

The empty integer list.

Definition at line 273 of file impl.hpp.

◆ Value() [2/2]

Gecode::Instance::Value::Value ( ValueType t)
inlineexplicit

Scalar of type t whose leaf is still to be added.

Definition at line 279 of file impl.hpp.

Member Function Documentation

◆ integer()

Value Gecode::Instance::Value::integer ( long long int v)
inlinestatic

Integer scalar.

Definition at line 282 of file impl.hpp.

◆ real()

Value Gecode::Instance::Value::real ( double v)
inlinestatic

Float scalar.

Definition at line 287 of file impl.hpp.

◆ string()

Value Gecode::Instance::Value::string ( const std::string & v)
inlinestatic

String scalar.

Definition at line 292 of file impl.hpp.

◆ is_scalar()

bool Gecode::Instance::Value::is_scalar ( void ) const
inline

Test whether scalar.

Definition at line 298 of file impl.hpp.

◆ is_number()

bool Gecode::Instance::Value::is_number ( void ) const
inline

Test whether numeric scalar.

Definition at line 300 of file impl.hpp.

◆ leaves()

int Gecode::Instance::Value::leaves ( void ) const
inline

Return number of leaves.

Definition at line 302 of file impl.hpp.

◆ size()

int Gecode::Instance::Value::size ( void ) const
inline

Return length of outermost list.

Definition at line 310 of file impl.hpp.

◆ as_double()

double Gecode::Instance::Value::as_double ( int i = 0) const
inline

Return value of numeric scalar or leaf i as a double.

Definition at line 312 of file impl.hpp.

◆ to_float()

void Gecode::Instance::Value::to_float ( void )
inline

Convert integer leaves to floats.

Definition at line 316 of file impl.hpp.

◆ push()

void Gecode::Instance::Value::push ( const Value & s)
inline

Append the value of scalar s, adapting the type.

Definition at line 324 of file impl.hpp.

◆ is_empty_list()

bool Gecode::Instance::Value::is_empty_list ( void ) const
inline

Test whether this is an empty list.

Definition at line 342 of file impl.hpp.

◆ clear_list()

void Gecode::Instance::Value::clear_list ( ValueType t)
inline

Make this the empty list of type t, keeping the memory for reuse.

Definition at line 344 of file impl.hpp.

◆ index()

void Gecode::Instance::Value::index ( void )

Compute starts, needed by range.

Definition at line 201 of file data.cpp.

◆ range()

void Gecode::Instance::Value::range ( int level,
int pos,
int & from,
int & to ) const

Find leaf range of list pos at level level.

Definition at line 221 of file data.cpp.

Member Data Documentation

◆ type

ValueType Gecode::Instance::Value::type

Type of the leaves.

Definition at line 258 of file impl.hpp.

◆ depth

int Gecode::Instance::Value::depth

Nesting depth (0 for scalars).

Definition at line 260 of file impl.hpp.

◆ lengths

Seq<Seq<int> > Gecode::Instance::Value::lengths

List lengths per level.

Definition at line 262 of file impl.hpp.

◆ starts

Seq<Seq<int> > Gecode::Instance::Value::starts

Start of each list among the lists or leaves one level down (see index).

Definition at line 264 of file impl.hpp.

◆ ints

Seq<long long int> Gecode::Instance::Value::ints

Integer leaves.

Definition at line 266 of file impl.hpp.

◆ reals

Seq<double> Gecode::Instance::Value::reals

Float leaves.

Definition at line 268 of file impl.hpp.

◆ strs

Seq<std::string> Gecode::Instance::Value::strs

String leaves.

Definition at line 270 of file impl.hpp.


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