Overview | Group | Tree | Graph | Index | Concepts |
The class IlcConstraintArray
is the class for an array of
instances of IlcConstraint
.
It is a handle class. The implementation class for
IlcConstraintArray
is the undocumented class
IlcConstraintArrayI
. An object of this class contains a pointer
to a constraint allocated on the Solver heap. Exploiting handles in this way
greatly simplifies the programming interface since the handle can then be an
automatic object. When you use 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:
getSize
for the null array returns 0 (zero).
ok
returns
IlcFalse
for a 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 | IlcConstraintArray() |
public | IlcConstraintArray(IlcConstraintArrayI * impl) |
public | IlcConstraintArray(IloSolver solver, IlcInt size) |
Method Summary | |
---|---|
public void | display(ostream & stream) const |
public IlcConstraintArrayI * | getImpl() const |
public IlcInt | getSize() const |
public IloSolver | getSolver() const |
public void | operator=(const IlcConstraintArray & array) |
public IlcConstraint & | operator[](IlcInt rank) const |
Constructor Detail |
---|
This constructor creates a void array. In other words, the array is an empty handle with a null handle pointer. The elements of this array must then be assigned before it is used, exactly as when you declare any other pointer.
This constructor creates a handle object (an instance of the class IlcConstraintArray
)
from a pointer to an object (an instance of the implementation class IlcConstraintArrayI
).
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). Each
element of the array must be assigned before the array can be used.
Method Detail |
---|
This member function is called by the operator <<
.
This member function returns a pointer to the implementation object of the invoking array. You can use this member function to check whether an array is empty.
This member function returns the number of constraints in the invoking array.
This member function returns an instance of IloSolver
associated with
the invoking array.
This assignment operator copies array into the invoking array by assigning an address to the handle pointer of the invoking object. That address is the location of the implementation object of the argument array.
This subscripting operator returns a reference to a constraint corresponding to the given index in the invoking array of constraints.