Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / org / omg / CORBA / DynAny.java
blob42b933419712edcc6a5ca5dcf170c351badfc372
1 /* DynAny.java --
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package org.omg.CORBA;
41 import org.omg.CORBA.DynAnyPackage.Invalid;
42 import org.omg.CORBA.DynAnyPackage.InvalidValue;
43 import org.omg.CORBA.DynAnyPackage.TypeMismatch;
45 import java.io.Serializable;
47 /**
48 * The DynAny interface provides possibility to access the components of
49 * the CORBA object, stored inside the {@link Any}. The {@link Any} itself
50 * allows to read, write and pass as parameter the stored value without
51 * knowning its exact data type. The DynAny and derived classes additionally
52 * allows to access the members of the sequence, structure, union and get the
53 * data about enumeration, value type and CORBA <code>fixed</code> without
54 * knowing the exact type at the run time. The returned members are also
55 * wrapped into DynAny objects, allowing them to be the nested structures.
57 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
59 public interface DynAny
60 extends org.omg.CORBA.Object
62 /**
63 * Copy one DynAny into another.
65 * @param from the DynAny to copy from.
66 * @throws Invalid if the source DynAny is invalid.
68 void assign(DynAny from)
69 throws Invalid;
71 /**
72 * Clones this DynAny.
74 DynAny copy();
76 /**
77 * Returns the focused component of this DynAny. The DynAny has the internal
78 * pointer (reference) that can point to one of its components. The returned
79 * DynAny can be used to get or set the value of the focused component.
80 * If the DynAny holds a primitive type with no components, this
81 * implementation returns <code>this</code>.
83 DynAny current_component();
85 /**
86 * Destroys this DynAny, freeing the used resources. In java, resources
87 * are freed by the garbage collectors, so this method typically returns
88 * without action.
90 void destroy();
92 /**
93 * Makes a DynAny from the {@link Any}. The passed {@link Any} becomes the
94 * enclosed instance of this DynAny, allowing to change/traverse the
95 * {@link Any} fields by the {@link DynAny} methods.
97 void from_any(Any an_any)
98 throws Invalid;
101 * Retrieves the {@link Any}, stored inside this DynAny.
103 * @throws TypeMismatch if the typecode of the accessed Any
104 * is not the same as the typecode of this DynAny.
106 Any get_any()
107 throws TypeMismatch;
110 * Extract the boolean value that is expected to be
111 * stored in this DynAny.
113 * @throws TypeMismatch if this DynAny holds the value of the
114 * different type.
116 boolean get_boolean()
117 throws TypeMismatch;
120 * Extract the char value that is expected to be
121 * stored in this DynAny.
123 * @throws TypeMismatch if this DynAny holds the value of the
124 * different type.
126 char get_char()
127 throws TypeMismatch;
130 * Extract the <code>double</code> value that is expected to be
131 * stored in this DynAny.
133 * @throws TypeMismatch if this DynAny holds the value of the
134 * different type.
136 double get_double()
137 throws TypeMismatch;
140 * Extract the <code>float</code> value that is expected to be
141 * stored in this DynAny.
143 * @throws TypeMismatch if this DynAny holds the value of the
144 * different type.
146 float get_float()
147 throws TypeMismatch;
150 * Extract the int (CORBA long) value that is expected to be
151 * stored in this DynAny.
153 * @throws TypeMismatch if this DynAny holds the value of the
154 * different type.
156 int get_long()
157 throws TypeMismatch;
160 * Extract the long (CORBA long long) value that is expected to be
161 * stored in this DynAny.
163 * @throws TypeMismatch if this DynAny holds the value of the
164 * different type.
166 long get_longlong()
167 throws TypeMismatch;
170 * Extract the byte (CORBA octet) value that is expected to be
171 * stored in this DynAny.
173 * @throws TypeMismatch if this DynAny holds the value of the
174 * different type.
176 byte get_octet()
177 throws TypeMismatch;
180 * Extract the CORBA object reference that is expected to be
181 * stored in this DynAny.
183 * @throws TypeMismatch if this DynAny holds the value of the
184 * different type.
186 Object get_reference()
187 throws TypeMismatch;
190 * Extract the <code>short</code> value that is expected to be
191 * stored in this DynAny.
193 * @throws TypeMismatch if this DynAny holds the value of the
194 * different type.
196 short get_short()
197 throws TypeMismatch;
200 * Extract the string value that is expected to be
201 * stored in this DynAny.
203 * @throws TypeMismatch if this DynAny holds the value of the
204 * different type.
206 String get_string()
207 throws TypeMismatch;
210 * Extract the {@link TypeCode} value that is expected to be
211 * stored in this DynAny.
213 * @throws TypeMismatch if this DynAny holds the value of the
214 * different type.
216 TypeCode get_typecode()
217 throws TypeMismatch;
220 * Extract the unsigned int (CORBA ulong) value that is expected to be
221 * stored in this DynAny.
223 * @throws TypeMismatch if this DynAny holds the value of the
224 * different type.
226 int get_ulong()
227 throws TypeMismatch;
230 * Extract the unsingel long (CORBA unsigned long long )value that
231 * is expected to be stored in this DynAny.
233 * @throws TypeMismatch if this DynAny holds the value of the
234 * different type.
236 long get_ulonglong()
237 throws TypeMismatch;
240 * Extract the unsigned short value that is expected to be
241 * stored in this DynAny.
243 * @throws TypeMismatch if this DynAny holds the value of the
244 * different type.
246 short get_ushort()
247 throws TypeMismatch;
250 * Extract the value that is expected to be
251 * stored in this DynAny.
253 * @throws TypeMismatch if this DynAny holds the value of the
254 * different type.
256 Serializable get_val()
257 throws TypeMismatch;
260 * Extract the wide (usually UTF-16) character value that is expected to be
261 * stored in this DynAny.
263 * @throws TypeMismatch if this DynAny holds the value of the
264 * different type.
266 char get_wchar()
267 throws TypeMismatch;
270 * Extract the wide (usually UFT-16) string that is expected to be
271 * stored in this DynAny.
273 * @throws TypeMismatch if this DynAny holds the value of the
274 * different type.
276 String get_wstring()
277 throws TypeMismatch;
280 * Insert the {@link Any} value into the enclosed
281 * {@link Any} inside this DynAny.
283 * @param a_x the value being inserted.
284 * @throws InvalidValue if the value type does not match the
285 * typecode of the enclosed {@link Any}.
287 void insert_any(Any an_any)
288 throws InvalidValue;
291 * Insert the boolean value into the enclosed
292 * {@link Any} inside this DynAny
293 * @param a_x the value being inserted.
294 * @throws InvalidValue if the value type does not match the
295 * typecode of the enclosed {@link Any}.
297 void insert_boolean(boolean a_x)
298 throws InvalidValue;
301 * Insert the char value into the enclosed
302 * {@link Any} inside this DynAny
303 * @param a_x the value being inserted.
304 * @throws InvalidValue if the value type does not match the
305 * typecode of the enclosed {@link Any}.
307 void insert_char(char a_x)
308 throws InvalidValue;
311 * Insert the double value into the enclosed
312 * {@link Any} inside this DynAny
313 * @param a_x the value being inserted.
314 * @throws InvalidValue if the value type does not match the
315 * typecode of the enclosed {@link Any}.
317 void insert_double(double a_x)
318 throws InvalidValue;
321 * Insert the float value into the enclosed
322 * {@link Any} inside this DynAny
323 * @param a_x the value being inserted.
324 * @throws InvalidValue if the value type does not match the
325 * typecode of the enclosed {@link Any}.
327 void insert_float(float a_x)
328 throws InvalidValue;
331 * Insert the int (CORBA long) value into the enclosed
332 * {@link Any} inside this DynAny
333 * @param a_x the value being inserted.
334 * @throws InvalidValue if the value type does not match the
335 * typecode of the enclosed {@link Any}.
337 void insert_long(int a_x)
338 throws InvalidValue;
341 * Insert the long (CORBA long long) value into the enclosed
342 * {@link Any} inside this DynAny
343 * @param a_x the value being inserted.
344 * @throws InvalidValue if the value type does not match the
345 * typecode of the enclosed {@link Any}.
347 void insert_longlong(long a_x)
348 throws InvalidValue;
351 * Insert the byte (CORBA octet) value into the enclosed
352 * {@link Any} inside this DynAny
353 * @param a_x the value being inserted.
354 * @throws InvalidValue if the value type does not match the
355 * typecode of the enclosed {@link Any}.
357 void insert_octet(byte a_x)
358 throws InvalidValue;
361 * Insert the object reference into the enclosed
362 * {@link Any} inside this DynAny
363 * @param a_x the value being inserted.
364 * @throws InvalidValue if the value type does not match the
365 * typecode of the enclosed {@link Any}.
367 void insert_reference(Object a_x)
368 throws InvalidValue;
371 * Insert the <code>short</code> value into the enclosed
372 * {@link Any} inside this DynAny
373 * @param a_x the value being inserted.
374 * @throws InvalidValue if the value type does not match the
375 * typecode of the enclosed {@link Any}.
377 void insert_short(short a_x)
378 throws InvalidValue;
381 * Insert the string value into the enclosed
382 * {@link Any} inside this DynAny
383 * @param a_x the value being inserted.
384 * @throws InvalidValue if the value type does not match the
385 * typecode of the enclosed {@link Any}.
387 void insert_string(String a_x)
388 throws InvalidValue;
391 * Insert the {@link TypeCode} value into the enclosed
392 * {@link Any} inside this DynAny
393 * @param a_x the value being inserted.
394 * @throws InvalidValue if the value type does not match the
395 * typecode of the enclosed {@link Any}.
397 void insert_typecode(TypeCode a_x)
398 throws InvalidValue;
401 * Insert the int (CORBA unsinged long) value into the enclosed
402 * {@link Any} inside this DynAny
403 * @param a_x the value being inserted.
404 * @throws InvalidValue if the value type does not match the
405 * typecode of the enclosed {@link Any}.
407 void insert_ulong(int a_x)
408 throws InvalidValue;
411 * Insert the long (CORBA unsigned long long) value into the enclosed
412 * {@link Any} inside this DynAny
413 * @param a_x the value being inserted.
414 * @throws InvalidValue if the value type does not match the
415 * typecode of the enclosed {@link Any}.
417 void insert_ulonglong(long a_x)
418 throws InvalidValue;
421 * Insert the short (CORBA unsigned short) value into the enclosed
422 * {@link Any} inside this DynAny
423 * @param a_x the value being inserted.
424 * @throws InvalidValue if the value type does not match the
425 * typecode of the enclosed {@link Any}.
427 void insert_ushort(short a_x)
428 throws InvalidValue;
431 * Insert the value into the enclosed
432 * {@link Any} inside this DynAny
433 * @param a_x the value being inserted.
434 * @throws InvalidValue if the value type does not match the
435 * typecode of the enclosed {@link Any}.
437 void insert_val(Serializable a_x)
438 throws InvalidValue;
441 * Insert the wide char (usually UTF-16) value into the enclosed
442 * {@link Any} inside this DynAny
443 * @param a_x the value being inserted.
444 * @throws InvalidValue if the value type does not match the
445 * typecode of the enclosed {@link Any}.
447 void insert_wchar(char a_x)
448 throws InvalidValue;
451 * Insert the wide string (usually UTF-16) into the enclosed
452 * {@link Any} inside this DynAny
453 * @param a_x the value being inserted.
454 * @throws InvalidValue if the value type does not match the
455 * typecode of the enclosed {@link Any}.
457 void insert_wstring(String a_x)
458 throws InvalidValue;
461 * Advances the internal pointer, described in the {@link current_component},
462 * one position forward.
464 * @return true if the pointer now points to the new component,
465 * false if there are no more components of this DynAny holds
466 * a basic type that is not divided into components.
468 boolean next();
471 * Moves the internal pointer, described in the {@link current_component},
472 * to the first component.
474 void rewind();
477 * Moves the internal pointer, described in the {@link current_component},
478 * to the given position.
480 * @param p the number of the internal component on that the internal
481 * pointer must be focused.
483 * @return true on success or false if there is no component with the
484 * given number. If the DynAny holds the basic type, this method returs
485 * false p values other than 0.
487 boolean seek(int p);
490 * Returns the enclosed {@link Any}.
492 * @return the enclosed {@link Any}.
494 Any to_any()
495 throws Invalid;
498 * Returns the typecode of the object, inserted into this
499 * DynAny.
501 * @return the typecode of the inserted {@link Any} or null typecode
502 * if no {@link Any has been yet inserted}.
504 TypeCode type();