NO FRAMES

Class IloXmlInfo

Definition file: ilconcert/iloxmlabstract.h

The class IloXmlInfo allows you to serialize an IloModel or an IloSolution in XML.

Constructor and Destructor Summary
public IloXmlInfo(IloXmlContextI *, const char *)
public IloXmlInfo()
Method Summary
public IloBoolcheckAttExistence(IloXmlReader, IloXmlElement *, const char *)
public IloBoolcheckExprExistence(IloXmlReader, IloXmlElement *, const char *, IloInt &)
public IloXmlContextI *getContext()
protected IloBoolgetIntValArray(IloXmlReader, IloXmlElement *, IloIntArray &)
protected IloBoolgetNumValArray(IloXmlReader, IloXmlElement *, IloNumArray &)
public IloBoolgetRefInChild(IloXmlReader, IloXmlElement *, IloInt &)
public virtual const char *getTag()
public static const char *getTagName()
protected IloNumVar::TypegetVarType(IloXmlReader, IloXmlElement *)
protected const char *getVersion()
public virtual IloExtractableArray *readArrayFromXml(IloXmlReader, IloXmlElement *)
public IloBoolreadExtractable(IloXmlReader, IloXmlElement *)
public virtual IloExtractableI *readFromXml(IloXmlReader, IloXmlElement *)
public virtual IloBoolreadSolution(IloXmlReader, IloSolution &, IloXmlElement *)
protected virtual IloExtractableI *readXml(IloXmlReader, IloXmlElement *)
protected virtual IloExtractableArray *readXmlArray(IloXmlReader, IloXmlElement *)
protected IloXmlElement *setBoolArray(IloXmlWriter, const IloBoolArray)
public IloXmlElement *setCommonArrayXml(IloXmlWriter, const IloExtractableArray *)
public IloXmlElement *setCommonValueXml(IloXmlWriter, const IloExtractableI *)
public IloXmlElement *setCommonXml(IloXmlWriter, const IloExtractableI *)
protected IloXmlElement *setIntArray(IloXmlWriter, const IloIntArray)
protected IloXmlElement *setIntSet(IloXmlWriter, const IloIntSet)
protected IloXmlElement *setNumArray(IloXmlWriter, const IloNumArray)
protected IloXmlElement *setNumSet(IloXmlWriter, const IloNumSet)
protected voidsetVersion(const char *)
public voidsetXml(IloXmlWriter, IloXmlElement *, const IloExtractableI *)
public IloBoolwriteExtractable(IloXmlWriter, IloXmlElement *, const IloExtractableI *, const char *)
public virtual voidwriteSolution(IloXmlWriter, const IloSolution, const IloExtractable)
public voidwriteSolutionValue(IloXmlWriter, const IloSolution, IloXmlElement *, const IloExtractableI *, const char *)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloSOS2Array)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloSOS1Array)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloSemiContVarArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloConstraintArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloRangeArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloNumVarArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloIntSetVarArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloNumExprArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloIntExprArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloBoolVarArray)
protected IloBoolwriteVarArray(IloXmlWriter, IloXmlElement *, IloIntVarArray)
public virtual intwriteXml(IloXmlWriter, const IloExtractableArray *, IloXmlElement *)
public virtual IloBoolwriteXml(IloXmlWriter, const IloExtractableI *, IloXmlElement *)
public virtual IloBoolwriteXmlRef(IloXmlWriter, const IloExtractableI *, IloXmlElement *)
Constructor and Destructor Detail

IloXmlInfo

public IloXmlInfo(IloXmlContextI * context, const char * version)

This constructor creates an instance of the handle class IloXmlInfo from a pointer to an instance of the undocumented implementation class IloXmlContextI.


IloXmlInfo

public IloXmlInfo()

This constructor creates an empty instance of the handle class IloXmlInfo.


Method Detail

checkAttExistence

public IloBool checkAttExistence(IloXmlReader reader, IloXmlElement * element, const char * attribute)

Given a specified attribute, this member function checks element to establish whether the attribute exists. If the attribute does not exist, this member function throws an exception.

You can use this member function to dynamically validate an XML element.


checkExprExistence

