public RegisteredType(uint id, Type type, TypeSignatureCreator signatureCreator, ValueInstantiator instantiator, ValueWrapper wrapper) { Id = id; Type = type; TypeSignature = signatureCreator(id, type); Instantiator = instantiator; Wrapper = wrapper; }
void RegisterBuiltInValueType <T>(ReadWriteOperations <T> operations) { ValueInstantiator instantiator = BuiltInValue <T> .CreateInstantiator(operations); ValueWrapper wrapper = BuiltInValue <T> .CreateWrapper(operations); RegisterBuiltInType(typeof(T), StandardTypeSignature.Create, instantiator, wrapper); }
uint RegisterBuiltInType(Type type, TypeSignatureCreator signatureCreator, ValueInstantiator instantiator, ValueWrapper wrapper) { if (_nextBuiltInType > MaxBuiltInTypeId) { throw new InvalidOperationException(); } return(RegisterTypeInternal(ref _nextBuiltInType, type, signatureCreator, instantiator, wrapper)); }
static void GetInstantiatorAndWrapper(Type type, out ValueInstantiator instantiator, out ValueWrapper wrapper) { if (type.IsEnum) { instantiator = EnumValue.CreateInstantiator(type); wrapper = EnumValue.CreateWrapper(type); return; } instantiator = ReflectedClassValue.Instantiate; wrapper = ReflectedClassValue.WrapRawValue; }
uint RegisterTypeInternal(ref uint nextIdVariable, Type type, TypeSignatureCreator signatureCreator, ValueInstantiator instantiator, ValueWrapper wrapper) { RegisteredType registeredType = new RegisteredType(nextIdVariable, type, signatureCreator, instantiator, wrapper); _registeredTypes.Add(registeredType); nextIdVariable++; return(registeredType.Id); }