1 26 27 package org.objectweb.ccm.IDL3; 28 29 37 38 public class StructMembersImpl 39 implements StructMembers 40 { 41 47 50 private org.objectweb.ccm.util.Vector member_names_; 51 52 55 private org.objectweb.ccm.util.Vector member_types_; 56 57 63 66 public 67 StructMembersImpl() 68 { 69 member_names_ = new org.objectweb.ccm.util.Vector(); 71 member_types_ = new org.objectweb.ccm.util.Vector(); 72 } 73 74 80 85 protected org.omg.CORBA.StructMember [] 86 getMemberDefs() 87 { 88 org.omg.CORBA.StructMember [] result = 89 new org.omg.CORBA.StructMember [member_names_.size()]; 90 91 for(int i=0; i<result.length; i++) 92 { 93 result[i] = new org.omg.CORBA.StructMember ( 94 (String )member_names_.get(i), 95 org.objectweb.openccm.corba.TypeCodeUtils.getTC_void(), 96 ((TypeRef)member_types_.get(i)).getIDLType()); 97 } 98 99 return result; 100 } 101 102 109 protected String 110 nameAt(int index) 111 { 112 return (String )member_names_.get(index); 113 } 114 115 118 protected void 119 destroy() 120 { 121 for (int i=0;i<member_types_.size();i++) 122 { 123 ((TypeRef)member_types_.get(i)).removeRef(); 124 } 125 } 126 127 133 139 public void 140 addMember(String name, 141 TypeRef type) 142 { 143 if(type != null) 144 { 145 member_names_.add(name); 146 type.addRef(); 147 member_types_.add(type); 148 } 149 } 150 151 154 public String [] 155 getMemberNames() 156 { 157 String [] result = new String [member_names_.size()]; 158 for (int i=0;i<result.length;i++) 159 { 160 result[i] = (String )member_names_.get(i); 161 } 162 return result; 163 } 164 165 168 public TypeRef[] 169 getMemberTypes() 170 { 171 TypeRef[] result = new TypeRef[member_types_.size()]; 172 for (int i=0;i<result.length;i++) 173 { 174 result[i] = (TypeRef)member_types_.get(i); 175 } 176 return result; 177 } 178 } 179 | Popular Tags |