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 * context, const char * version=0)
public IloXmlInfo()
Method Summary
public IloBoolcheckAttExistence(IloXmlReader reader, IloXmlElement * element, const char * attribute)
public IloBoolcheckExprExistence(IloXmlReader reader, IloXmlElement * element, const char * attribute, IloInt & id)
public IloXmlContextI *getContext()
protected IloBoolgetIntValArray(IloXmlReader reader, IloXmlElement * element, IloIntArray & intArray)
protected IloBoolgetNumValArray(IloXmlReader reader, IloXmlElement * element, IloNumArray & numArray)
public IloBoolgetRefInChild(IloXmlReader reader, IloXmlElement * element, IloInt & id)
public virtual const char *getTag()
public virtual IloXmlElement *getTagElement(IloXmlWriter writer, const IloRtti * exprI)
public static const char *getTagName()
protected IloNumVar::TypegetVarType(IloXmlReader reader, IloXmlElement * element)
protected const char *getVersion()
protected virtual IloRtti *read(IloXmlReader reader, IloXmlElement * element)
public virtual IloExtractableArray *readArrayFromXml(IloXmlReader reader, IloXmlElement * element)
public virtual IloRtti *readFrom(IloXmlReader reader, IloXmlElement * element)
public virtual IloExtractableI *readFromXml(IloXmlReader reader, IloXmlElement * element)
public IloBoolreadRtti(IloXmlReader reader, IloXmlElement * element)
public virtual IloBoolreadSolution(IloXmlReader reader, IloSolution solution, IloXmlElement * element)
protected virtual IloExtractableI *readXml(IloXmlReader reader, IloXmlElement * element)
protected virtual IloExtractableArray *readXmlArray(IloXmlReader reader, IloXmlElement * element)
protected IloXmlElement *setBoolArray(IloXmlWriter writer, const IloBoolArray Array)
public IloXmlElement *setCommonArrayXml(IloXmlWriter writer, const IloExtractableArray * extractable)
public IloXmlElement *setCommonValueXml(IloXmlWriter writer, const IloRtti * exprI)
public IloXmlElement *setCommonXml(IloXmlWriter writer, const IloRtti * exprI)
protected IloXmlElement *setIntArray(IloXmlWriter writer, const IloIntArray Array)
protected IloXmlElement *setIntSet(IloXmlWriter writer, const IloIntSet Array)
protected IloXmlElement *setNumArray(IloXmlWriter writer, const IloNumArray Array)
protected IloXmlElement *setNumSet(IloXmlWriter writer, const IloNumSet Array)
protected voidsetVersion(const char * version)
public voidsetXml(IloXmlWriter writer, IloXmlElement * element, const IloRtti * exprI)
public virtual intwrite(IloXmlWriter writer, const IloExtractableArray * extractable, IloXmlElement * masterElement)
public virtual IloBoolwrite(IloXmlWriter writer, const IloRtti * exprI, IloXmlElement * masterElement)
public IloBoolwriteExtractable(IloXmlWriter writer, IloXmlElement * element, const IloExtractable extractable, const char * attribute=0)
public virtual IloBoolwriteRef(IloXmlWriter writer, const IloRtti * exprI, IloXmlElement * masterElement)
public IloBoolwriteRtti(IloXmlWriter writer, IloXmlElement * element, const IloRtti * rtti, const char * attribute=0)
public virtual voidwriteSolution(IloXmlWriter writer, const IloSolution solution, const IloExtractable extractable)
public voidwriteSolutionValue(IloXmlWriter writer, const IloSolution solution, IloXmlElement * element, const IloRtti * rtti, const char * attribute)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloSOS2Array array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloSOS1Array array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloSemiContVarArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloConstraintArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloRangeArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloNumVarArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloIntSetVarArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloNumExprArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloIntExprArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloBoolVarArray array)
protected IloBoolwriteVarArray(IloXmlWriter writer, IloXmlElement * element, IloIntVarArray array)
public virtual IloBoolwriteXml(IloXmlWriter writer, const IloExtractableI * exprI, IloXmlElement * masterElement)
public virtual IloBoolwriteXmlRef(IloXmlWriter writer, const IloExtractableI * exprI, IloXmlElement * masterElement)
Constructor and Destructor Detail

IloXmlInfo

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

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.


getTagElement

public virtual IloXmlElement * getTagElement(IloXmlWriter writer, const IloRtti * exprI)

For backward compatibility with 2.0 and the XML for IloExtractable objects, if this method is not specialized, by default the getTagElement method with IloExtractableI will be called


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.


read

protected virtual IloRtti * read(IloXmlReader reader, IloXmlElement * element)

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

This is the method to specialize for each serialization class

For backward compatibility with Concert 2.0 and the XML for IloExtractable objects, by default the method readXml with IloExtractableI will be called


readArrayFromXml

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

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

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


readFrom

public virtual IloRtti * readFrom(IloXmlReader reader, IloXmlElement * element)

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

For backward compatibility with Concert 2.0 and the XML for IloExtractable objects, by default the method readFromXml with IloExtractableI will be called


readFromXml

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

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


readRtti

public IloBool readRtti(IloXmlReader reader, IloXmlElement * element)

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


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 IloRtti 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 IloRtti* 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::readRtti 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 IloRtti * exprI)

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


setCommonXml

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

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


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 IloRtti * exprI)

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


write

public virtual int write(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 serialization class


write

public virtual IloBool write(IloXmlWriter writer, const IloRtti * exprI, IloXmlElement * masterElement)

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

For backward compatibility with Concert 2.0 and the XML for IloExtractable objects, by default the method writeXml with IloExtractableI will be called


writeExtractable

public IloBool writeExtractable(IloXmlWriter writer, IloXmlElement * element, const IloExtractable extractable, const char * attribute=0)

See IloXmlContext::writeRtti(IloXmlWriter,IloXmlElement*,const IloRtti*,const char*) instead. There is no longer need for the extractable argument.


writeRef

public virtual IloBool writeRef(IloXmlWriter writer, const IloRtti * exprI, IloXmlElement * masterElement)

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

For backward compatibility with Concert 2.0 and the XML for IloExtractable objects, by default the method writeXmlRef with IloExtractableI will be called


writeRtti

public IloBool writeRtti(IloXmlWriter writer, IloXmlElement * element, const IloRtti * rtti, const char * attribute=0)

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:
      writeRtti(writer, element,
               (IloRtti*)exprI->getExpr1(),
               IloXmlAttributeDef::Expr1Id);
      writeRtti(writer, element,
               (IloRtti*)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 IloRtti * rtti, 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 IloBool writeXml(IloXmlWriter writer, const IloExtractableI * exprI, IloXmlElement * masterElement)

This member function writes the IloRtti 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 IloRtti object exprI in XML as a reference.