MCPcopy Create free account
hub / github.com/Kitware/VTK / deserialize

Method deserialize

Serialization/Manager/Testing/Python/TestBlobs.py:50–80  ·  view source on GitHub ↗
(states, hash_to_blob_map)

Source from the content-addressed store, hash-verified

48 return states, hash_to_blob_map
49
50 def deserialize(states, hash_to_blob_map):
51 global arrayF32Id, arrayUI32Id
52
53 if not len(states):
54 return
55
56 manager = vtkObjectManager()
57 if not manager.Initialize():
58 return
59
60 for state in states:
61 manager.RegisterState(state)
62 for hash_text, blob in hash_to_blob_map.items():
63 manager.RegisterBlob(hash_text, blob)
64
65 manager.UpdateObjectsFromStates()
66 active_ids = manager.GetAllDependencies(0)
67
68 self.assertEqual(len(active_ids), 2)
69 self.assertEqual(arrayF32Id in active_ids, True)
70 self.assertEqual(arrayUI32Id in active_ids, True)
71
72 arrayF32 = manager.GetObjectAtId(arrayF32Id)
73 self.assertIsInstance(arrayF32, vtkTypeFloat32Array)
74
75 arrayUI32 = manager.GetObjectAtId(arrayUI32Id)
76 self.assertIsInstance(arrayUI32, vtkUnsignedIntArray)
77
78 for i in range(10):
79 self.assertEqual(10 - i, arrayF32.GetValue(i))
80 self.assertEqual(20 + i, arrayUI32.GetValue(i))
81
82
83 deserialize(*serialize())

Callers

nothing calls this directly

Calls 9

rangeClass · 0.50
InitializeMethod · 0.45
RegisterStateMethod · 0.45
itemsMethod · 0.45
RegisterBlobMethod · 0.45
GetAllDependenciesMethod · 0.45
GetObjectAtIdMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected