Generated on for Gecode by doxygen 1.18.0
Gecode::FlatZinc::AST::SharedArray Class Reference

Array node shared by all references to an array parameter More...

#include <gecode/flatzinc/ast.hh>

Public Member Functions

 SharedArray (int n)
 Construct with n elements and one owner.
SharedArray * share (void)
 Add an owner and return this node.
virtual void release (void)
 Remove an owner, deleting the node when none is left.
Public Member Functions inherited from Gecode::FlatZinc::AST::Array
 Array (const std::vector< Node * > &a0)
 Array (Node *n)
 Array (int n=0)
virtual void print (std::ostream &os)
 Output string representation.
 ~Array (void)
Public Member Functions inherited from Gecode::FlatZinc::AST::Node
virtual ~Node (void)
 Destructor.
void append (Node *n)
 Append n to an array node.
bool hasAtom (const std::string &id)
 Test if node has atom with id.
bool isInt (int &i)
 Test if node is int, if yes set i to the value.
bool isFloat (double &i)
 Test if node is float, if yes set d to the value.
bool isCall (const std::string &id)
 Test if node is function call with id.
Call * getCall (void)
 Return function call.
bool hasCall (const std::string &id)
 Test if node is function call or array containing function call id.
Call * getCall (const std::string &id)
 Return function call id.
Array * getArray (void)
 Cast this node to an array node.
Atom * getAtom (void)
 Cast this node to an Atom node.
std::string getVarName (void)
 Return name of variable represented by this node.
int getIntVar (void)
 Cast this node to an integer variable node.
int getBoolVar (void)
 Cast this node to a Boolean variable node.
int getFloatVar (void)
 Cast this node to a Float variable node.
int getSetVar (void)
 Cast this node to a set variable node.
int getInt (void)
 Cast this node to an integer node.
bool getBool (void)
 Cast this node to a Boolean node.
double getFloat (void)
 Cast this node to a Float node.
SetLit * getSet (void)
 Cast this node to a set literal node.
std::string getString (void)
 Cast this node to a string node.
bool isIntVar (void)
 Test if node is an integer variable node.
bool isBoolVar (void)
 Test if node is a Boolean variable node.
bool isSetVar (void)
 Test if node is a set variable node.
bool isFloatVar (void)
 Test if node is a float variable node.
bool isInt (void)
 Test if node is an integer node.
bool isFloat (void)
 Test if node is a float node.
bool isBool (void)
 Test if node is a Boolean node.
bool isString (void)
 Test if node is a string node.
bool isArray (void)
 Test if node is an array node.
bool isSet (void)
 Test if node is a set literal node.
bool isAtom (void)
 Test if node is an atom node.

Protected Attributes

unsigned int refs
 Number of owners.

Additional Inherited Members

Public Attributes inherited from Gecode::FlatZinc::AST::Array
std::vector< Node * > a

Detailed Description

Array node shared by all references to an array parameter

The parser expands a reference to an array parameter into an array node. A parameter named by many constraints (for example a tuple set shared by several table constraints) would otherwise be copied once per reference, and all copies stay alive until the constraints are posted. The parser instead builds one SharedArray per parameter and hands out counted references to it. Its elements must not be changed.

Definition at line 270 of file ast.hh.

Constructor & Destructor Documentation

◆ SharedArray()

Gecode::FlatZinc::AST::SharedArray::SharedArray ( int n)
inline

Construct with n elements and one owner.

Definition at line 276 of file ast.hh.

Member Function Documentation

◆ share()

SharedArray * Gecode::FlatZinc::AST::SharedArray::share ( void )
inline

Add an owner and return this node.

Definition at line 278 of file ast.hh.

◆ release()

virtual void Gecode::FlatZinc::AST::SharedArray::release ( void )
inlinevirtual

Remove an owner, deleting the node when none is left.

Reimplemented from Gecode::FlatZinc::AST::Node.

Definition at line 280 of file ast.hh.

Member Data Documentation

◆ refs

unsigned int Gecode::FlatZinc::AST::SharedArray::refs
protected

Number of owners.

Definition at line 273 of file ast.hh.


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