1 26 27 package org.objectweb.ccm.IDL3; 28 29 37 38 public class ValueBoxDeclImpl 39 extends DeclarationImpl 40 implements TypeRef, ValueBoxDecl 41 { 42 48 51 private org.omg.CORBA.ValueBoxDef value_box_def_; 52 53 56 private TypeRef original_type_; 57 58 64 69 protected 70 ValueBoxDeclImpl(Repository rep, ScopeImpl parent) 71 { 72 super(rep, parent); 74 75 value_box_def_ = null; 77 original_type_ = null; 78 the_declaration_kind_ = DeclarationKind._dk_value_box; 79 } 80 81 87 92 protected void 93 load(org.omg.CORBA.Contained contained) 94 { 95 value_box_def_ = org.omg.CORBA.ValueBoxDefHelper.narrow(contained); 96 setType(getRepository().getAsTypeRef(value_box_def_.original_type_def())); 97 super.load(contained); 98 } 99 100 105 protected void 106 loadAsMapping(org.omg.CORBA.Contained contained) 107 { 108 value_box_def_ = org.omg.CORBA.ValueBoxDefHelper.narrow(contained); 109 setType(getRepository().getAsMappedTypeRef(value_box_def_.original_type_def())); 110 super.loadAsMapping(contained); 111 } 112 113 119 122 public void 123 create() 124 { 125 value_box_def_ = the_parent_.getContainer().create_value_box(getId(), 126 getName(), 127 getVersion(), 128 original_type_.getIDLType()); 129 130 super.create(); 131 } 132 133 140 public Declaration[] 141 getDependencies() 142 { 143 if (dependencies_!=null) 144 return dependencies_; 145 146 org.objectweb.ccm.util.Vector vbox_depend = new org.objectweb.ccm.util.Vector(); 147 148 if (getType().isDeclaration()) 150 vbox_depend.add(getType()); 151 152 Declaration[] depend = getType().getDependencies(); 153 for (int i=0;i<depend.length;i++) 154 vbox_depend.add(depend[i]); 155 156 157 dependencies_ = (Declaration[])vbox_depend.toArray(new Declaration[0]); 158 return dependencies_; 159 } 160 161 167 172 public org.omg.CORBA.IDLType 173 getIDLType() 174 { 175 return value_box_def_; 176 } 177 178 181 public int 182 getTypeKind() 183 { 184 return TypeKind._tk_value_box; 185 } 186 187 193 198 public void 199 setType(TypeRef type) 200 { 201 if (type != null) 202 { 203 original_type_ = type; 204 original_type_.addRef(); 205 } 206 } 207 208 211 public TypeRef 212 getType() 213 { 214 return original_type_; 215 } 216 217 223 226 public void 227 destroy() 228 { 229 if (original_type_!=null) 230 original_type_.removeRef(); 231 232 super.destroy(); 233 } 234 235 241 protected org.omg.CORBA.Contained 242 getContained() 243 { 244 return value_box_def_; 245 } 246 } 247 | Popular Tags |