FRAMES NO FRAMES

Class IlcAnyArray

Definition file: ilsolver/anyexp.h
Include file: <ilsolver/ilosolver.h>

IlcAnyArray is the array class for the basic pointer class. It is a handle class.

An object of this class contains a pointer to another object allocated on the Solver heap. Exploiting handles in this way greatly simplifies the programming interface since the handle can then be an automatic object: as a developer using handles, you do not have to worry about memory allocation.

Empty Handle or Null Array

It is possible to create a null array, or in other words, an empty handle. When you do so, only these operations are allowed on that null array:

Attempts to access a null array in any other way will throw an exception (an instance of IloSolver::SolverErrorException).

See Also:

Constructor Summary
public IlcAnyArray()
public IlcAnyArray(IlcInt * impl)
public IlcAnyArray(IlcAny * impl)
public IlcAnyArray(IloSolver solver, IlcInt size, IlcAny * values)
public IlcAnyArray(IloSolver solver, IlcInt size, const IlcAny exp0, const IlcAny exp...)
public IlcAnyArray(IloSolver solver, IlcInt size)
Method Summary
public IlcInt *getImpl() const
public IlcIntgetSize() const
public IloSolvergetSolver() const
public voidoperator=(const IlcAnyArray & h)
public IlcAnyExpoperator[](const IlcIntExp rank) const
public IlcAny &operator[](IlcInt i) const
Constructor Detail

IlcAnyArray

public IlcAnyArray()

This constructor creates an empty handle. You must initialize it before you use it.


IlcAnyArray

public IlcAnyArray(IlcInt * impl)

This constructor creates a handle object from a pointer to an implementation object.


IlcAnyArray

public IlcAnyArray(IlcAny * impl)

This constructor creates a handle object from a pointer to an implementation object.


IlcAnyArray

public IlcAnyArray(IloSolver solver, IlcInt size, IlcAny * values)

This constructor creates an array of pointers containing the values in the array values. The argument size must be the length of the array values; it must also be strictly greater than 0 (zero). Solver does not keep a pointer to the array values.


IlcAnyArray

public IlcAnyArray(IloSolver solver, IlcInt size, const IlcAny exp0, const IlcAny exp...)

This constructor accepts a variable number of arguments. Its first argument, size, indicates the length of the array that this constructor will create; size must be the same as the number of instances of IlcAny passed as arguments; it must also be strictly greater than 0 (zero). The constructor creates an array of the values indicated by the other arguments (the instances of IlcAny).


IlcAnyArray

public IlcAnyArray(IloSolver solver, IlcInt size)

This constructor creates an array of size elements. The elements of this array are not initialized. The argument size must be strictly greater than 0 (zero).


Method Detail

getImpl

public IlcInt * getImpl() const

This member function returns a pointer to the implementation object of the invoking handle.


getSize

public IlcInt getSize() const

This member function returns the number of elements in the invoking array.


getSolver

public IloSolver getSolver() const

This member function returns an instance of IloSolver associated with the invoking object.


operator=

public void operator=(const IlcAnyArray & h)

This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the provided argument.


operator[]

public IlcAnyExp operator[](const IlcIntExp rank) const

This subscripting operator returns a constrained enumerated expression. For clarity, let's call A the invoking array. When rank is bound to the value i, the value of the expression is A[i]. More generally, the domain of the expression is the set of values A[i] where the i are in the domain of rank.


operator[]

public IlcAny & operator[](IlcInt i) const

This operator returns a reference to the element at rank i. This operator can be used for accessing the element or for modifying it.