()
| 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 |
nothing calls this directly
no test coverage detected