private void ProcessEnumerables(IglScriptBody script, IEnumerable enumerable) { var eid = RegisterObject(enumerable, out var objType); var type = enumerable.GetType(); if ((objType & TokenObjectCategory.NeedsUngraphing) == 0) { return; } Freeze(type, eid); // arrays of primatives can be small // but the ID's used are big // to prevent bloat we just gong to define a dump copy if (type.IsArray) { if (type.IsFundementallyPrimative()) { RegisterDumbCopy(eid, (Array)enumerable); return; } } var copyObjects = (from object obj in enumerable select RegisterObject(obj, out _)).ToList(); RegisterHeavyCopy(eid, copyObjects); }
public IglScriptBuilder(IglScriptBody script) { _blitwork = new WorkBacklog <IglScriptBody, Tuple <object, FieldInfo[]> >(script); _serializationWork = new WorkBacklog <IglScriptBody, Tuple <object, IglRegisterType, SerializationInfo> >(script); _enumerationWork = new WorkBacklog <IglScriptBody, IEnumerable>(script); _script = script; }
private void ProcessBlitsAndSets(IglScriptBody script, Tuple <object, FieldInfo[]> kv) { foreach (var field in kv.Item2) { var fieldValue = field.GetValue(kv.Item1); RegisterObject(fieldValue, out var objType); } foreach (var field in kv.Item2) { RegisterFieldSet(kv.Item1, field.Name, field.GetValue(kv.Item1)); } }
public IglScriptBody GetTokens() { var ret = new IglScriptBody { RootObjects = new List <long>(RootObjects), TypeDef = new LinkedList <IglRegisterType>(TypeDef), Constants = new LinkedList <IglDeclareValue>(Constants), Declaration = new LinkedList <IglDeclareObject>(Declaration), FieldSets = new LinkedList <IglSetField>(FieldSets), FastInitializations = new LinkedList <IglFastCopyTo>(FastInitializations), HeavyInitializations = new LinkedList <IglHeavyCopyTo>(HeavyInitializations), SpecialInitializations = new LinkedList <IglSpecialSerialization>(SpecialInitializations) }; return(ret); }
private void ProcessSerializables(IglScriptBody script, Tuple <object, IglRegisterType, SerializationInfo> arg2) { var root = RegisterObject(arg2.Item1, out var objType); var numerator = arg2.Item3.GetEnumerator(); while (numerator.MoveNext()) { RegisterObject(numerator.Value, out _); } numerator = arg2.Item3.GetEnumerator(); var specials = new Dictionary <string, long>(); while (numerator.MoveNext()) { specials[numerator.Name] = RegisterObject(numerator.Value, out _); } RegisterSerialization(root, arg2.Item2, specials); }