Overview | Group | Tree | Graph | Index | Concepts |
For each basic type, Solver defines a corresponding array class. This
array class is a handle class. In other words, an object of this class
contains a pointer to another object allocated on the Solver heap associated
with a solver (an instance of IloSolver
).
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.
IlcFloatArray
is the array class for the basic
floating-point class. It is a handle class. The implementation class for
IlcFloatArray
is the undocumented class
IlcFloatArrayI
.
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:
IlcConstFloatArray, IlcFloat, operator<<
Constructor Summary | |
---|---|
public | IlcFloatArray() |
public | IlcFloatArray(IlcFloatArrayI * impl) |
public | IlcFloatArray(IloSolver s, IlcInt size, IlcFloat * values) |
public | IlcFloatArray(IloSolver solver, IlcInt size, IlcFloat prototype=0) |
public | IlcFloatArray(IloSolver solver, IlcInt size, IlcFloat exp0, IlcFloat exp1, ...) |
public | IlcFloatArray(IloSolver solver, IlcInt size, IlcInt exp0, IlcInt exp1, ...) |
Method Summary | |
---|---|
public IlcFloatArrayI * | getImpl() const |
public IlcInt | getSize() const |
public IloSolver | getSolver() const |
public void | operator=(const IlcFloatArray & h) |
public IlcFloat & | operator[](IlcInt i) const |
Constructor Detail |
---|
This constructor creates an empty handle. You must initialize it before you use it.
This constructor creates a handle object from a pointer to an implementation object.
This constructor creates an array of floating-point numbers 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
. When you create an array of floating-point values, the elements of the array
must be of the same type (for example, all floating-point, or all integer, but not a mixture of the
two) because those types are not necessarily the same size in C++. You can write this:
IlcFloatArray arrayok (s, 3, 1., 3., 2.);
or this:
IlcFloatArray arrayOK(s, 3, 1, 3, 2);
but not this:
IlcFloatArray notok(s, 3, 1., 3, 2.); // bad idea
in which some values are floating-point, some are integer, and consequently of different sizes in C++.
This constructor creates an array of size
elements. The argument size
must
be strictly greater than 0 (zero). The elements of this array are not initialized.
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
number of arguments minus one (that is, the number of arguments of type IlcFloat
); it must
also be strictly greater than 0 (zero). The constructor creates an array of the values indicated by the
other arguments. The arguments, exp0
, exp1
, etc. are all of the same type. Do
not mix types within an array.
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 number of arguments minus one (that is, the number of arguments of type IlcInt
);
it must also be strictly greater than 0 (zero). The constructor creates an array of the values indicated
by the other arguments. The arguments, exp0
, exp1
, etc. are all of the same type.
Do not mix types within an array.
Method Detail |
---|
This member function returns a pointer to the implementation object of the invoking handle.
This member function returns the number of elements in the invoking array.
This member function returns an instance of IloSolver
associated with the invoking object.
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.
This operator returns a reference to the element at rank i
. This operator can be used
for accessing (that is, simply reading) the element or for modifying (that is, writing) it.