aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ic/java_src/com/ericsson/otp/ic/TypeCode.java
blob: da036fea54541c0bb08783c52d165e9be2fabf3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
/*
 * %CopyrightBegin%
 * 
 * Copyright Ericsson AB 1999-2016. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * %CopyrightEnd%
 *
 */
/**
 * The TypeCode class for Java IDL
 *
 */
package com.ericsson.otp.ic;

/**
  The TypeCode class is the implementation of the OMG-IDL TypeCode type.
  **/

public class TypeCode {

  private TCKind _kind;
  private java.lang.String _id,_name;
  private int _length,_member_count,_default_index;
  private TypeCode _member_type,_discriminator_type,_content_type;
  private Any _member_label;
  private boolean extracted;
  private TypeCode _members[];
  private java.lang.String _member_names[];
  private Any _member_labels[];
  


  /*
   * Constructors
   */
  public TypeCode() {
    extracted = false;
    _members = null;
    _member_names = null;
    _member_labels = null;
    _kind = null;
    _id = null;
    _name = null;
    _length = -1;
    _member_count = -1;
    _default_index = -1;
    _member_type = null;
    _content_type = null;
    _discriminator_type = null;
    _member_label = null;
  }

  public TypeCode(TCKind __kind) {
    _kind = __kind;
  }


  /*
   * Operation "TypeCode::equal" 
   */

  /**
    Comparisson method for TypeCode.
    @return true if the input TypeCode value equals the value of the current object, false otherwize
    **/
  public boolean equal(TypeCode tc) {

    try {
      
      TCKind tck = tc.kind();
      
      switch (tck.value()) {
	
      case TCKind._tk_short:
      case TCKind._tk_long:
      case TCKind._tk_longlong:
      case TCKind._tk_ushort:
      case TCKind._tk_ulong:
      case TCKind._tk_ulonglong:
      case TCKind._tk_float:
      case TCKind._tk_double:
      case TCKind._tk_boolean:
      case TCKind._tk_char:
      case TCKind._tk_wchar:
      case TCKind._tk_octet:
      case TCKind._tk_string:
      case TCKind._tk_wstring:
      case TCKind._tk_any:
      case TCKind._tk_void:
      case TCKind._tk_atom:
	
	return (tck.value() == _kind.value());
	
      case TCKind._tk_struct:
	
	if((tc.id().compareTo(_id) == 0) &&
	   (tc.name().compareTo(_name) == 0) &&
	   (tc.member_count() == _member_count)){
	  
	  for (int i = 0; i < _member_count; i++)
	    if (!tc.member_type(i).equal(_members[i]))
	      return false;

	  return true;
	}
	else
	  return false;
      
      case TCKind._tk_union:
	
	if((tc.id().compareTo(_id) == 0) &&
	   (tc.name().compareTo(_name) == 0) &&
	   (tc.member_count() == _member_count) &&
	   (tc.discriminator_type().equal(_discriminator_type))){
	  
	  for (int i = 0; i < _member_count; i++)
	    if ((!tc.member_type(i).equal(_members[i])) &&
		(tc.member_name(i).compareTo(_member_names[i]) != 0))
	      return false;
	  
	  return true;
	}
	else
	  return false; 

      case TCKind._tk_sequence:
      case TCKind._tk_array:
	
	if((tck.value() == _kind.value()) &&
	   (tc.content_type().equal(_content_type)))
	  return true;
	else
	  return false;

      case TCKind._tk_enum:
	if((tck.value() == _kind.value()) &&
	   (tc.member_count() == _member_count)) {
	  
	  for (int i = 0; i < _member_count; i++)
	    if (tc.member_name(i).compareTo(_member_names[i]) != 0)
	      return false;
	  
	  return true;
	}
	else
	  return false;
	
	// Not used in real
      case TCKind._tk_null:
      case TCKind._tk_TypeCode:
      case TCKind._tk_Principal:
      case TCKind._tk_objref:
      case TCKind._tk_alias:
      case TCKind._tk_except:
      case TCKind._tk_longdouble:
      case TCKind._tk_fixed:

	return (tck.value() == _kind.value());
	
      default :
	return false;
	
      }
    } catch (Exception e) {
      return false;
    }
      
  }
  
  
  /*
   * Operation "TypeCode::kind" 
   */
  
  /**
    Accessor method for the TCKind value of TypeCode.
    @return TCKind, the TCKind value of the TypeCode object.
    **/
  public TCKind kind() {
    return _kind;
  }

