コード例 #1
0
 public object MapToIdlAbstractValueType(Type clsType) {                       
     omg.org.CORBA.TypeCode baseTypeCode;
     if (clsType.BaseType.Equals(ReflectionHelper.ObjectType) || 
         clsType.BaseType.Equals(typeof(System.ComponentModel.MarshalByValueComponent))) {
         baseTypeCode = new NullTC();
     } else {
         baseTypeCode = CreateOrGetTypeCodeForType(clsType.BaseType, 
                            AttributeExtCollection.EmptyCollection);
     }
     ValueTypeTC result = new ValueTypeTC();            
     RegisterCreatedTypeCodeForType(clsType, AttributeExtCollection.EmptyCollection,
                                    result);
     result.Initalize(Repository.GetRepositoryID(clsType),
                      IdlNaming.ReverseIdlToClsNameMapping(clsType.Name), 
                      new ValueMember[0],
                      baseTypeCode, ABSTRACT_VALUE_MOD);
     return result;
 }
コード例 #2
0
 public object MapToIdlConcreateValueType(Type clsType) {
     omg.org.CORBA.TypeCode baseTypeCode;
     if (clsType.BaseType.Equals(ReflectionHelper.ObjectType) || 
         clsType.BaseType.Equals(typeof(System.ComponentModel.MarshalByValueComponent))) {
         baseTypeCode = new NullTC();
     } else {
         baseTypeCode = CreateOrGetTypeCodeForType(clsType.BaseType, 
                                                   AttributeExtCollection.EmptyCollection);
     }
     ValueTypeTC result = new ValueTypeTC();
     RegisterCreatedTypeCodeForType(clsType, AttributeExtCollection.EmptyCollection,
                                    result);                        
     
     // create the TypeCodes for the members
     FieldInfo[] members = ReflectionHelper.GetAllDeclaredInstanceFieldsOrdered(clsType);
     ValueMember[] valueMembers = new ValueMember[members.Length];
     for (int i = 0; i < members.Length; i++) {
         omg.org.CORBA.TypeCode memberType = CreateOrGetTypeCodeForType(members[i].FieldType, 
                                                 ReflectionHelper.GetCustomAttriutesForField(members[i], 
                                                                                             true));
         short visibility;
         if (members[i].IsPrivate) { 
             visibility = VISIBILITY_PRIVATE; 
         } else { 
             visibility = VISIBILITY_PUBLIC; 
         }
         valueMembers[i] = new ValueMember(members[i].Name, memberType, visibility);
     }
     result.Initalize(Repository.GetRepositoryID(clsType),
                      IdlNaming.ReverseIdlToClsNameMapping(clsType.Name),
                      valueMembers, baseTypeCode, CONCRETE_VALUE_MOD);
     return result;
 }