Exemple #1
0
 def __init__(self):
     self.array_serializer = _ArraySerializer()
     self.array_serializer.set_type(_ComplexSerializer())
     atom_serializer = _AtomSerializer()
     long_serializer = _LongSerializer()
     self.dict = _DictionarySerializer()
     self.dict.set_types(long_serializer, atom_serializer)
Exemple #2
0
 def __init__(self):
     self.__complex = _ComplexSerializer()
     atom_serializer = _AtomSerializer()
     long_serializer = _LongSerializer()
     self.__dict = _DictionarySerializer()
     self.__dict.set_types(long_serializer, atom_serializer)
     self.__data = _VolumeDataSerializer()
     self.__properties = _VolumePropertiesSerializer()
 def __init__(self):
     self.workspace = _WorkspaceSerializer()
     atom_serializer = _AtomSerializer()
     long_serializer = _LongSerializer()
     self.dict = _DictionarySerializer()
     self.dict.set_types(long_serializer, atom_serializer)
Exemple #4
0
 def __init__(self):
     self.__array = _ArraySerializer()
     self.__array.set_type(_ComplexSerializer())
     self.__dict = _DictionarySerializer()
     self.__dict.set_types(_LongSerializer(), _AtomSerializer())
Exemple #5
0
 def __init__(self):
     self.__dictionary = _DictionarySerializer()
     self.__dictionary.set_types(_StringSerializer(), _ByteSerializer())
Exemple #6
0
import os
import traceback
import zlib

from nanome.util import Logs
from nanome._internal._network._serialization import _ContextSerialization, _ContextDeserialization
from nanome._internal._structure._serialization import _WorkspaceSerializer, _AtomSerializer
from nanome._internal._util._serializers import _DictionarySerializer, _StringSerializer, _ByteSerializer, _TypeSerializer, _LongSerializer

# This package uses undocumented network code, in order to reuse already available serialization code

workspace_serializer = _WorkspaceSerializer()
dictionary_serializer = _DictionarySerializer()
dictionary_serializer.set_types(_StringSerializer(), _ByteSerializer())
atom_dictionary_serializer = _DictionarySerializer()
atom_dictionary_serializer.set_types(_LongSerializer(), _AtomSerializer())


def to_data(workspace):
    context = _ContextSerialization(0, _TypeSerializer.get_version_table())
    context.write_uint(0)  # Version
    context.write_using_serializer(dictionary_serializer,
                                   _TypeSerializer.get_version_table())

    subcontext = context.create_sub_context()
    subcontext.payload["Atom"] = {}
    subcontext.write_using_serializer(workspace_serializer, workspace)
    context.write_using_serializer(atom_dictionary_serializer,
                                   subcontext.payload["Atom"])
    context.write_bytes(subcontext.to_array())
Exemple #7
0
 def __init__(self):
     self.__complex = _ComplexSerializer()
     self.__string = _StringSerializer()
     self.__dict = _DictionarySerializer()
     self.__dict.set_types(_LongSerializer(), _AtomSerializer())
Exemple #8
0
 def __init__(self, shallow=False):
     self.shallow = shallow
     self.array = _ArraySerializer()
     self.string = _StringSerializer()
     self.dictionary = _DictionarySerializer()
     self.dictionary.set_types(self.string, self.string)