Antmicro.Migrant.ObjectWriter.HandleNewReference C# (CSharp) Method

HandleNewReference() private method

private HandleNewReference ( object o, int refId ) : void
o object
refId int
return void
        internal void HandleNewReference(object o, int refId)
        {
            var objectForSurrogatesIndex = objectsForSurrogates == null ? -1 : objectsForSurrogates.FindMatchingIndex(o.GetType());
            writer.Write(objectForSurrogatesIndex != -1);
            if(objectForSurrogatesIndex != -1)
            {
                // we use counter-surrogate here just to determine the type of final object
                // bare in mind that it does not have to be the same as initial type of an object
                var restoredObject = objectsForSurrogates.GetByIndex(objectForSurrogatesIndex).DynamicInvoke(new[] { o });
                TouchAndWriteTypeId(restoredObject.GetType());
            }
            if(TryWriteObjectInline(o))
            {
                objectsWrittenInline.Add(refId);
            }
        }