public IloBool checkExprExistence(IloXmlReader reader, IloXmlElement * element, const char * attribute, IloInt & id)

Given a specified attribute, this member function checks element to establish whether the attribute exists, fills the id, and checks in the XML context memory whether an object with this id exists.

You can use this member function to dynamically validate an XML element.

Example: in the read method of the IloDiff, check that the IdRef object is already serialized


getContext

public IloXmlContextI * getContext()

This member function returns the related IloXmlContextI of the constructor.


getIntValArray

protected IloBool getIntValArray(IloXmlReader reader, IloXmlElement * element, IloIntArray & intArray)

This member function returns the contained IloIntArray in the XML element element.

See Also:


getNumValArray

protected IloBool getNumValArray(IloXmlReader reader, IloXmlElement * element, IloNumArray & numArray)

This member function returns the IloNumArray in the XML element element.

See Also:


getRefInChild

public IloBool getRefInChild(IloXmlReader reader, IloXmlElement * element, IloInt & id)

Given an XML element, this member function checks for the first value id or RefId in the element and its children.


getTag

public virtual const char * getTag()

This member function returns the related XML tag.


getTagName

public static const char * getTagName()

This static member function returns the linked XML tag of this serialization class.


getVarType

protected IloNumVar::Type getVarType(IloXmlReader reader, IloXmlElement * element)

This member function returns the type of an IloNumVar - IloFloat, IloInt, or IloBool - in the XML element element.


getVersion

protected const char * getVersion()

This member function returns the version of the object.


readArrayFromXml

public virtual IloExtractableArray * readArrayFromXml(IloXmlReader reader, IloXmlElement * element)

This member function reads an array of IloExtractableI* from the given XML element.

This is the method to specialize when writing a serialization class for an array of extractables.


readExtractable

public IloBool readExtractable(IloXmlReader reader, IloXmlElement * element)

This member function asks the XML context to read the IloExtractableI in the child element and then calls IloXmlInfo::readFromXml to read the parent extractable.


readFromXml

public virtual IloExtractableI * readFromXml(IloXmlReader reader, IloXmlElement * element)

This member function reads an IloExtractableI from the given XML element. It asks the XML context to read the extractable in the XML child element using a call to IloXmlContext::readExtractable; it then calls IloXmlInfo::readXml.


readSolution

public virtual IloBool readSolution(IloXmlReader reader, IloSolution & solution, IloXmlElement * element)
This member function reads a variable for IloSolution from the XML element element.

readXml

protected virtual IloExtractableI * readXml(IloXmlReader reader, IloXmlElement * element)

This member function reads an IloExtractableI from the given XML element.

This is the method to specialize for each serialization class


readXmlArray

protected virtual IloExtractableArray * readXmlArray(IloXmlReader reader, IloXmlElement * element)

This member function reads an array of IloExtractableI* from the given XML element.

It is called by the XML context. It first asks the XML context to read from XML child elements using a call to IloXmlContext::readExtractable and then calls IloXmlInfo::readArrayFromXml.


setBoolArray

protected IloXmlElement * setBoolArray(IloXmlWriter writer, const IloBoolArray Array)

This member function creates an XML element containing the IloBoolArray.

See Also:


setCommonArrayXml

public IloXmlElement * setCommonArrayXml(IloXmlWriter writer, const IloExtractableArray * extractable)

This member function creates a XML element with the common header for IloExtractable arrays.


setCommonValueXml

public IloXmlElement * setCommonValueXml(IloXmlWriter writer, const IloExtractableI * exprI)

This member function creates an XML element with the given header for IloExtractableI from IloSolution.


setCommonXml

public IloXmlElement * setCommonXml(IloXmlWriter writer, const IloExtractableI * exprI)

This member function creates an XML element with the common header for IloExtractableI.


setIntArray

protected IloXmlElement * setIntArray(IloXmlWriter writer, const IloIntArray Array)

This member function creates an XML element containing the IloIntArray.

See Also:


setIntSet

protected IloXmlElement * setIntSet(IloXmlWriter writer, const IloIntSet Array)

This member function creates an XML element containing the IloIntSet.

See Also:


setNumArray

