private void RegisterBuiltinHandler(int id, IBuiltinTypeHandler typeHandler, bool
                                            registerPrimitiveClass, string primitiveName, IGenericConverter converter)
        {
            typeHandler.RegisterReflector(_reflector);
            if (primitiveName == null)
            {
                primitiveName = typeHandler.ClassReflector().GetName();
            }
            if (registerPrimitiveClass)
            {
                _reflector.RegisterPrimitiveClass(id, primitiveName, converter);
            }
            IReflectClass         classReflector = typeHandler.ClassReflector();
            PrimitiveTypeMetadata classMetadata  = new PrimitiveTypeMetadata(Container(), typeHandler
                                                                             , id, classReflector);

            Map(id, classMetadata, classReflector);
            if (typeHandler is PrimitiveHandler)
            {
                IReflectClass primitiveClassReflector = ((PrimitiveHandler)typeHandler).PrimitiveClassReflector
                                                            ();
                if (primitiveClassReflector != null)
                {
                    MapPrimitive(0, classMetadata, primitiveClassReflector);
                }
            }
        }
Esempio n. 2
0
 private void AssertPrimitiveHandlerDelegate(Type expectedClass, PrimitiveTypeMetadata
     primitiveMetadata, int version)
 {
     var correctTypeHandler = CorrectHandlerVersion(primitiveMetadata
         .TypeHandler(), version);
     Assert.AreSame(expectedClass, correctTypeHandler.GetType());
 }
 private void Map(int id, PrimitiveTypeMetadata classMetadata, IReflectClass classReflector
                  )
 {
     // TODO: remove when _mapIdToClassMetadata is gone
     MapTypeInfo(id, classMetadata, classReflector);
     MapPrimitive(id, classMetadata, classReflector);
     if (id > _highestBuiltinTypeID)
     {
         _highestBuiltinTypeID = id;
     }
 }
 public override bool Equals(object obj)
 {
     if (!(obj is Db4objects.Db4o.Internal.PrimitiveTypeMetadata))
     {
         return(false);
     }
     Db4objects.Db4o.Internal.PrimitiveTypeMetadata other = (Db4objects.Db4o.Internal.PrimitiveTypeMetadata
                                                             )obj;
     if (TypeHandler() == null)
     {
         return(other.TypeHandler() == null);
     }
     return(TypeHandler().Equals(other.TypeHandler()));
 }
        private void InitArrayHandlers()
        {
            ITypeHandler4 elementHandler = OpenTypeHandler();

            _untypedArrayMetadata = new PrimitiveTypeMetadata(Container(), new ArrayHandler(elementHandler
                                                                                            , false), Handlers4.AnyArrayId, IclassObject);
            _openArrayHandler = _untypedArrayMetadata.TypeHandler();
            MapTypeInfo(Handlers4.AnyArrayId, _untypedArrayMetadata, null);
            _untypedMultiDimensionalMetadata = new PrimitiveTypeMetadata(Container(), new MultidimensionalArrayHandler
                                                                             (elementHandler, false), Handlers4.AnyArrayNId, IclassObject);
            _openMultiDimensionalArrayHandler = _untypedMultiDimensionalMetadata.TypeHandler(
                );
            MapTypeInfo(Handlers4.AnyArrayNId, _untypedMultiDimensionalMetadata, null);
        }
