public abstract void FinalizeChunk(Chunk chunkPtr, string structType, DnaID chunkCode, IntPtr oldPtr);
public override Chunk Allocate(uint size, int numElements) { int length = (int)size * numElements; IntPtr ptr = InternalAlloc(length + ChunkInd.Size); IntPtr data = ptr + ChunkInd.Size; Chunk chunk = new Chunk(ptr, true) { ChunkCode = 0, OldPtr = data, Length = length, Number = numElements }; _chunkPtrs.Add(chunk); return chunk; }
public override void FinalizeChunk(Chunk chunk, string structType, DnaID chunkCode, IntPtr oldPtr) { if ((SerializationFlags & SerializationFlags.NoDuplicateAssert) == 0) { Debug.Assert(FindPointer(oldPtr) == IntPtr.Zero); } chunk.DnaNr = Array.IndexOf(_structs, GetReverseType(structType)); chunk.ChunkCode = (int)chunkCode; IntPtr uniquePtr = GetUniquePointer(oldPtr); _chunkP.Add(oldPtr, uniquePtr);//chunk->m_oldPtr); chunk.OldPtr = uniquePtr;//oldPtr; }
public override void FinalizeChunk(Chunk chunk, string structType, DnaID chunkCode, IntPtr oldPtr) { if ((SerializationFlags & SerializationFlags.NoDuplicateAssert) == 0) { Debug.Assert(FindPointer(oldPtr) == IntPtr.Zero); } Dna.StructDecl structDecl = _dna.GetStruct(structType); for (int i = 0; i < _dna.NumStructs; i++) { if (_dna.GetStruct(i) == structDecl) { chunk.DnaNr = i; break; } } chunk.ChunkCode = (int)chunkCode; IntPtr uniquePtr = GetUniquePointer(oldPtr); _chunkP.Add(oldPtr, uniquePtr);//chunk->m_oldPtr); chunk.OldPtr = uniquePtr;//oldPtr; }