コード例 #1
0
 public RegisteredType(uint id, Type type, TypeSignatureCreator signatureCreator, ValueInstantiator instantiator, ValueWrapper wrapper)
 {
     Id            = id;
     Type          = type;
     TypeSignature = signatureCreator(id, type);
     Instantiator  = instantiator;
     Wrapper       = wrapper;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        uint RegisterBuiltInType(Type type, TypeSignatureCreator signatureCreator, ValueInstantiator instantiator, ValueWrapper wrapper)
        {
            if (_nextBuiltInType > MaxBuiltInTypeId)
            {
                throw new InvalidOperationException();
            }

            return(RegisterTypeInternal(ref _nextBuiltInType, type, signatureCreator, instantiator, wrapper));
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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);
        }