SerializationProxy

class openmm.openmm.SerializationProxy(*args, **kwargs)

A SerializationProxy is an object that knows how to serialize and deserialize objects of a particular type. This is an abstract class. Subclasses implement the logic for serializing particular types of logic.

A global registry maintains the list of what SerializationProxy to use for each type of object. Call registerProxy() to register the proxy for a particular type. This is typically done at application startup or by a dynamic library’s initialization code.

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(*args, **kwargs)

Initialize self.

deserialize(self, node)

Reconstruct an object from its serialized data.

getProxy(-> SerializationProxy)

Get the SerializationProxy to use for objects of a particular type, specified by type_info.

getTypeName(self)

Get the name of the object type this proxy manipulates, as passed to the constructor.

registerProxy(type, proxy)

Register a SerializationProxy to be used for objects of a particular type.

serialize(self, object, node)

Subclasses implement this method to record information about an object being serialized.

Attributes

thisown

The membership flag

property thisown

The membership flag

static registerProxy(type, proxy)

Register a SerializationProxy to be used for objects of a particular type.

Parameters
  • type (type_info) – the type_info for the object type

  • proxy (SerializationProxy *) – the proxy to use for objects of the specified type

static getProxy(typeName)SerializationProxy
static getProxy(type)SerializationProxy

Get the SerializationProxy to use for objects of a particular type, specified by type_info.

Parameters

type (type_info) – the type_info of the object type to get a proxy for

getTypeName(self)std::string const &

Get the name of the object type this proxy manipulates, as passed to the constructor.

serialize(self, object, node)

Subclasses implement this method to record information about an object being serialized.

Parameters
  • object (void *) – a pointer to the object being serialized

  • node (SerializationNode) – all data to be serialized should be stored into this node, either directly as properties or indirectly by adding child nodes to it

deserialize(self, node)void *

Reconstruct an object from its serialized data.

Parameters

node (SerializationNode) – a SerializationNode containing the object’s description

Returns

a pointer to a new object created from the data. The caller assumes ownership of the object.

Return type

void *