  /**
    Insertion method for the TCKind value of TypeCode.
    Sets the TCKind value of the object.
    **/
  public void kind(TCKind __kind) {
    _kind = __kind;
  }

  /**
    Insertion method for the TCKind value of TypeCode.
    Sets the TCKind value of the object.
    **/
  public static TCKind kind(java.lang.String atom) 
    throws java.lang.Exception {
    
    if (atom.equals("tk_null"))
      return TCKind.tk_null;     
    else
      if (atom.equals("tk_void"))
	return TCKind.tk_void;     
    else
      if (atom.equals("tk_short"))
	return TCKind.tk_short;     
    else
      if (atom.equals("tk_long"))
	return TCKind.tk_long;     
    else
      if (atom.equals("tk_ushort"))
	return TCKind.tk_ushort;     
    else
      if (atom.equals("tk_ulong"))
	return TCKind.tk_ulong;     
    else 
      if (atom.equals("tk_float"))
	return TCKind.tk_float;     
    else
      if (atom.equals("tk_double"))
	return TCKind.tk_double;     
    else
      if (atom.equals("tk_boolean"))
	return TCKind.tk_boolean;     
    else
      if (atom.equals("tk_char"))
	return TCKind.tk_char;     
    else
      if (atom.equals("tk_octet"))
	return TCKind.tk_octet;     
    else
      if (atom.equals("tk_any"))
	return TCKind.tk_any;     
    else
      if (atom.equals("tk_TypeCode"))
	return TCKind.tk_TypeCode;     
    else
      if (atom.equals("tk_Principal"))
	return TCKind.tk_Principal;     
    else
      if (atom.equals("tk_objref"))
	return TCKind.tk_objref;     
    else
      if (atom.equals("tk_struct"))
	return TCKind.tk_struct;     
    else
      if (atom.equals("tk_union"))
	return TCKind.tk_union;     
    else
      if (atom.equals("tk_enum"))
	return TCKind.tk_enum;     
    else
      if (atom.equals("tk_string"))
	return TCKind.tk_string;     
    else
      if (atom.equals("tk_sequence"))
	return TCKind.tk_sequence;     
    else
      if (atom.equals("tk_array"))
	return TCKind.tk_array;     
    else
      if (atom.equals("tk_alias"))
	return TCKind.tk_alias;     
    else
      if (atom.equals("tk_except"))
	return TCKind.tk_except;     
    else
      if (atom.equals("tk_longlong"))
	return TCKind.tk_longlong;     
    else
      if (atom.equals("tk_ulonglong"))
	return TCKind.tk_ulonglong;   
    else
      if (atom.equals("tk_longdouble"))
	return TCKind.tk_longdouble;     
    else
      if (atom.equals("tk_wchar"))
	return TCKind.tk_wchar;
    else
      if (atom.equals("tk_wstring"))
	return TCKind.tk_wstring;     
    else
      if (atom.equals("tk_fixed"))
	return TCKind.tk_fixed;
    else
      if (atom.equals("tk_atom"))
	return TCKind.tk_atom;    
    else
      throw new java.lang.Exception("BAD KIND");
  
  }
  
  
  
  /*
   * Operation "TypeCode::id" 
   */

  /**
    Accessor method for the id value of TypeCode.
    @return String, the id value of TypeCode object
    **/
  public java.lang.String id()
    throws java.lang.Exception{
      
      if (_id == null) 
	throw new java.lang.Exception("BAD KIND");

      return _id;
  }


  /**
    Insertion method for the id value of TypeCode.
    Sets the id value of the object.
    **/
  public void id(java.lang.String __id) {
      
      _id = __id;
  }
  

  
  /*
   * Operation "TypeCode::name" 
   */

  /**
    Accessor method for the name value of TypeCode.
    @return String, the name value of TypeCode object
    **/
  public java.lang.String name()
    throws java.lang.Exception{
      
      if (_name == null) 
	throw new java.lang.Exception("BAD KIND");
      
      return _name;
  }
  
  /**
    Insertion method for the name value of TypeCode.
    Sets the name value of the object.
    **/
  public void name(java.lang.String __name) {
      _name = __name;
  }


  
  /*
   * Operation "TypeCode::member_count" 
   */
  
  /**
    Accessor method for the member number value of TypeCode.
    @return int, the number of members of TypeCode object
    **/
  public int member_count()
    throws java.lang.Exception{
      
      if (_member_count == -1) 
	throw new java.lang.Exception("BAD KIND");
      
      return _member_count;
  }

