Overview | Group | Tree | Graph | Index | Concepts |
An instance of IloXmlContext
allows you to serialize an
IloModel
or an IloSolution
in XML.
You can write an IloModel
using
IloXmlContext::writeModel
, write an
IloSolution
using IloXmlContext::writeSolution
,
or write both using IloXmlContext::writeModelAndSolution
.
You can read an IloModel
in XML using
IloXmlContext::readModel
, read an IloSolution
in XML using IloXmlContext::readSolution
, or read both
using IloXmlContext::readModelAndSolution
.
Other products should add their own serialization class and add
them to the plug-in using the member functions
IloXmlContext::registerXML
and
IloXmlContext::registerXMLArray
.
For example, you can write:
IloModel model(env); IloSolution solution(env); ...; IloXmlcontext context(env); context.writeModel(model, "model.xml"); context.writeSolution(solution, "solution.xml");
or you can write
IloModel model(env); IloSolution solution(env); IloXmlcontext context(env); context.readModel(model, "model.xml"); context.readSolution(solution, "solution.xml");
See Also:
IloXmlReader, IloXmlWriter, IloXmlInfo
Constructor Summary | |
---|---|
public | IloXmlContext(IloEnv) |
public | IloXmlContext(IloXmlContextI *) |
Constructor Detail |
---|
This constructor creates an XML context and makes it part of the environment
env
.
This constructor creates a XML context from its implementation object.
Method Detail |
---|
This member function deletes the invoking XML context.
This member function returns the XML ID of the child unparsed XML
element in cases where a problem occurs when reading an IloModel
.
This member function returns the XML tag of the child unparsed XML element
in cases where a problem occurs when reading an IloModel
This member function returns the XML ID list of the unparsed XML elements
in cases where a problem occurs when reading an IloModel
. The list
is composed of the tags from the parent to the child elements.
This member function returns the IloXmlContextI
implementation.
This member function returns the XML ID of the parent unparsed XML
element in cases where a problem occurs when reading an IloModel
.
This member function returns the XML tag of the parent unparsed XML element
in cases where a problem occurs when reading an IloModel
.
This member function returns the XML tag list of the unparsed XML elements
in cases where a problem occurs when reading an IloModel
. The list
is composed of the tags from the parent to the child elements.
This member function returns the name of the extractable called in cases
where a problem occurs when reading an IloModel
.
This member function returns the write precision for floats
This member function tries to read all extractables from the XML element.
This member function reads model
from an XML stream.
This member function reads model
from the XML file
fileName
.
This member function reads model
and
solution
from their respective XML files,
modelFileName
and solutionFileName
.
This member function reads solution
from an XML stream.
This member function reads solution
from the XML file
fileName
.
This member function reads an IloSolution
object from an XML element.
This member function registers the serialization class of an extractable with a linked ID, usually its RTTI index. In write mode, the RTTI index is used to catch the correct serialization class.
In read mode, IloXmlInfo::getTagName
is used to link the correct serialization class to the correct tag.
IloXmlcontext context(env); context.registerXML(IloAllDiffI::GetTypeIndex(), new (env) IloXmlInfo_AllDiff(context));
This member function registers the serialization class of an array of extractables with a linked ID.
context.registerXMLArray(new (env) IloXmlInfo_SOS2Array(context));
This member function sets the write mode. The write mode can be set to
NoUnknown
or EvenUnknown
. NoUnknown
throws an exception
if an attempt is made to serialize an unknown extractable. EvenUnknown
writes a Unknown
tag with the name of the extractable in a type attribute.
This member function sets the write precision for floats.
By default, there is no rounding mode on an IloNum
or an
IloNumArray
.
You can also choose the no rounding mode with the IloNoRoundingMode
constant.
This member function writes a specified extractable. It is used from the serialization class of an extractable to write a embedded extractable.
The IloOr
object calls this method on its constrained
vars
.
See Also:
This member function writes model
to the file
fileName
in XML format.
This member function writes model
to the file
modelFileName
and solution
to the file
solutionFileName
in XML format.
This member function writes solution
to the file
fileName
in XML format.
This member function writes a specified extractable of a solution in XML. It is used from the serialization class of an extractable to write an embedded extractable.
See Also:
IloXmlInfo::writeSolutionValue