コード例 #1
0
ファイル: TypeCode.cs プロジェクト: JnS-Software-LLC/iiop-net
 public ExceptTC(string repositoryID, string name, StructMember[] members) : base(repositoryID, name, members, TCKind.tk_except) { }
コード例 #2
0
ファイル: TypeCode.cs プロジェクト: JnS-Software-LLC/iiop-net
 public void Initalize(string repositoryID, string name, StructMember[] members)
 {
     m_id = repositoryID;
     m_name = name;
     m_members = members;
     if (m_members == null) { m_members = new StructMember[0]; }
 }
コード例 #3
0
ファイル: TypeCode.cs プロジェクト: JnS-Software-LLC/iiop-net
 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;
     }
 }
コード例 #4
0
ファイル: TypeCode.cs プロジェクト: JnS-Software-LLC/iiop-net
 public BaseStructTC(string repositoryID, string name, StructMember[] members, TCKind kind)
     : base(kind)
 {
     Initalize(repositoryID, name, members);
 }
コード例 #5
0
 public object MapException(Type clsType) {
     // TODO: check this, generic user exception handling ...
     ExceptTC result = new ExceptTC();
     RegisterCreatedTypeCodeForType(clsType, AttributeExtCollection.EmptyCollection,
                                    result);
     
     FieldInfo[] members = ReflectionHelper.GetAllDeclaredInstanceFieldsOrdered(clsType);
     StructMember[] exMembers = new StructMember[members.Length];
     for (int i = 0; i < members.Length; i++) {                
         omg.org.CORBA.TypeCode memberType = CreateOrGetTypeCodeForType(members[i].FieldType,
                                                 ReflectionHelper.GetCustomAttriutesForField(members[i], 
                                                                                             true));
         exMembers[i] = new StructMember(members[i].Name, memberType);
     }
     result.Initalize(Repository.GetRepositoryID(clsType), 
                      IdlNaming.ReverseIdlToClsNameMapping(clsType.Name),
                      exMembers);
     return result;
 }
コード例 #6
0
 public object MapToIdlStruct(Type clsType) {
     lock(structTCs)
     {
         StructTC result = structTCs[clsType] as StructTC;
         if(result != null)
             return result;
     
         result = new StructTC();
         RegisterCreatedTypeCodeForType(clsType, AttributeExtCollection.EmptyCollection,
                                        result);
         
         FieldInfo[] members = ReflectionHelper.GetAllDeclaredInstanceFieldsOrdered(clsType);
         StructMember[] structMembers = new StructMember[members.Length];
         for (int i = 0; i < members.Length; i++) {                
             omg.org.CORBA.TypeCode memberType = 
                 CreateOrGetTypeCodeForType(members[i].FieldType,
                                            ReflectionHelper.GetCustomAttriutesForField(members[i], 
                                                                                        true));
             structMembers[i] = new StructMember(members[i].Name, memberType);
         }
         result.Initalize(Repository.GetRepositoryID(clsType), 
                          IdlNaming.ReverseIdlToClsNameMapping(clsType.Name),
                          structMembers);
         
         structTCs[clsType] = result;
         
         return result;
     }
 }
コード例 #7
0
        public void TestExceptTC()
        {
            string name = "OrbServices_TestException";
            string repId = "IDL:Ch/Elca/Iiop/Tests/" + name + ":1.0";

            StructMember m1 = new StructMember("M1", m_orb.create_long_tc());
            omg.org.CORBA.TypeCode tc =
                m_orb.create_exception_tc(repId, name,
                                       new StructMember[] { m1 });
            Assert.AreEqual(repId, tc.id(), "id");
            Assert.AreEqual(TCKind.tk_except, tc.kind(), "king");
            Assert.AreEqual(1, tc.member_count(), "nr of members");
            Assert.AreEqual(m1.name, tc.member_name(0), "member m1 name");
            Assert.AreEqual(m1.type.kind(), tc.member_type(0).kind(), "member m1 type");
        }
コード例 #8
0
 public void TestGenerate()
 {
     string name = "TestStructGenForTypeCodeType";
     string typeName = "Ch.Elca.Iiop.Tests." + name;
     string repId = "IDL:Ch/Elca/Iiop/Tests/TestStructGenForTypeCodeType:1.0";
     StructMember m1 = new StructMember("M1", new LongTC());
     StructTC tc = new StructTC(repId,
                                name, new StructMember[] {
                                m1 });
     Type res = m_gen.CreateOrGetType(typeName, tc);
     Assert.NotNull(res);
     Assert.AreEqual(typeName, res.FullName, "type name");
     Assert.AreEqual(repId, Repository.GetRepositoryID(res), "rep id");
     Assert.NotNull(res.GetField(m1.name,
                                          BindingFlags.Public | BindingFlags.Instance), "field M1");
     Assert.IsTrue(res.IsSerializable, "Serializable");
 }