void TestRemappingOfOIs(CObjectWriter* pcWriter, CObjectReader* pcReader) { CFileUtil cFileUtil; Ptr<CTestSaveableObject2> cBase; Ptr<CTestSaveableObject2> cStart1; Ptr<CRoot> cRoot; Ptr<CString> szOne; Ptr<CString> cString1; Ptr<CString> cString2; CObjectGraphSerialiser cGraphSerialiser; CObjectGraphDeserialiser cGraphDeserialiser; Ptr<CTestSaveableObject1> cShared; int i; CObjectAllocator cAllocator; CDependentReadObjects cDependentReadObjects; cFileUtil.MakeDir("Output/GraphDeserialiser/Simple/Remapping"); ObjectsInit("Output/GraphDeserialiser/Simple/Remapping"); TestObjectGraphDeserialiserAddConstructors(); TestObjectGraphDeserialiserBuildGraph1(); cBase = gcObjects.Get("Ow/Start 1"); AssertTrue(cBase.IsNotNull()); AssertLongLongInt(3, cBase->GetOI()); cString1 = gcObjects.Get(6LL); AssertString("Black", cString1->Text()); AssertLongLongInt(6LL, cString1->GetOI()); cString2 = gcObjects.Get(7LL); AssertString("Jack", cString2->Text()); AssertLongLongInt(7LL, cString2->GetOI()); cGraphSerialiser.Init(pcWriter); AssertTrue(cGraphSerialiser.Write(&cBase)); cGraphSerialiser.Kill(); pcWriter->Kill(); ObjectsKill(); ObjectsInit("Output/GraphDeserialiser/Simple/Remapping"); TestObjectGraphDeserialiserAddConstructors(); cRoot = ORoot(); for (i = 0; i < 20; i++) { szOne = OMalloc(CString); szOne->Init("Hello World "); szOne->Append(i); cRoot->Add(szOne); AssertLongLongInt(3+i, szOne->GetOI()); } cAllocator.Init(&gcObjects); cDependentReadObjects.Init(); cGraphDeserialiser.Init(pcReader, FALSE, &cAllocator, &cDependentReadObjects, gcObjects.GetMemory()); cStart1 = cGraphDeserialiser.Read("Ow/Start 1"); AssertTrue(cStart1.IsNotNull()); AssertLongLongInt(23, cStart1->GetOI()); AssertTrue(cStart1->mp1.IsNotNull()); AssertString("CTestSaveableObject1", cStart1->mp1->ClassName()); cShared = cStart1->mp1; AssertLongLongInt(25, cShared->GetOI()); AssertTrue(cStart1->mp2.IsNotNull()); AssertString("CString", cStart1->mp2->ClassName()); cString1 = cStart1->mp2; AssertLongLongInt(24, cString1->GetOI()); cGraphDeserialiser.Kill(); cDependentReadObjects.Kill(); cAllocator.Kill(); for (i = 0; i < 20; i++) { szOne = OMalloc(CString); szOne->Init("Hello World "); szOne->Append(i + 20); cRoot->Add(szOne); AssertLongLongInt(26+i, szOne->GetOI()); } pcReader->Kill(); ObjectsKill(); }