XmlSerializer¶
-
class
OpenMM::
XmlSerializer
¶ XmlSerializer
is used for serializing objects as XML, and for reconstructing them again.-
template <class T>
-
void
serialize
(const T *object, const std::string &rootName, std::ostream &stream)¶ Serialize an object as XML.
Parameters: - object – the object to serialize
- rootName – the name to use for the root node of the XML document
- stream – an output stream to write the XML to
-
template <class T>
-
T *
deserialize
(std::istream &stream)¶ Reconstruct an object that has been serialized as XML.
Parameters: - stream – an input stream to read the XML from
Returns: a pointer to the newly created object. The caller assumes ownership of the object.
-
template <class T>
-
T *
clone
(const T &object)¶ Clone an object by first serializing it, then deserializing it again. This method constructs the new object directly from the SerializationNodes without first converting them to XML. This means it is faster and uses less memory than making separate calls to
serialize()
anddeserialize()
.
-