  /**
    Insertion method for the member number value of TypeCode.
    Sets the number of members value of the object.
    **/
  public void member_count(int __member_count) {

    switch(_kind.value()) {
    case TCKind._tk_struct:
      _members = new TypeCode[__member_count];
      _member_names = new java.lang.String[__member_count];
      _member_count = __member_count;
      break;
    case TCKind._tk_union:
      _members = new TypeCode[__member_count];
      _member_names = new java.lang.String[__member_count];
      _member_labels = new Any[__member_count];
      _member_count = __member_count;
      break;
    case TCKind._tk_enum:
      _member_names = new java.lang.String[__member_count];
      _member_count = __member_count;
      break;
    default :
      // Do nothing
    }
  }

  
  /*
   * Operation "TypeCode::member_name" 
   */
  
  /**
    Member name accessor method for TypeCode.
    @return String, the name value of the member of the TypeCode object
    on the selected index
    **/
  public java.lang.String member_name(int __index)
    throws java.lang.Exception{
      
      return _member_names[__index];
  }
  
  /**
    Insertion method for the indexed member name of TypeCode.
    Sets the name of a member value of the object at the selected index..
    **/
  public void member_name(int __index, java.lang.String __member_name) {
    _member_names[__index] = __member_name;
  }

  
  /*
   * Operation "TypeCode::member_type" 
   */
  
  /**
    Member type accessor method for TypeCode.
    @return TypeCOde, the type of the member of the TypeCode object
    on the selected index
    **/
  public TypeCode member_type(int __index)
    throws java.lang.Exception{
      
      return _members[__index];
  }

  /**
    Insertion method for the indexed member type of TypeCode.
    Sets the type of a member value of the object at the selected index..
    **/
  public void member_type(int __index, TypeCode __member_type) {
    _members[__index] = __member_type;
  }
  
  
  /*
   * Operation "TypeCode::member_label" 
   */

  /**
    Member label accessor method for TypeCode.
    @return Any, the label of the member of the TypeCode object
    on the selected index
    **/
  public Any member_label(int __index)
    throws java.lang.Exception{
      
      return _member_labels[__index];
  }
  
  /**
    Insertion method for the indexed member label of TypeCode.
    Sets the label of a member value of the object at the selected index.
    **/
  public void member_label(int __index, Any __member_label) {
    _member_labels[__index] = __member_label;
  }


  /*
   * Operation "TypeCode::discriminator_type" 
   */
  
  /**
    Discriminator type accessor method for TypeCode.
    @return TypeCode, the type of the discriminator of the TypeCode object
    **/
  public TypeCode discriminator_type()
    throws java.lang.Exception{
      
      if (_discriminator_type == null)
	throw new java.lang.Exception("BAD KIND");
      
      return _discriminator_type;
  }

  /**
    Insertion method for the type of the discriminator value of TypeCode.
    Sets the discriminator type value of the object.
    **/
  public void discriminator_type(TypeCode __discriminator_type) {
    _discriminator_type = __discriminator_type;
  }
  
  
  /*
   * Operation "TypeCode::default_index" 
   */

  /**
    Index accessor method for TypeCode.
    @return int, the default index value of the member of the TypeCode object
    **/
  public int default_index()
    throws java.lang.Exception{
      
      if (_default_index == -1)
	throw new java.lang.Exception("BAD KIND");
      
      return _default_index;
  }

  /**
    Insertion method for the default index value of TypeCode.
    Sets the default index value of the object.
    **/
  public void default_index(int __default_index) {
    _default_index = __default_index;
  }
  
  
  /*
   * Operation "TypeCode::length" 
   */

  /**
    Length accessor method for TypeCode.
    @return int, the length of the TypeCode object
    **/
  public int length()
    throws java.lang.Exception{
      
      if (_length == -1)
	throw new java.lang.Exception("BAD KIND");
      
      return _length;
  }
  
  /**
    Insertion method for the length value of TypeCode.
    Sets the length value of the object.
    **/
  public void length(int __length) {
    _length = __length;
  }

  
  /*
   * Operation "TypeCode::content_type" 
   */
  
  /**
    Content type accessor method for TypeCode.
    @return TypeCode, the content type of the TypeCode object
    **/
  public TypeCode content_type()
    throws java.lang.Exception {
      
      if (_content_type == null)
	throw new java.lang.Exception("BAD KIND");
      
      return _content_type;
  }

  /**
    Insertion method for the content type value of TypeCode.
    Sets the content type value of the object.
    **/
  public void content_type(TypeCode __content_type) {
    _content_type = __content_type;
  }