Esempio n. 6
0
 public virtual void TestCorrectHandlerVersion()
 {
     var openTypeHandler = new OpenTypeHandler(Container());
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler0), openTypeHandler, -1);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler0), openTypeHandler, 0);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler2), openTypeHandler, 1);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler2), openTypeHandler, 2);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler), openTypeHandler, HandlerRegistry
         .HandlerVersion);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler), openTypeHandler, HandlerRegistry
         .HandlerVersion + 1);
     var stdReferenceHandler = new StandardReferenceTypeHandler
         (ItemClassMetadata());
     AssertCorrectedHandlerVersion(typeof (StandardReferenceTypeHandler0), stdReferenceHandler
         , 0);
     AssertCorrectedHandlerVersion(typeof (StandardReferenceTypeHandler), stdReferenceHandler
         , 2);
     var primitiveMetadata = new PrimitiveTypeMetadata(Container(),
         openTypeHandler, 0, null);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler0), primitiveMetadata, 0);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler2), primitiveMetadata, 1);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler2), primitiveMetadata, 2);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler), primitiveMetadata, HandlerRegistry
         .HandlerVersion);
     var arrayHandler = new ArrayHandler(openTypeHandler, false);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler0), arrayHandler, 0);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler1), arrayHandler, 1);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler3), arrayHandler, 2);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler3), arrayHandler, 3);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler), arrayHandler, HandlerRegistry
         .HandlerVersion);
     ArrayHandler multidimensionalArrayHandler = new MultidimensionalArrayHandler(openTypeHandler
         , false);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler0), multidimensionalArrayHandler
         , 0);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler3), multidimensionalArrayHandler
         , 1);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler3), multidimensionalArrayHandler
         , 2);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler3), multidimensionalArrayHandler
         , 3);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler), multidimensionalArrayHandler
         , HandlerRegistry.HandlerVersion);
 }
		// FIXME: This code has not been called in any test case when the 
		//        new ArrayMarshaller was written.
		//        Apparently it only frees slots.
		//        For now the code simply returns without freeing.
		/// <param name="classPrimitive"></param>
		public void DeletePrimitiveEmbedded(StatefulBuffer buffer, PrimitiveTypeMetadata 
			classPrimitive)
		{
			buffer.ReadInt();
			//int address = a_bytes.readInt();
			buffer.ReadInt();
		}
Esempio n. 8
0
		private void Map(int id, PrimitiveTypeMetadata classMetadata, IReflectClass classReflector
			)
		{
			// TODO: remove when _mapIdToClassMetadata is gone 
			MapTypeInfo(id, classMetadata, classReflector);
			MapPrimitive(id, classMetadata, classReflector);
			if (id > _highestBuiltinTypeID)
			{
				_highestBuiltinTypeID = id;
			}
		}
Esempio n. 9
0
		private void RegisterBuiltinHandler(int id, IBuiltinTypeHandler typeHandler, bool
			 registerPrimitiveClass, string primitiveName, IGenericConverter converter)
		{
			typeHandler.RegisterReflector(_reflector);
			if (primitiveName == null)
			{
				primitiveName = typeHandler.ClassReflector().GetName();
			}
			if (registerPrimitiveClass)
			{
				_reflector.RegisterPrimitiveClass(id, primitiveName, converter);
			}
			IReflectClass classReflector = typeHandler.ClassReflector();
			PrimitiveTypeMetadata classMetadata = new PrimitiveTypeMetadata(Container(), typeHandler
				, id, classReflector);
			Map(id, classMetadata, classReflector);
			if (typeHandler is PrimitiveHandler)
			{
				IReflectClass primitiveClassReflector = ((PrimitiveHandler)typeHandler).PrimitiveClassReflector
					();
				if (primitiveClassReflector != null)
				{
					MapPrimitive(0, classMetadata, primitiveClassReflector);
				}
			}
		}
Esempio n. 10
0
		private void InitArrayHandlers()
		{
			ITypeHandler4 elementHandler = OpenTypeHandler();
			_untypedArrayMetadata = new PrimitiveTypeMetadata(Container(), new ArrayHandler(elementHandler
				, false), Handlers4.AnyArrayId, IclassObject);
			_openArrayHandler = _untypedArrayMetadata.TypeHandler();
			MapTypeInfo(Handlers4.AnyArrayId, _untypedArrayMetadata, null);
			_untypedMultiDimensionalMetadata = new PrimitiveTypeMetadata(Container(), new MultidimensionalArrayHandler
				(elementHandler, false), Handlers4.AnyArrayNId, IclassObject);
			_openMultiDimensionalArrayHandler = _untypedMultiDimensionalMetadata.TypeHandler(
				);
			MapTypeInfo(Handlers4.AnyArrayNId, _untypedMultiDimensionalMetadata, null);
		}