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

Method serialize

Serialization/Manager/Testing/Python/TestBlobs.py:13–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 arrayUI32Id = ""
12
13 def serialize():
14 global arrayF32Id, arrayUI32Id
15
16 manager = vtkObjectManager()
17 if not manager.Initialize():
18 return
19
20
21 arrayF32 = vtkTypeFloat32Array()
22 arrayUI32 = vtkUnsignedIntArray()
23 for i in range(10):
24 arrayF32.InsertNextValue(10 - i)
25 arrayUI32.InsertNextValue(20 + i)
26
27 arrayF32Id = manager.RegisterObject(arrayF32)
28 self.assertEqual(arrayF32Id, 1)
29
30 arrayUI32Id = manager.RegisterObject(arrayUI32)
31 self.assertEqual(arrayUI32Id, 2)
32
33 manager.UpdateStatesFromObjects()
34 active_ids = manager.GetAllDependencies(0)
35
36 # these are not guaranteed to appear in the exact same order
37 # due to the unordered_map in use within vtkObjectManager.
38 self.assertEqual(len(active_ids), 2)
39 self.assertEqual(arrayF32Id in active_ids, True)
40 self.assertEqual(arrayUI32Id in active_ids, True)
41
42 states = [ manager.GetState(object_id) for object_id in active_ids ]
43 hash_to_blob_map = { blob_hash: manager.GetBlob(blob_hash, True) for blob_hash in manager.GetBlobHashes(active_ids) }
44
45 manager.UnRegisterObject(arrayF32Id)
46 manager.UnRegisterObject(arrayUI32Id)
47
48 return states, hash_to_blob_map
49
50 def deserialize(states, hash_to_blob_map):
51 global arrayF32Id, arrayUI32Id

Callers

nothing calls this directly

Calls 12

vtkTypeFloat32ArrayClass · 0.85
GetBlobHashesMethod · 0.80
vtkUnsignedIntArrayFunction · 0.50
rangeClass · 0.50
InitializeMethod · 0.45
InsertNextValueMethod · 0.45
RegisterObjectMethod · 0.45
GetAllDependenciesMethod · 0.45
GetStateMethod · 0.45
GetBlobMethod · 0.45
UnRegisterObjectMethod · 0.45

Tested by

no test coverage detected