  /**
    Marshal operation for TypeCode. 
    **/
  public static void marshal(com.ericsson.otp.erlang.OtpOutputStream _os, TypeCode _tc) 
    throws java.lang.Exception {

      TypeCode memberTC = null;
      int len = -1;
			       
      switch(_tc.kind().value()) {

      case TCKind._tk_short :
	_os.write_atom("tk_short");
	break;
      case TCKind._tk_ushort : 
	_os.write_atom("tk_ushort");
	break;
      case TCKind._tk_long :
	_os.write_atom("tk_long");
	break;
      case TCKind._tk_longlong :
	_os.write_atom("tk_longlong");
	break;
      case TCKind._tk_ulong :
	_os.write_atom("tk_ulong");
	break;
      case TCKind._tk_ulonglong :
	_os.write_atom("tk_ulonglong");
	break;
      case TCKind._tk_float :
	_os.write_atom("tk_float");
	break;
      case TCKind._tk_double :
	_os.write_atom("tk_double");
	break;
      case TCKind._tk_boolean : 
	_os.write_atom("tk_boolean");
	break;
      case TCKind._tk_char : 
	_os.write_atom("tk_char");
	break;
      case TCKind._tk_wchar : 
	_os.write_atom("tk_wchar");
	break;
      case TCKind._tk_octet :
	_os.write_atom("tk_octet");
	break;
      case TCKind._tk_string :
	_os.write_tuple_head(2);
	_os.write_atom("tk_string");
	_os.write_ulong(_tc.length());
	break;
      case TCKind._tk_wstring :
	_os.write_tuple_head(2);
	_os.write_atom("tk_wstring");
	_os.write_ulong(_tc.length());
	break;
      case TCKind._tk_struct:	
	len = _tc.member_count();
	_os.write_tuple_head(4);
	_os.write_atom("tk_struct");
	_os.write_string(_tc.id());
	_os.write_string(_tc.name());	
	// Member list
	_os.write_list_head(len);
	for(int i=0; i<len; i++) {
	  _os.write_tuple_head(2);
	  _os.write_string(_tc.member_name(i));
	  marshal(_os,_tc.member_type(i));
	}
	_os.write_nil();
	break;
      case TCKind._tk_union:
	len = _tc.member_count();
	_os.write_tuple_head(6);
	_os.write_atom("tk_union");
	_os.write_string(_tc.id());
	_os.write_string(_tc.name());
	marshal(_os,_tc.discriminator_type());
	_os.write_int(_tc.default_index());
	// Member list
	_os.write_list_head(len);
	for(int i=0; i<len; i++) {
	  _os.write_tuple_head(3);
	  _tc.member_label(i).write_value(_os);
	  _os.write_string(_tc.member_name(i));
	  marshal(_os,_tc.member_type(i));
	}
	_os.write_nil();
	break;
      case TCKind._tk_sequence:
	_os.write_tuple_head(3);
	_os.write_atom("tk_sequence");
	marshal(_os,_tc.content_type());
	_os.write_int(_tc.length());
	break;
      case TCKind._tk_array:
	_os.write_tuple_head(3);
	_os.write_atom("tk_array");
	marshal(_os,_tc.content_type());
	_os.write_int(_tc.length());
	break;
      case TCKind._tk_enum:
	len = _tc.member_count();
	_os.write_tuple_head(4);
	_os.write_atom("tk_enum");
	_os.write_string(_tc.id());
	_os.write_string(_tc.name());
	_os.write_list_head(len);
	for(int i=0; i<len; i++)
	  _os.write_string(_tc.member_name(i));
	_os.write_nil();
	break;
      case TCKind._tk_any:
	_os.write_atom("tk_any");
	break;
      case TCKind._tk_void : 
	_os.write_atom("tk_void");
	break;
	/*
	 * Not supported types
	 */
      default :
	throw new java.lang.Exception("Unsupported type");
	
      }
			   	       
  }


