XPRBindexSet
XPRBindexSet |
Description
Constructors
Methods
Add an index to an index set.
Get the C modeling object.
Get the index number of an index.
Get the name of an index.
Get the name of an index set.
Get the size of an index set.
Test the validity of the index set object.
Print out an index set
Reset the index set object.
Operators
Adding an element to an index set:
Accessing index set elements by their name or index number:
Constructor detail
XPRBindexSet
|
|||
Synopsis
|
XPRBindexSet();
XPRBindexSet(xbidxset *iset); |
||
Argument
|
|
||
Description
|
Create a new index set object.
|
||
|
Method detail
addElement
|
|||
Synopsis
|
int addElement(const char *text);
|
||
Argument
|
|
||
Return value
|
Sequence number of the index within the set, -1 in case of an error.
|
||
Description
|
This method adds an index entry to an index set. The new element is only added to the set if no identical index already exists. Both in the case of a new index entry and an existing one, the method returns the sequence number of the index in the index set. Note that the numbering of index elements starts with
0.
|
||
Example
|
The following example shows how to add an element to an index set and then retrieve its index and its name, (a) using the corresponding functions and (b) using the overloaded operators of this class.
XPRBprob prob("myprob"); XPRBindexSet ISet; int ind; ISet = prob.newIndexSet("IS"); ind = ISet.addElement("a"); cout << "First element: " << ISet.getIndexName(ind); cout << ", index of 'a': " << ISet.getIndex("a") << endl; ISet += "b"; // Add a second element cout << "Element 1: " << ISet[1]; cout << ", index of 'b': " << ISet["b"] << endl; |
||
Related topics
|
Calls
XPRBaddidxel
|
||
getCRef
|
|||
Synopsis
|
xbidxset *getCRef();
|
||
Return value
|
The underlying modeling object in BCL C.
|
||
Description
|
This method returns the index set object in BCL C that belongs to the C++ index set object.
|
||
getIndex
|
|||
Synopsis
|
int getIndex(const char *text);
|
||
Argument
|
|
||
Return value
|
Sequence number of the index in the set, or -1 if not contained.
|
||
Description
|
|||
Example
|
|||
Related topics
|
Calls
XPRBgetidxel
|
||
getIndexName
|
|||
Synopsis
|
const char *getIndexName(int i);
|
||
Argument
|
|
||
Return value
|
Name of the i
th element in the set if function executed successfully,
NULL otherwise.
|
||
Description
|
|||
Example
|
|||
Related topics
|
Calls
XPRBgetidxelname
|
||
getName
|
|||
Synopsis
|
const char *getName();
|
||
Return value
|
Name of the index set if function executed successfully,
NULL otherwise.
|
||
Description
|
|||
Example
|
See
XPRBindexSet.getSize.
|
||
Related topics
|
Calls
XPRBgetidxsetname
|
||
getSize
|
|||
Synopsis
|
int getSize();
|
||
Return value
|
Size (= number of elements) of the set, -1 in case of an error.
|
||
Description
|
This function returns the current number of elements in an index set. This value does not necessarily correspond to the size specified at the creation of the set. The returned value may be smaller if fewer elements than the originally reserved number have been added, or larger if more elements have been added. (In the latter case, the size of the set is automatically increased.)
|
||
Example
|
This example displays the name, size, and complete contents of an index set.
XPRBprob prob("myprob"); XPRBindexSet ISet; ISet = prob.newIndexSet("IS"); cout << ISet.getName() << " size: " << ISet.getSize() << endl; ISet.print(); |
||
Related topics
|
Calls
XPRBgetidxsetsize
|
||
isValid
|
|||
Synopsis
|
bool isValid();
|
||
Return value
|
true if object is valid,
false otherwise.
|
||
Description
|
This method checks whether the index set object is correctly defined. It should always be used to test the result returned by
XPRBprob.getIndexSetByName.
|
||
Example
|
|||
print
|
|||
Synopsis
|
int print();
|
||
Return value
|
0 if function executed successfully, 1 otherwise.
|
||
Description
|
|||
Example
|
See
XPRBindexSet.getSize.
|
||
Related topics
|
Calls
XPRBprintidxset
|
||
reset
|
|||
Synopsis
|
void reset();
|
||
Description
|
|||
|