protected IloXmlElement * setNumArray(IloXmlWriter writer, const IloNumArray Array)

This member function creates an XML element containing the IloNumArray.

See Also:


setNumSet

protected IloXmlElement * setNumSet(IloXmlWriter writer, const IloNumSet Array)

This member function creates an XML element containing the IloNumSet.

See Also:


setVersion

protected void setVersion(const char * version)

This member function sets the version of the object.


setXml

public void setXml(IloXmlWriter writer, IloXmlElement * element, const IloExtractableI * exprI)

This member function adds a name attribute and a ID attribute to the XML element.


writeExtractable

public IloBool writeExtractable(IloXmlWriter writer, IloXmlElement * element, const IloExtractableI * extractableI, const char * attribute)

This member function writes an embedded extractable. Using the getId() method of the extractable, it adds an attribute with the ID in the xml element.

For example, used with IloDiff, this member function writes the expression and links it to the XML element via an IdRef attribute.

  // using an IloDiffI* exprI:
      writeExtractable(writer, element,
               (IloExtractableI*)exprI->getExpr1(),
               IloXmlAttributeDef::Expr1Id);
      writeExtractable(writer, element,
               (IloExtractableI*)exprI->getExpr2(),
               IloXmlAttributeDef::Expr2Id);
   *

See Also:


writeSolution

public virtual void writeSolution(IloXmlWriter writer, const IloSolution solution, const IloExtractable extractable)

This member function writes the specified extractable extractable from the IloSolutionsolution in XML format.


writeSolutionValue

public void writeSolutionValue(IloXmlWriter writer, const IloSolution solution, IloXmlElement * element, const IloExtractableI * extractableI, const char * attribute)

This member function writes an embedded extractable of a solution in xml. Using the getId() method of the extractable, it adds an attribute with the ID in the xml element.

For example, used with IloDiff, this member function writes the expression and links it to the XML element via an IdRef attribute.

See Also:


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloSOS2Array array)

This member function writes an IloSOS2Array. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloSOS2s of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloSOS1Array array)

This member function writes an IloSOS1Array. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloSOS1s of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloSemiContVarArray array)

This member function writes an IloSemiContVarArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloSemiContVars of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloConstraintArray array)

This member function writes an IloConstraintArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloConstraints of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloRangeArray array)

This member function writes an IloRangeArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloRanges of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloNumVarArray array)

This member function writes an IloNumVarArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloNumVars of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloIntSetVarArray array)

This member function writes an IloIntSetVarArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloIntSetVars of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloNumExprArray array)

This member function writes an IloNumExprArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloNumExprs of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloIntExprArray array)

This member function writes an IloIntExprArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloIntExprs of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloBoolVarArray array)

This member function writes an IloBoolVarArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloBoolVars of array.


writeVarArray

protected IloBool writeVarArray(IloXmlWriter writer, IloXmlElement * element, IloIntVarArray array)

This member function writes an IloIntVarArray. It adds an attribute in the XML element element with the ID of array, serializes array, and, if necessary, serializes the IloIntVars of array.

Example using IloSos containing an IloIntVarArray:

 // Using an IloSOS1I* exprI;

	   this.writeVarArray(writer,
                       element,
                       exprI->getVarArray(),
                       IloXmlAttributeDef::IdRef);
 

This sample adds an IdRef attribute on the SOS XML element, creates an XML element containing the IloIntVarArray with the list of IloIntVar IDs, and creates a list of XML elements for the IloIntVars.


writeXml

public virtual int writeXml(IloXmlWriter writer, const IloExtractableArray * extractable, IloXmlElement * masterElement)

This member function writes the given IloExtractableArray in XML and adds it to the XML document of writer. This is the method to specialize when writing a serialzation class


writeXml

public virtual IloBool writeXml(IloXmlWriter writer, const IloExtractableI * exprI, IloXmlElement * masterElement)

This member function writes the IloExtractableI object exprI in XML and adds it to the XML document of the IloXmlWriter object writer.


writeXmlRef

public virtual IloBool writeXmlRef(IloXmlWriter writer, const IloExtractableI * exprI, IloXmlElement * masterElement)

This member function writes the IloExtractableI object exprI in XML as a reference.