  /**
    Unmarshal operation for TypeCode.
    @return TypeCode, the TypeCode read from the input stream.
   **/
  public static TypeCode unmarshal(com.ericsson.otp.erlang.OtpInputStream _is)
    throws java.lang.Exception {
      
      TypeCode _tc, __member;
      TCKind __kind;
      int __len;
      int __tag = _is.peek();
      
      switch(__tag) {
      case (com.ericsson.otp.erlang.OtpExternal.atomTag):
      case (com.ericsson.otp.erlang.OtpExternal.atomUtf8Tag):
      case (com.ericsson.otp.erlang.OtpExternal.smallAtomUtf8Tag):
	__kind = TypeCode.kind(_is.read_atom());
	
	switch(__kind.value()) {
	case TCKind._tk_short :
	case TCKind._tk_ushort : 
	case TCKind._tk_long :
	case TCKind._tk_longlong :
	case TCKind._tk_ulong :
	case TCKind._tk_ulonglong :
	case TCKind._tk_float :
	case TCKind._tk_double :
	case TCKind._tk_boolean :
	case TCKind._tk_char : 
	case TCKind._tk_wchar : 
	case TCKind._tk_octet :
	case TCKind._tk_void : 
	case TCKind._tk_any : 
	  _tc = new TypeCode();
	  _tc.kind(__kind);
	  
	  return _tc;
	default :
	  throw new java.lang.Exception("Unsupported type");
	}
	
      case (com.ericsson.otp.erlang.OtpExternal.smallTupleTag):
      case (com.ericsson.otp.erlang.OtpExternal.largeTupleTag):
	
	__len = _is.read_tuple_head();
	__tag = _is.peek();
	
	switch(__tag) {

	case (com.ericsson.otp.erlang.OtpExternal.atomTag):
	case (com.ericsson.otp.erlang.OtpExternal.atomUtf8Tag):
	case (com.ericsson.otp.erlang.OtpExternal.smallAtomUtf8Tag):
	  
	  __kind = TypeCode.kind(_is.read_atom());
	  _tc = new TypeCode();
	  _tc.kind(__kind);
	  
	  switch(__kind.value()) {
	  
	  case TCKind._tk_string :
	    _tc.length((int)_is.read_ulong());
	    return _tc;

	  case TCKind._tk_wstring :
	    _tc.length((int)_is.read_ulong());
	    return _tc;

	  case TCKind._tk_struct:
	    
	    _tc.id(_is.read_string());
	    _tc.name(_is.read_string());
	    __len = _is.read_list_head();
	    _tc.member_count(__len);
	    
	    for(int i=0; i<__len; i++) {
	      _is.read_tuple_head();
	      _tc.member_name(i,_is.read_string());
	      _tc.member_type(i,unmarshal(_is));
	    }
	    _is.read_nil();
	    
	    return _tc;
	    
	    
	  case TCKind._tk_union:
	    
	    _tc.id(_is.read_string());
	    _tc.name(_is.read_string());	    
	    _tc.discriminator_type(unmarshal(_is));
	    _tc.default_index(_is.read_int());
	    __len = _is.read_list_head();
	    _tc.member_count(__len);

	    for(int i=0; i<__len; i++) {
	      _is.read_tuple_head();
	      
	      __tag = _is.peek();
	      Any __label = new Any();
	      TypeCode __label_type = new TypeCode();

	      __label_type.kind(com.ericsson.otp.ic.TCKind.tk_long);
	      __label.type(__label_type);

	      switch(__tag) {
	      case (com.ericsson.otp.erlang.OtpExternal.stringTag):
		java.lang.String __enum = _is.read_string();
		__label.insert_string(__enum);
		break;
	      case (com.ericsson.otp.erlang.OtpExternal.atomTag):
	      case (com.ericsson.otp.erlang.OtpExternal.atomUtf8Tag):
	      case (com.ericsson.otp.erlang.OtpExternal.smallAtomUtf8Tag):

		java.lang.String __default = _is.read_atom();
		__label.insert_atom(__default);
		break;
	      default:
		__label.insert_long(_is.read_int());
	      }

	      _tc.member_label(i,__label);
	      _tc.member_name(i,_is.read_string());
	      _tc.member_type(i,unmarshal(_is));
	    }
	    _is.read_nil();

	    return _tc;


	  case TCKind._tk_sequence:
	    _tc.content_type(unmarshal(_is));
	    _tc.length(_is.read_int());
	    return _tc;


	  case TCKind._tk_array:
	    _tc.content_type(unmarshal(_is));
	    _tc.length(_is.read_int());
	    return _tc;


	  case TCKind._tk_enum:
	    
	    _tc.id(_is.read_string());
	    _tc.name(_is.read_string());
	    __len = _is.read_list_head();
	    _tc.member_count(__len);
	    
	    for(int i=0; i<__len; i++)
	      _tc.member_name(i,_is.read_string());
	
	    _is.read_nil();
	    
	    return _tc;
	    
	  default:
	    throw new java.lang.Exception("Unsupported type");
	    
	  }
	  
	default:
	  throw new java.lang.Exception("Unsupported type");
	}
	
      }
      
      return null;
  }

}