private ArgumentMapping DetermineReturnParamMapping(MethodInfo method, SerializerFactory serFactory) { ArgumentMapping returnMapping; // return value if (!method.ReturnType.Equals(ReflectionHelper.VoidType)) { AttributeExtCollection returnAttrs = ReflectionHelper.CollectReturnParameterAttributes(method); Serializer retMappingSer = serFactory.Create(method.ReturnType, returnAttrs); returnMapping = new ArgumentMapping(retMappingSer, ArgumentsKind.Return); } else { // no retrun value to serialise/deserialise returnMapping = new ArgumentMapping(); } return(returnMapping); }
private void DetermineMapping(Type forType, SerializerFactory serFactory) { MethodInfo[] methods = forType.GetMethods(BindingFlags.Public | BindingFlags.Instance); for (int i = 0; i < methods.Length; i++) { if (methods[i].IsSpecialName) { continue; } if (IgnoreMethod(methods[i])) { // don't support remote calls for method continue; } string operationName = DetermineOperationName(methods[i]); StoreMethodMappingFor(methods[i], operationName, serFactory); } PropertyInfo[] properties = forType.GetProperties(BindingFlags.Public | BindingFlags.Instance); for (int i = 0; i < properties.Length; i++) { if (IgnoreProperty(properties[i])) { // don't support remote calls for this property continue; } MethodInfo getter = properties[i].GetGetMethod(); MethodInfo setter = properties[i].GetSetMethod(); if (getter != null) { string operationName = IdlNaming.GetPropertyRequestOperationName(properties[i], false); StoreMethodMappingFor(getter, operationName, serFactory); } if (setter != null) { string operationName = IdlNaming.GetPropertyRequestOperationName(properties[i], true); StoreMethodMappingFor(setter, operationName, serFactory); } } }
private void StoreMethodMappingFor(MethodInfo info, string idlOperationName, SerializerFactory serFactory) { m_methodMappings[idlOperationName] = DetermineMethodMapping(info, serFactory); m_methodInfoForName[idlOperationName] = info; m_nameForMethodInfo[info] = idlOperationName; }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { base.WriteToStream(cdrStream, serFactory); CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(cdrStream); encap.WriteString(m_id); encap.WriteString(m_name); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); ser.Serialize(m_aliased, encap); encap.WriteToTargetStream(); }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { base.WriteToStream(cdrStream, serFactory); CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(cdrStream); encap.WriteString(m_id); encap.WriteString(m_name); encap.WriteToTargetStream(); }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { base.WriteToStream(cdrStream, serFactory); CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(cdrStream); encap.WriteString(m_id); encap.WriteString(m_name); encap.WriteShort(m_typeMod); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); // ser baseclass type ser.Serialize(m_baseClass, encap); // ser members encap.WriteULong((uint)m_members.Length); foreach (ValueMember member in m_members) { encap.WriteString(member.name); ser.Serialize(member.type, encap); encap.WriteShort(member.access); } encap.WriteToTargetStream(); }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { // write common part: typecode nr base.WriteToStream(cdrStream, serFactory); // complex type-code: in encapsulation CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(cdrStream); encap.WriteString(m_id); encap.WriteString(m_name); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); Type discrTypeCls = ((TypeCodeImpl)m_discriminatorType).GetClsForTypeCode(); ser.Serialize(m_discriminatorType, encap); encap.WriteLong(m_defaultCase); encap.WriteULong((uint)m_members.Length); Serializer serDisc = serFactory.Create(discrTypeCls, AttributeExtCollection.EmptyCollection); for (int i = 0; i < m_members.Length; i++) { serDisc.Serialize(m_members[i].DiscriminatorValue, encap); encap.WriteString(m_members[i].ElementName); ser.Serialize(m_members[i].ElementType, encap); } encap.WriteToTargetStream(); }
/// <summary>reads the type-code content from the stream, without the TCKind at the beginning</summary> /// <remarks>helper which is used by the constructor with arg CdrInputStream</remarks> internal virtual void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { }
public void Setup() { m_version = new GiopVersion(1, 2); m_hostName = "localhost"; m_port = 8089; m_objectKey = new byte[] { 65 }; m_profile = new InternetIiopProfile(m_version, m_hostName, m_port, m_objectKey); m_serFactory = new SerializerFactory(); CodecFactory codecFactory = new Ch.Elca.Iiop.Interception.CodecFactoryImpl(m_serFactory); m_codec = codecFactory.create_codec( new omg.org.IOP.Encoding(ENCODING_CDR_ENCAPS.ConstVal, 1, 2)); IiopUrlUtil iiopUrlUtil = IiopUrlUtil.Create(m_codec, new object[] { Services.CodeSetService.CreateDefaultCodesetComponent(m_codec)}); m_serFactory.Initalize(new SerializerFactoryConfig(), iiopUrlUtil); }
public void SetUp() { m_serFactory = new SerializerFactory(); CodecFactory codecFactory = new Ch.Elca.Iiop.Interception.CodecFactoryImpl(m_serFactory); m_codec = codecFactory.create_codec( new omg.org.IOP.Encoding(ENCODING_CDR_ENCAPS.ConstVal, 1, 2)); IiopUrlUtil iiopUrlUtil = IiopUrlUtil.Create(m_codec, new object[] { Services.CodeSetService.CreateDefaultCodesetComponent(m_codec)}); m_serFactory.Initalize(new SerializerFactoryConfig(), iiopUrlUtil); }
public void SetUp() { m_serFactory = new SerializerFactory(); CodecFactory codecFactory = new CodecFactoryImpl(m_serFactory); Codec codec = codecFactory.create_codec( new Encoding(ENCODING_CDR_ENCAPS.ConstVal, 1, 2)); m_serFactory.Initalize(new SerializerFactoryConfig(), IiopUrlUtil.Create(codec)); }
public DataInputStreamImpl(CdrInputStream cdrIn, SerializerFactory serFactory) { m_cdrIn = cdrIn; m_serFactory = serFactory; }
public DataOutputStreamImpl(CdrOutputStream cdrOut, SerializerFactory serFactory) { m_cdrOut = cdrOut; m_serFactory = serFactory; }
private ArgumentMapping DetermineReturnParamMapping(MethodInfo method, SerializerFactory serFactory) { ArgumentMapping returnMapping; // return value if (!method.ReturnType.Equals(ReflectionHelper.VoidType)) { AttributeExtCollection returnAttrs = ReflectionHelper.CollectReturnParameterAttributes(method); Serializer retMappingSer = serFactory.Create(method.ReturnType, returnAttrs); returnMapping = new ArgumentMapping(retMappingSer, ArgumentsKind.Return); } else { // no retrun value to serialise/deserialise returnMapping = new ArgumentMapping(); } return returnMapping; }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { m_length = (int)cdrStream.ReadULong(); }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { base.WriteToStream(cdrStream, serFactory); cdrStream.WriteULong((uint)m_length); }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { CdrEncapsulationInputStream encap = cdrStream.ReadEncapsulation(); m_id = ReadRepositoryId(encap); m_name = encap.ReadString(); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); m_discriminatorType = (omg.org.CORBA.TypeCode)ser.Deserialize(encap); Type discrTypeCls = ((TypeCodeImpl)m_discriminatorType).GetClsForTypeCode(); m_defaultCase = encap.ReadLong(); uint length = encap.ReadULong(); m_members = new UnionSwitchCase[length]; Serializer serDisc = serFactory.Create(discrTypeCls, AttributeExtCollection.EmptyCollection); for (int i = 0; i < length; i++) { object discrLabel = serDisc.Deserialize(encap); string memberName = encap.ReadString(); omg.org.CORBA.TypeCode memberType = (omg.org.CORBA.TypeCode)ser.Deserialize(encap); UnionSwitchCase member = new UnionSwitchCase(discrLabel, memberName, memberType); m_members[i] = member; } }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { CdrEncapsulationInputStream encap = cdrStream.ReadEncapsulation(); m_id = ReadRepositoryId(encap); m_name = encap.ReadString(); uint length = encap.ReadULong(); m_members = new string[length]; for (int i = 0; i < length; i++) { m_members[i] = encap.ReadString(); } }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { CdrEncapsulationInputStream encap = cdrStream.ReadEncapsulation(); m_id = ReadRepositoryId(encap); m_name = encap.ReadString(); m_typeMod = encap.ReadShort(); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); m_baseClass = (TypeCode)ser.Deserialize(encap); // deser members uint length = encap.ReadULong(); m_members = new ValueMember[length]; for (int i = 0; i < length; i++) { string memberName = encap.ReadString(); TypeCode memberType = (TypeCode)ser.Deserialize(encap); short visibility = encap.ReadShort(); ValueMember member = new ValueMember(memberName, memberType, visibility); m_members[i] = member; } }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { base.WriteToStream(cdrStream, serFactory); CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(cdrStream); encap.WriteString(m_id); encap.WriteString(m_name); encap.WriteULong((uint)m_members.Length); foreach (string member in m_members) { encap.WriteString(member); } encap.WriteToTargetStream(); }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { CdrEncapsulationInputStream encap = cdrStream.ReadEncapsulation(); m_id = ReadRepositoryId(encap); m_name = encap.ReadString(); }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { CdrEncapsulationInputStream encap = cdrStream.ReadEncapsulation(); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); m_innerDimension = (TypeCode)ser.Deserialize(encap); m_length = (int)encap.ReadULong(); }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { CdrEncapsulationInputStream encap = cdrStream.ReadEncapsulation(); m_id = ReadRepositoryId(encap); m_name = encap.ReadString(); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); m_aliased = (TypeCode)ser.Deserialize(encap); }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { base.WriteToStream(cdrStream, serFactory); CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(cdrStream); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); ser.Serialize(m_innerDimension, encap); encap.WriteULong((uint)m_length); encap.WriteToTargetStream(); }
private Serializer m_contextElementSer; // for performance reasons: expensive to create #endregion IFields #region IConstructors internal ArgumentsSerializer(Type forType, SerializerFactory serFactory) { m_contextElementSer = serFactory.Create(typeof(string[]), new AttributeExtCollection(new Attribute[] { new IdlSequenceAttribute(0L), new StringValueAttribute(), new WideCharAttribute(false) })); DetermineTypeMapping(forType, serFactory); }
/// <summary>serialize the whole type-code to the stream</summary> /// <param name="cdrStream"></param> internal virtual void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { uint val = Convert.ToUInt32(kind()); StreamPosition indirPos = cdrStream.WriteIndirectableInstanceTag(val); cdrStream.StoreIndirection(this, new IndirectionInfo(indirPos.GlobalPosition, IndirectionType.TypeCode, IndirectionUsage.TypeCode)); }
private void DetermineTypeMapping(Type forType, SerializerFactory serFactory) { DetermineMapping(forType, serFactory); // Lets also check implemented interfaces that might be explicitely implemented // making methods/properties invisible to previous research foreach (Type interfaceType in forType.GetInterfaces()) { DetermineMapping(interfaceType, serFactory); } }
internal override void ReadFromStream(CdrInputStream cdrStream, SerializerFactory serFactory) { CdrEncapsulationInputStream encap = cdrStream.ReadEncapsulation(); m_id = ReadRepositoryId(encap); m_name = encap.ReadString(); uint length = encap.ReadULong(); m_members = new StructMember[length]; TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); for (int i = 0; i < length; i++) { string memberName = encap.ReadString(); TypeCode memberType = (TypeCode)ser.Deserialize(encap); StructMember member = new StructMember(memberName, memberType); m_members[i] = member; } }
private ArgumentsMapping DetermineMethodMapping(MethodInfo method, SerializerFactory serFactory) { ArgumentMapping returnMapping = DetermineReturnParamMapping(method, serFactory); ArgumentMapping[] paramMappings = DetermineParamMappings(method, serFactory); string[] contextElementNames = DetermineContextElements(method); return new ArgumentsMapping(returnMapping, paramMappings, contextElementNames); }
internal override void WriteToStream(CdrOutputStream cdrStream, SerializerFactory serFactory) { base.WriteToStream(cdrStream, serFactory); CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(cdrStream); encap.WriteString(m_id); encap.WriteString(m_name); encap.WriteULong((uint)m_members.Length); TypeCodeSerializer ser = new TypeCodeSerializer(serFactory); foreach (StructMember member in m_members) { encap.WriteString(member.name); ser.Serialize(member.type, encap); } encap.WriteToTargetStream(); }
private ArgumentMapping[] DetermineParamMappings(MethodInfo method, SerializerFactory serFactory) { ParameterInfo[] parameters = method.GetParameters(); ArgumentMapping[] paramMappings = new ArgumentMapping[parameters.Length]; for (int actualParamNr = 0; actualParamNr < parameters.Length; actualParamNr++) { ParameterInfo paramInfo = parameters[actualParamNr]; // iterate through the parameters to determine mapping for each ArgumentsKind argKind = ArgumentsKind.Unknown; if (ReflectionHelper.IsInParam(paramInfo)) { argKind = ArgumentsKind.InArg; } else if (ReflectionHelper.IsOutParam(paramInfo)) { argKind = ArgumentsKind.OutArg; } else if (ReflectionHelper.IsRefParam(paramInfo)) { argKind = ArgumentsKind.RefArg; } AttributeExtCollection paramAttrs = ReflectionHelper.CollectParameterAttributes(paramInfo, method); Serializer paramSer = serFactory.Create(paramInfo.ParameterType, paramAttrs); paramMappings[actualParamNr] = new ArgumentMapping(paramSer, argKind); } return paramMappings; }
internal ArgumentsSerializerFactory(SerializerFactory serFactory) { m_serFactory = serFactory; }