1# -*- python -*-
2#                           Package   : omniidl
3# template.py               Created on: 2000/01/18
4#			    Author    : David Scott (djs)
5#
6#    Copyright (C) 2003-2011 Apasphere Ltd
7#    Copyright (C) 1999 AT&T Laboratories Cambridge
8#
9#  This file is part of omniidl.
10#
11#  omniidl is free software; you can redistribute it and/or modify it
12#  under the terms of the GNU General Public License as published by
13#  the Free Software Foundation; either version 2 of the License, or
14#  (at your option) any later version.
15#
16#  This program is distributed in the hope that it will be useful,
17#  but WITHOUT ANY WARRANTY; without even the implied warranty of
18#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19#  General Public License for more details.
20#
21#  You should have received a copy of the GNU General Public License
22#  along with this program.  If not, see http://www.gnu.org/licenses/
23
24"""C++ templates for the .hh file"""
25
26##
27## File header
28##
29header = """\
30// This file is generated by @program@- @library@. Do not edit.
31#ifndef @guard_prefix@__@guard@_hh__
32#define @guard_prefix@__@guard@_hh__
33"""
34
35footer = """\
36#endif
37"""
38
39##
40## Main file
41##
42main = """\
43#ifndef __CORBA_H_EXTERNAL_GUARD__
44#include <omniORB4/CORBA.h>
45#endif
46
47#ifndef  USE_stub_in_nt_dll
48# define USE_stub_in_nt_dll_NOT_DEFINED_@guard@
49#endif
50#ifndef  USE_core_stub_in_nt_dll
51# define USE_core_stub_in_nt_dll_NOT_DEFINED_@guard@
52#endif
53#ifndef  USE_dyn_stub_in_nt_dll
54# define USE_dyn_stub_in_nt_dll_NOT_DEFINED_@guard@
55#endif
56
57@sub_include_pre@
58@cxx_direct_include@
59@includes@
60@sub_include_post@
61
62#ifdef USE_stub_in_nt_dll
63# ifndef USE_core_stub_in_nt_dll
64#  define USE_core_stub_in_nt_dll
65# endif
66# ifndef USE_dyn_stub_in_nt_dll
67#  define USE_dyn_stub_in_nt_dll
68# endif
69#endif
70
71#ifdef _core_attr
72# error "A local CPP macro _core_attr has already been defined."
73#else
74# ifdef  USE_core_stub_in_nt_dll
75#  define _core_attr _OMNIORB_NTDLL_IMPORT
76# else
77#  define _core_attr
78# endif
79#endif
80
81#ifdef _dyn_attr
82# error "A local CPP macro _dyn_attr has already been defined."
83#else
84# ifdef  USE_dyn_stub_in_nt_dll
85#  define _dyn_attr _OMNIORB_NTDLL_IMPORT
86# else
87#  define _dyn_attr
88# endif
89#endif
90
91@forward_declarations@
92
93@defs@
94
95@poa@
96
97@obv@
98
99@other_tie@
100
101#undef _core_attr
102#undef _dyn_attr
103
104@operators@
105
106@marshalling@
107
108#ifdef   USE_stub_in_nt_dll_NOT_DEFINED_@guard@
109# undef  USE_stub_in_nt_dll
110# undef  USE_stub_in_nt_dll_NOT_DEFINED_@guard@
111#endif
112#ifdef   USE_core_stub_in_nt_dll_NOT_DEFINED_@guard@
113# undef  USE_core_stub_in_nt_dll
114# undef  USE_core_stub_in_nt_dll_NOT_DEFINED_@guard@
115#endif
116#ifdef   USE_dyn_stub_in_nt_dll_NOT_DEFINED_@guard@
117# undef  USE_dyn_stub_in_nt_dll
118# undef  USE_dyn_stub_in_nt_dll_NOT_DEFINED_@guard@
119#endif
120
121#endif  // __@guard@_hh__
122"""
123
124
125sub_include_pre = """\
126#ifdef INCLUDED_stub_in_nt_dll
127# ifdef USE_stub_in_nt_dll
128#  error "cannot use both INCLUDED_stub_in_nt_dll and USE_stub_in_nt_dll."
129# else
130#  define USE_stub_in_nt_dll
131# endif
132# define INCLUDED_stub_in_nt_dll_DEFINED_@guard@
133# undef INCLUDED_stub_in_nt_dll
134#endif
135"""
136
137sub_include_post = """\
138#ifdef INCLUDED_stub_in_nt_dll_DEFINED_@guard@
139# undef USE_stub_in_nt_dll
140# define INCLUDED_stub_in_nt_dll
141# undef INCLUDED_stub_in_nt_dll_DEFINED_@guard@
142#endif
143"""
144
145main_include = """\
146#ifndef @guard_prefix@__@guardname@_EXTERNAL_GUARD__
147#define @guard_prefix@__@guardname@_EXTERNAL_GUARD__
148#include @filename@
149#endif"""
150
151##
152## Modules
153##
154# name => C++ form of the module identifier
155module_begin = """\
156_CORBA_MODULE @name@
157
158_CORBA_MODULE_BEG
159"""
160module_end = """\
161_CORBA_MODULE_END
162"""
163
164POA_module_begin = """\
165_CORBA_MODULE @POA_prefix@@name@
166_CORBA_MODULE_BEG
167"""
168
169POA_module_end = """\
170_CORBA_MODULE_END
171"""
172
173OBV_module_begin = """\
174_CORBA_MODULE @OBV_prefix@@name@
175_CORBA_MODULE_BEG
176"""
177
178OBV_module_end = """\
179_CORBA_MODULE_END
180"""
181
182
183POA_interface = """\
184class @POA_name@ :
185  public virtual @impl_scopedID@,
186  @inherits@
187{
188public:
189  virtual ~@POA_name@();
190
191  inline ::@scopedID@_ptr _this() {
192    return (::@scopedID@_ptr) _do_this(::@scopedID@::_PD_repoId);
193  }
194};
195"""
196
197
198##
199## Interfaces
200##
201
202interface_Helper = """\
203#ifndef __@guard@__
204#define __@guard@__
205class @name@;
206class _objref_@name@;
207class _impl_@name@;
208@class_sk_name@
209typedef _objref_@name@* @name@_ptr;
210typedef @name@_ptr @name@Ref;
211
212class @name@_Helper {
213public:
214  typedef @name@_ptr _ptr_type;
215
216  static _ptr_type _nil();
217  static _CORBA_Boolean is_nil(_ptr_type);
218  static void release(_ptr_type);
219  static void duplicate(_ptr_type);
220  static void marshalObjRef(_ptr_type, cdrStream&);
221  static _ptr_type unmarshalObjRef(cdrStream&);
222};
223
224typedef _CORBA_ObjRef_Var<_objref_@name@, @name@_Helper> @name@_var;
225typedef _CORBA_ObjRef_OUT_arg<_objref_@name@,@name@_Helper > @name@_out;
226
227#endif
228"""
229
230interface_type = """\
231// interface @name@
232class @name@ {
233public:
234  // Declarations for this interface type.
235  typedef @name@_ptr _ptr_type;
236  typedef @name@_var _var_type;
237
238  static _ptr_type _duplicate(_ptr_type);
239  static _ptr_type _narrow(::CORBA::Object_ptr);
240  static _ptr_type _unchecked_narrow(::CORBA::Object_ptr);
241  @abstract_narrows@
242  static _ptr_type _nil();
243
244  static inline void _marshalObjRef(_ptr_type, cdrStream&);
245
246  static inline _ptr_type _unmarshalObjRef(cdrStream& s) {
247    omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s);
248    if (o)
249      return (_ptr_type) o->_ptrToObjRef(_PD_repoId);
250    else
251      return _nil();
252  }
253
254  static inline _ptr_type _fromObjRef(omniObjRef* o) {
255    if (o)
256      return (_ptr_type) o->_ptrToObjRef(_PD_repoId);
257    else
258      return _nil();
259  }
260
261  static _core_attr const char* _PD_repoId;
262
263  // Other IDL defined within this scope.
264  @Other_IDL@
265};
266"""
267
268interface_abstract_narrows = """\
269static _ptr_type _narrow(::CORBA::AbstractBase_ptr);
270static _ptr_type _unchecked_narrow(::CORBA::AbstractBase_ptr);
271"""
272
273
274##
275## Abstract Interfaces
276##
277
278abstract_interface_Helper = """\
279#ifndef __@guard@__
280#define __@guard@__
281
282class @name@;
283class _objref_@name@;
284typedef @name@* @name@_ptr;
285typedef @name@_ptr @name@Ref;
286
287class @name@_Helper {
288public:
289  typedef @name@_ptr _ptr_type;
290
291  static _ptr_type _nil();
292  static _CORBA_Boolean is_nil(_ptr_type);
293  static void release(_ptr_type);
294  static void duplicate(_ptr_type);
295  static void marshalObjRef(_ptr_type, cdrStream&);
296  static _ptr_type unmarshalObjRef(cdrStream&);
297};
298
299typedef _CORBA_ObjRef_Var<@name@, @name@_Helper> @name@_var;
300typedef _CORBA_ObjRef_OUT_arg<@name@,@name@_Helper > @name@_out;
301
302#endif
303"""
304
305abstract_interface_type = """\
306// abstract interface @name@
307class @name@ :
308  @inherits@
309{
310public:
311  // Declarations for this interface type.
312  typedef @name@_ptr _ptr_type;
313  typedef @name@_var _var_type;
314
315  static _ptr_type _duplicate(_ptr_type);
316  static _ptr_type _narrow(::CORBA::AbstractBase_ptr);
317  static _ptr_type _unchecked_narrow(::CORBA::AbstractBase_ptr);
318  static _ptr_type _nil();
319
320  static inline void _marshalObjRef(_ptr_type, cdrStream&);
321
322  static inline _ptr_type _unmarshalObjRef(cdrStream& s) {
323    _CORBA_Boolean b = s.unmarshalBoolean();
324    if (b) {
325      omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s);
326      if (o)
327        return (_ptr_type) o->_ptrToObjRef(_PD_repoId);
328      else
329        return _nil();
330    }
331    else {
332      ::CORBA::ValueBase* v = ::CORBA::ValueBase::_NP_unmarshal(s);
333      if (v)
334        return (_ptr_type) v->_ptrToValue(_PD_repoId);
335      else
336        return 0;
337    }
338  }
339
340  static _core_attr const char* _PD_repoId;
341
342  // Other IDL defined within this scope.
343  @Other_IDL@
344
345  // Operations declared in this abstract interface
346  @operations@
347};
348"""
349
350##
351## Local Interfaces
352##
353
354local_interface_Helper = """\
355#ifndef __@guard@__
356#define __@guard@__
357
358class @name@;
359typedef @name@* @name@_ptr;
360typedef @name@_ptr @name@Ref;
361
362class @name@_Helper {
363public:
364  typedef @name@_ptr _ptr_type;
365
366  static _ptr_type _nil();
367  static _CORBA_Boolean is_nil(_ptr_type);
368  static void release(_ptr_type);
369  static void duplicate(_ptr_type);
370  static void marshalObjRef(_ptr_type, cdrStream&);
371  static _ptr_type unmarshalObjRef(cdrStream&);
372};
373
374typedef _CORBA_ObjRef_Var<@name@, @name@_Helper> @name@_var;
375typedef _CORBA_ObjRef_OUT_arg<@name@,@name@_Helper > @name@_out;
376
377#endif
378"""
379
380local_interface_type = """\
381// local interface @name@
382class @name@ :
383  @inherits@
384{
385public:
386  // Declarations for this interface type.
387  typedef @name@_ptr _ptr_type;
388  typedef @name@_var _var_type;
389
390  static _ptr_type _duplicate(_ptr_type);
391  static _ptr_type _narrow(::CORBA::Object_ptr);
392  static _ptr_type _unchecked_narrow(::CORBA::Object_ptr);
393  @abstract_narrows@
394  static _ptr_type _nil();
395
396  static inline void _marshalObjRef(_ptr_type, cdrStream& s);
397  static inline _ptr_type _unmarshalObjRef(cdrStream& s);
398
399  static _core_attr const char* _PD_repoId;
400
401  // Other IDL defined within this scope.
402  @Other_IDL@
403
404  // Operations declared in this local interface
405  @operations@
406
407private:
408  virtual void* _ptrToObjRef(const char*);
409
410protected:
411  @name@();
412  virtual ~@name@();
413};
414
415class _nil_@name@ :
416  @nil_inherits@
417  public virtual @name@
418{
419  public:
420    @nil_operations@
421
422    inline _nil_@name@() { _PR_setobj(0); }
423
424  protected:
425    virtual ~_nil_@name@();
426};
427"""
428
429
430
431##
432## Object reference
433##
434
435interface_objref = """\
436class _objref_@name@ :
437  @inherits@
438{
439public:
440  // IDL operations
441  @operations@
442
443  // Constructors
444  inline _objref_@name@() @init_shortcut@ { _PR_setobj(0); }  // nil
445  _objref_@name@(omniIOR*, omniIdentity*);
446
447protected:
448  virtual ~_objref_@name@();
449
450  @shortcut@
451private:
452  virtual void* _ptrToObjRef(const char*);
453
454  _objref_@name@(const _objref_@name@&);
455  _objref_@name@& operator = (const _objref_@name@&);
456  // not implemented
457
458  friend class @name@;
459};
460"""
461
462interface_shortcut = """\
463virtual void _enableShortcut(omniServant*, const _CORBA_Boolean*);
464_impl_@name@* _shortcut;
465const _CORBA_Boolean* _invalid;\
466"""
467
468##
469## Proxy Object Factory
470##
471
472interface_pof = """\
473class _pof_@name@ : public _OMNI_NS(proxyObjectFactory) {
474public:
475  inline _pof_@name@() : _OMNI_NS(proxyObjectFactory)(@name@::_PD_repoId) {}
476  virtual ~_pof_@name@();
477
478  virtual omniObjRef* newObjRef(omniIOR*,omniIdentity*);
479  virtual _CORBA_Boolean is_a(const char*) const;
480};
481"""
482
483##
484## Interface Impl class
485##
486
487interface_impl = """\
488class _impl_@name@ :
489  @inherits@
490{
491public:
492  virtual ~_impl_@name@();
493
494  @operations@
495
496public:  // Really protected, workaround for xlC
497  virtual _CORBA_Boolean _dispatch(omniCallHandle&);
498
499private:
500  virtual void* _ptrToInterface(const char*);
501  virtual const char* _mostDerivedRepoId();
502  @abstract@
503};
504
505"""
506
507interface_impl_abstract = """\
508virtual void _interface_is_abstract() = 0;"""
509
510interface_impl_not_abstract = """\
511virtual void _interface_is_abstract();"""
512
513
514##
515## Old BOA skeleton class
516##
517
518interface_sk = """\
519class _sk_@name@ :
520  public virtual _impl_@name@,
521  @inherits@
522{
523public:
524  _sk_@name@() {}
525  _sk_@name@(const omniOrbBoaKey&);
526  virtual ~_sk_@name@();
527  inline @name@::_ptr_type _this() {
528    return (@name@::_ptr_type) omniOrbBoaServant::_this(@name@::_PD_repoId);
529  }
530
531};
532"""
533
534##
535## Objref marshal function
536##
537
538interface_marshal_forward = """\
539inline void
540@name@::_marshalObjRef(::@name@_ptr obj, cdrStream& s) {
541  omniObjRef::_marshal(obj->_PR_getobj(),s);
542}
543"""
544
545local_interface_marshal_forward = """\
546inline void
547@name@::_marshalObjRef(::@name@_ptr, cdrStream& s) {
548  OMNIORB_THROW(MARSHAL, _OMNI_NS(MARSHAL_LocalObject),
549                (::CORBA::CompletionStatus)s.completion());
550}
551
552inline @name@_ptr
553@name@::_unmarshalObjRef(cdrStream& s) {
554  OMNIORB_THROW(MARSHAL, _OMNI_NS(MARSHAL_LocalObject),
555                (::CORBA::CompletionStatus)s.completion());
556#ifdef NEED_DUMMY_RETURN
557  return 0;
558#endif
559}
560"""
561
562abstract_interface_marshal_forward = """\
563inline void
564@name@::_marshalObjRef(::@name@_ptr obj, cdrStream& s) {
565  if (obj) {
566    ::CORBA::ValueBase* v = obj->_NP_to_value();
567    if (v) {
568      s.marshalBoolean(0);
569      ::CORBA::ValueBase::_NP_marshal(v,s);
570      return;
571    }
572    ::CORBA::Object_ptr o = obj->_NP_to_object();
573    if (o) {
574      s.marshalBoolean(1);
575      omniObjRef::_marshal(o->_PR_getobj(),s);
576      return;
577    }
578  }
579  s.marshalBoolean(0);
580  ::CORBA::ValueBase::_NP_marshal(0, s);
581}
582"""
583
584
585
586##
587## Typedefs
588##
589typedef_simple_to_array = """\
590typedef @base@ @derived@;
591typedef @base@_slice @derived@_slice;
592typedef @base@_copyHelper @derived@_copyHelper;
593typedef @base@_var @derived@_var;
594typedef @base@_out @derived@_out;
595typedef @base@_forany @derived@_forany;
596
597@inline_qualifier@ @derived@_slice* @derived@_alloc() { return @base@_alloc(); }
598@inline_qualifier@ @derived@_slice* @derived@_dup(const @derived@_slice* p) { return @base@_dup(p); }
599@inline_qualifier@ void @derived@_copy( @derived@_slice* _to, const @derived@_slice* _from ) { @base@_copy(_to, _from); }
600@inline_qualifier@ void @derived@_free( @derived@_slice* p) { @base@_free(p); }
601"""
602
603typedef_simple_string = """\
604typedef char* @name@;
605typedef ::CORBA::String_var @name@_var;
606typedef ::CORBA::String_out @name@_out;
607"""
608
609typedef_simple_wstring = """\
610typedef ::CORBA::WChar* @name@;
611typedef ::CORBA::WString_var @name@_var;
612typedef ::CORBA::WString_out @name@_out;
613"""
614
615typedef_simple_typecode = """\
616typedef ::CORBA::TypeCode_ptr @name@_ptr;
617typedef ::CORBA::TypeCode_var @name@_var;
618"""
619
620typedef_simple_any = """\
621typedef ::CORBA::Any @name@;
622typedef ::CORBA::Any_var @name@_var;
623typedef ::CORBA::Any_out @name@_out;
624"""
625
626typedef_simple_fixed = """\
627typedef _omni_Fixed<@digits@,@scale@> @name@;
628typedef @name@& @name@_out;
629"""
630
631typedef_simple_basic = """\
632typedef @base@ @derived@;
633typedef @base@_out @derived@_out;
634"""
635
636typedef_simple_constructed = """\
637typedef @base@ @name@;
638typedef @base@_var @name@_var;
639typedef @base@_out @name@_out;
640"""
641
642typedef_simple_objref = """\
643typedef @base@ @name@;
644typedef @base@_ptr @name@_ptr;
645typedef @base@Ref @name@Ref;
646@impl_base@
647typedef @base@_Helper @name@_Helper;
648@objref_base@
649typedef @base@_var @name@_var;
650typedef @base@_out @name@_out;
651"""
652
653typedef_enum_oper_friend = """\
654// Need to declare <<= for elem type, as GCC expands templates early
655#if defined(__GNUG__) && __GNUG__ == 2 && __GNUC_MINOR__ == 7
656 @friend@ inline void operator >>= (@element@, cdrStream&);
657 @friend@ inline void operator <<= (@element@&, cdrStream&);
658#endif
659"""
660
661# Arrays
662
663typedef_array = """\
664typedef @type@ @name@@dims@;
665typedef @type@ @name@_slice@taildims@;
666
667@inline_qualifier@ @name@_slice* @name@_alloc() {
668  return new @name@_slice[@firstdim@];
669}
670
671@inline_qualifier@ @name@_slice* @name@_dup(const @name@_slice* _s) {
672  if (!_s) return 0;
673  @name@_slice* _data = @name@_alloc();
674  if (_data) {
675    @dup_loop@
676  }
677  return _data;
678}
679
680@inline_qualifier@ void @name@_copy(@name@_slice* _to, const @name@_slice* _from){
681  @copy_loop@
682}
683
684@inline_qualifier@ void @name@_free(@name@_slice* _s) {
685  delete [] _s;
686}
687"""
688
689typedef_array_copyHelper = """\
690class @name@_copyHelper {
691public:
692  static inline @name@_slice* alloc() { return ::@fqname@_alloc(); }
693  static inline @name@_slice* dup(const @name@_slice* p) { return ::@fqname@_dup(p); }
694  static inline void free(@name@_slice* p) { ::@fqname@_free(p); }
695};
696
697typedef _CORBA_Array_@var_or_fix@_Var<@name@_copyHelper,@name@_slice> @name@_var;
698typedef _CORBA_Array_@var_or_fix@_Forany<@name@_copyHelper,@name@_slice> @name@_forany;
699"""
700
701typedef_array_fix_out_type = """\
702typedef @name@_slice* @name@_out;
703"""
704
705typedef_array_variable_out_type = """\
706typedef _CORBA_Array_Variable_OUT_arg<@name@_slice,@name@_var > @name@_out;
707"""
708
709##
710## Sequences
711##
712sequence_type = """\
713class @name@_var;
714
715class @name@ : public @derived@ {
716public:
717  typedef @name@_var _var_type;
718  inline @name@() {}
719  inline @name@(const @name@& _s)
720    : @derived@(_s) {}
721
722  @bounds@
723
724  inline @name@& operator = (const @name@& _s) {
725    @derived@::operator=(_s);
726    return *this;
727  }
728};
729"""
730
731sequence_forward_type = """\
732class @name@_var;
733
734class @name@ : public @derived@ {
735public:
736  typedef @name@_var _var_type;
737
738  inline @name@() {}
739  @name@(const @name@& _s);
740  @name@& operator=(const @name@& _s);
741
742  @bounds@
743
744  virtual ~@name@();
745
746  @element@& operator[] (_CORBA_ULong _index);
747  const @element@& operator[] (_CORBA_ULong _index) const;
748  static @element@* allocbuf(_CORBA_ULong _nelems);
749  static void freebuf(@element@* _b);
750
751  void operator>>= (cdrStream &_s) const;
752  void operator<<= (cdrStream &_s);
753
754protected:
755  void NP_copybuffer(_CORBA_ULong _newmax);
756  void NP_freebuf();
757};
758"""
759
760sequence_unbounded_ctors = """\
761inline @name@(_CORBA_ULong _max)
762  : @derived@(_max) {}
763inline @name@(_CORBA_ULong _max, _CORBA_ULong _len, @element@* _val, _CORBA_Boolean _rel=0)
764  : @derived@(_max, _len, _val, _rel) {}
765"""
766
767sequence_bounded_ctors = """\
768inline @name@(_CORBA_ULong _len, @element@* _val, _CORBA_Boolean _rel=0)
769  : @derived@(_len, _val, _rel) {}
770"""
771
772sequence_var_array_subscript = """\
773inline @element@_slice* operator [] (_CORBA_ULong _s) {
774  return (@element@_slice*) ((_pd_seq->NP_data())[_s]);
775}
776"""
777
778sequence_var_subscript = """\
779inline @element@ operator [] (_CORBA_ULong _s) {
780  return (*_pd_seq)[_s];
781}
782"""
783
784sequence_var = """\
785class @name@_out;
786
787class @name@_var {
788public:
789  inline @name@_var() : _pd_seq(0) {}
790  inline @name@_var(@name@* _s) : _pd_seq(_s) {}
791  inline @name@_var(const @name@_var& _s) {
792    if (_s._pd_seq)  _pd_seq = new @name@(*_s._pd_seq);
793    else             _pd_seq = 0;
794  }
795  inline ~@name@_var() { if (_pd_seq)  delete _pd_seq; }
796
797  inline @name@_var& operator = (@name@* _s) {
798    if (_pd_seq)  delete _pd_seq;
799    _pd_seq = _s;
800    return *this;
801  }
802  inline @name@_var& operator = (const @name@_var& _s) {
803    if (&_s != this) {
804      if (_s._pd_seq) {
805        if (!_pd_seq)  _pd_seq = new @name@;
806        *_pd_seq = *_s._pd_seq;
807      }
808      else if (_pd_seq) {
809        delete _pd_seq;
810        _pd_seq = 0;
811      }
812    }
813    return *this;
814  }
815  @subscript_operator@
816
817  inline @name@* operator -> () { return _pd_seq; }
818  inline const @name@* operator -> () const { return _pd_seq; }
819#if defined(__GNUG__)
820  inline operator @name@& () const { return *_pd_seq; }
821#else
822  inline operator const @name@& () const { return *_pd_seq; }
823  inline operator @name@& () { return *_pd_seq; }
824#endif
825
826  inline const @name@& in() const { return *_pd_seq; }
827  inline @name@&       inout()    { return *_pd_seq; }
828  inline @name@*&      out() {
829    if (_pd_seq) { delete _pd_seq; _pd_seq = 0; }
830    return _pd_seq;
831  }
832  inline @name@* _retn() { @name@* tmp = _pd_seq; _pd_seq = 0; return tmp; }
833
834  friend class @name@_out;
835
836private:
837  @name@* _pd_seq;
838};
839"""
840
841sequence_out_array_subscript = """\
842inline @element@_slice* operator [] (_CORBA_ULong _i) {
843  return (@element@_slice*) ((_data->NP_data())[_i]);
844}
845"""
846
847sequence_out_subscript = """\
848inline @element@ operator [] (_CORBA_ULong _i) {
849  return (*_data)[_i];
850}
851"""
852
853sequence_out = """\
854class @name@_out {
855public:
856  inline @name@_out(@name@*& _s) : _data(_s) { _data = 0; }
857  inline @name@_out(@name@_var& _s)
858    : _data(_s._pd_seq) { _s = (@name@*) 0; }
859  inline @name@_out(const @name@_out& _s) : _data(_s._data) {}
860  inline @name@_out& operator = (const @name@_out& _s) {
861    _data = _s._data;
862    return *this;
863  }
864  inline @name@_out& operator = (@name@* _s) {
865    _data = _s;
866    return *this;
867  }
868  inline operator @name@*&()  { return _data; }
869  inline @name@*& ptr()       { return _data; }
870  inline @name@* operator->() { return _data; }
871
872  @subscript_operator@
873
874  @name@*& _data;
875
876private:
877  @name@_out();
878  @name@_out& operator=(const @name@_var&);
879};
880"""
881
882##
883## Structs
884##
885
886struct = """\
887struct @name@ {
888  typedef _CORBA_ConstrType_@fix_or_var@_Var<@name@> _var_type;
889
890  @Other_IDL@
891  @members@
892
893  void operator>>= (cdrStream &) const;
894  void operator<<= (cdrStream &);
895};
896
897typedef @name@::_var_type @name@_var;
898"""
899
900struct_fix_out_type = """\
901typedef @name@& @name@_out;
902"""
903
904struct_variable_out_type = """\
905typedef _CORBA_ConstrType_Variable_OUT_arg< @name@,@name@_var > @name@_out;
906"""
907
908struct_array_declarator = """\
909typedef @memtype@ @prefix@_@cxx_id@@dims@;
910typedef @memtype@ _@cxx_id@_slice@tail_dims@;
911"""
912
913struct_nonarray_sequence = """\
914typedef @memtype@ _@cxx_id@_seq;
915_@cxx_id@_seq @cxx_id@;
916"""
917
918struct_normal_member = """\
919@memtype@ @cxx_id@@dims@;
920"""
921
922struct_forward = """\
923struct @name@;
924"""
925
926##
927## Exceptions
928##
929
930exception = """\
931class @name@ : public ::CORBA::UserException {
932public:
933  @Other_IDL@
934  @members@
935
936  inline @name@() {
937    pd_insertToAnyFn    = insertToAnyFn;
938    pd_insertToAnyFnNCP = insertToAnyFnNCP;
939  }
940  @name@(const @name@&);
941  @constructor@
942  @name@& operator=(const @name@&);
943  virtual ~@name@();
944  virtual void _raise() const;
945  static @name@* _downcast(::CORBA::Exception*);
946  static const @name@* _downcast(const ::CORBA::Exception*);
947  static inline @name@* _narrow(::CORBA::Exception* _e) {
948    return _downcast(_e);
949  }
950
951  @inline@void operator>>=(cdrStream&) const @body@
952  @inline@void operator<<=(cdrStream&) @body@
953
954  static _core_attr insertExceptionToAny    insertToAnyFn;
955  static _core_attr insertExceptionToAnyNCP insertToAnyFnNCP;
956
957  virtual ::CORBA::Exception* _NP_duplicate() const;
958
959  static _core_attr const char* _PD_repoId;
960  static _core_attr const char* _PD_typeId;
961
962private:
963  virtual const char* _NP_typeId() const;
964  virtual const char* _NP_repoId(int*) const;
965  virtual void _NP_marshal(cdrStream&) const;
966};
967"""
968
969
970exception_array_declarator = """\
971typedef @memtype@ @private_prefix@_@cxx_id@@dims@;
972typedef @memtype@ _@cxx_id@_slice@tail_dims@;
973"""
974
975exception_member = """\
976@memtype@ @cxx_id@@dims@;
977"""
978
979##
980## Unions
981##
982
983union_ctor_nonexhaustive = """\
984if ((_pd__default = _value._pd__default)) {
985  @default@
986}
987else {
988  switch(_value._pd__d) {
989    @cases@
990  }
991}
992_pd__d = _value._pd__d;
993"""
994
995union_ctor_exhaustive = """\
996switch(_value._pd__d) {
997  @cases@
998}
999_pd__d = _value._pd__d;"""
1000
1001union_ctor_case = """\
1002case @discrimvalue@: @name@(_value.@name@()); break;
1003"""
1004
1005union_ctor_bool_default = """\
1006#ifndef HAS_Cplusplus_Bool
1007default: @name@(_value.@name@()); break;
1008#endif
1009"""
1010
1011union_ctor_default = """\
1012default: break;
1013"""
1014
1015union = """\
1016class @unionname@ {
1017public:
1018
1019  typedef _CORBA_ConstrType_@fixed@_Var<@unionname@> _var_type;
1020
1021  @Other_IDL@
1022
1023  @unionname@(): _pd__initialised(0) {
1024    @default_constructor@
1025  }
1026
1027  @unionname@(const @unionname@& _value) : _pd__initialised(0) {
1028    if (_value._pd__initialised) {
1029      @copy_constructor@
1030      _pd__initialised = _value._pd__initialised;
1031    }
1032  }
1033
1034  ~@unionname@() {
1035    _release_member();
1036  }
1037
1038  @unionname@& operator=(const @unionname@& _value) {
1039    if (&_value != this) {
1040      if (_value._pd__initialised) {
1041        @copy_constructor@
1042        _pd__initialised = _value._pd__initialised;
1043      }
1044      else {
1045        _release_member();
1046      }
1047    }
1048    return *this;
1049  }
1050
1051  @discrimtype@ _d() const { return _pd__d;}
1052  void _d(@discrimtype@ _value){
1053    @_d_body@
1054  }
1055
1056  @implicit_default@
1057
1058  @members@
1059
1060  void operator>>= (cdrStream&) const;
1061  void operator<<= (cdrStream&);
1062
1063private:
1064  @discrimtype@ _pd__d;
1065  _CORBA_Boolean _pd__default;
1066  _CORBA_Boolean _pd__initialised;
1067
1068  union {
1069    @union_body@
1070  };
1071  @release_member@
1072};
1073
1074typedef @unionname@::_var_type @unionname@_var;
1075"""
1076
1077union_fix_out_type = """\
1078typedef @unionname@& @unionname@_out;
1079"""
1080
1081union_variable_out_type = """\
1082typedef _CORBA_ConstrType_Variable_OUT_arg< @unionname@,@unionname@_var > @unionname@_out;
1083"""
1084
1085union_union = """\
1086union {
1087  @members@
1088};
1089"""
1090
1091union_d_fn_body = """\
1092// illegal to set discriminator before making a member active
1093if (!_pd__initialised)
1094  OMNIORB_THROW(BAD_PARAM,_OMNI_NS(BAD_PARAM_InvalidUnionDiscValue),::CORBA::COMPLETED_NO);
1095
1096if (_value == _pd__d) return; // no change
1097
1098@switch@
1099
1100fail:
1101OMNIORB_THROW(BAD_PARAM,_OMNI_NS(BAD_PARAM_InvalidUnionDiscValue),::CORBA::COMPLETED_NO);
1102
1103"""
1104
1105union_constructor_implicit = """\
1106_default();
1107"""
1108union_constructor_default = """\
1109_pd__default = 1;
1110_pd__d = @default@;
1111"""
1112union_implicit_default = """\
1113void _default()
1114{
1115  _release_member();
1116  _pd__initialised = 1;
1117  _pd__d = @arbitraryDefault@;
1118  _pd__default = 1;
1119}
1120"""
1121
1122union_proxy_float = """
1123#ifdef USING_PROXY_FLOAT
1124  @type@ _pd_@name@@dims@;
1125#endif
1126"""
1127
1128union_noproxy_float = """
1129#ifndef USING_PROXY_FLOAT
1130  @type@ _pd_@name@@dims@;
1131#endif
1132"""
1133
1134
1135union_array_declarator = """\
1136typedef @memtype@ @prefix@_@name@@dims@;
1137typedef @memtype@ _@name@_slice@tail_dims@;
1138"""
1139
1140union_array = """\
1141const @memtype@_slice *@name@ () const { return _pd_@name@; }
1142void @name@ (const @const_type@ _value) {
1143  _release_member();
1144  _pd__initialised = 1;
1145  _pd__d = @discrimvalue@;
1146  _pd__default = @isDefault@;
1147  _pd_@name@ = new @memtype@_slice[@first_dim@];
1148  @loop@
1149}
1150#ifdef OMNIORB_EXTENDED_UNION_MAPPING
1151void @name@ (@memtype@_slice* _value) {
1152  // Non-standard method, consumes _value
1153  _release_member();
1154  _pd__initialised = 1;
1155  _pd__d = @discrimvalue@;
1156  _pd__default = @isDefault@;
1157  _pd_@name@ = _value;
1158}
1159#endif
1160"""
1161
1162union_any = """\
1163const @type@ &@name@ () const { return *_pd_@name@; }
1164@type@ &@name@ () { return *_pd_@name@; }
1165void @name@ (const @type@& _value) {
1166  _release_member();
1167  _pd__initialised = 1;
1168  _pd__d = @discrimvalue@;
1169  _pd__default = @isDefault@;
1170  _pd_@name@ = new @type@(_value);
1171}
1172#ifdef OMNIORB_EXTENDED_UNION_MAPPING
1173void @name@ (@type@* _value) {
1174  // Non-standard method, consumes _value
1175  _release_member();
1176  _pd__initialised = 1;
1177  _pd__d = @discrimvalue@;
1178  _pd__default = @isDefault@;
1179  _pd_@name@ = _value;
1180}
1181#endif
1182"""
1183
1184union_typecode = """\
1185::CORBA::TypeCode_ptr @name@ () const { return _pd_@name@; }
1186void @name@(::CORBA::TypeCode_ptr _value) {
1187  _release_member();
1188  _pd__initialised = 1;
1189  _pd__d = @discrimvalue@;
1190  _pd__default = @isDefault@;
1191  _pd_@name@ = ::CORBA::TypeCode::_duplicate(_value);
1192}
1193void @name@(const ::CORBA::TypeCode_member& _value) {
1194  _release_member();
1195  _pd__initialised = 1;
1196  _pd__d = @discrimvalue@;
1197  _pd__default = @isDefault@;
1198  _pd_@name@ = ::CORBA::TypeCode::_duplicate(_value.in());
1199}
1200void @name@(const ::CORBA::TypeCode_var& _value) {
1201  _release_member();
1202  _pd__initialised = 1;
1203  _pd__d = @discrimvalue@;
1204  _pd__default = @isDefault@;
1205  _pd_@name@ = ::CORBA::TypeCode::_duplicate(_value.in());
1206}
1207"""
1208
1209union_basic = """\
1210@type@ @name@ () const { return _pd_@name@; }
1211void @name@ (@type@  _value) {
1212  _release_member();
1213  _pd__initialised = 1;
1214  _pd__d = @discrimvalue@;
1215  _pd__default = @isDefault@;
1216  _pd_@name@ = _value;
1217}
1218"""
1219
1220union_string = """\
1221const char * @name@ () const { return  _pd_@name@; }
1222
1223void @name@(char* _value) {
1224  _release_member();
1225  _pd__initialised = 1;
1226  _pd__d = @discrimvalue@;
1227  _pd__default = @isDefault@;
1228  _pd_@name@ = _value;
1229}
1230void @name@(const char*  _value) {
1231  _release_member();
1232  _pd__initialised = 1;
1233  _pd__d = @discrimvalue@;
1234  _pd__default = @isDefault@;
1235  _pd_@name@ = ::CORBA::string_dup(_value);
1236}
1237
1238void @name@(const ::CORBA::String_var& _value) {
1239  _release_member();
1240  _pd__initialised = 1;
1241  _pd__d = @discrimvalue@;
1242  _pd__default = @isDefault@;
1243  _pd_@name@ = ::CORBA::string_dup(_value.in());
1244}
1245void @name@(const ::CORBA::String_member& _value) {
1246  _release_member();
1247  _pd__initialised = 1;
1248  _pd__d = @discrimvalue@;
1249  _pd__default = @isDefault@;
1250  _pd_@name@ = ::CORBA::string_dup(_value.in());
1251}
1252"""
1253
1254union_wstring = """\
1255const ::CORBA::WChar * @name@ () const {
1256    return  _pd_@name@;
1257}
1258void @name@(::CORBA::WChar* _value) {
1259  _release_member();
1260  _pd__initialised = 1;
1261  _pd__d = @discrimvalue@;
1262  _pd__default = @isDefault@;
1263  _pd_@name@ = _value;
1264}
1265void @name@(const ::CORBA::WChar*  _value) {
1266  _release_member();
1267  _pd__initialised = 1;
1268  _pd__d = @discrimvalue@;
1269  _pd__default = @isDefault@;
1270  _pd_@name@ = ::CORBA::wstring_dup(_value);
1271}
1272void @name@(const ::CORBA::WString_var& _value) {
1273  _release_member();
1274  _pd__initialised = 1;
1275  _pd__d = @discrimvalue@;
1276  _pd__default = @isDefault@;
1277  _pd_@name@ = ::CORBA::wstring_dup(_value.in());
1278}
1279void @name@(const ::CORBA::WString_member& _value) {
1280  _release_member();
1281  _pd__initialised = 1;
1282  _pd__d = @discrimvalue@;
1283  _pd__default = @isDefault@;
1284  _pd_@name@ = ::CORBA::wstring_dup(_value.in());
1285}
1286"""
1287
1288
1289union_objref = """\
1290@ptr_name@ @member@ () const { return _pd_@member@; }
1291void @member@(@ptr_name@ _value) {
1292   _release_member();
1293  _pd__initialised = 1;
1294  _pd__d = @discrimvalue@;
1295  _pd__default = @isDefault@;
1296  @duplicate@(_value);
1297  _pd_@member@ = _value;
1298}
1299void @member@(const @memtype@& _value) {
1300  _release_member();
1301  _pd__initialised = 1;
1302  _pd__d = @discrimvalue@;
1303  _pd__default = @isDefault@;
1304  @duplicate@(_value);
1305  _pd_@member@ = _value;
1306}
1307void @member@(const @var_name@&  _value) {
1308   _release_member();
1309  _pd__initialised = 1;
1310  _pd__d = @discrimvalue@;
1311  _pd__default = @isDefault@;
1312  @duplicate@(_value);
1313  _pd_@member@ = _value;
1314}
1315"""
1316
1317union_constructed = """\
1318const @type@ &@name@ () const { return *_pd_@name@; }
1319@type@ &@name@ () { return *_pd_@name@; }
1320void @name@ (const @type@& _value) {
1321  _release_member();
1322  _pd__initialised = 1;
1323  _pd__d = @discrimvalue@;
1324  _pd__default = @isDefault@;
1325  _pd_@name@ = new @type@(_value);
1326}
1327#ifdef OMNIORB_EXTENDED_UNION_MAPPING
1328void @name@ (@type@* _value) {
1329  // Non-standard method, consumes _value
1330  _release_member();
1331  _pd__initialised = 1;
1332  _pd__d = @discrimvalue@;
1333  _pd__default = @isDefault@;
1334  _pd_@name@ = _value;
1335}
1336#endif
1337"""
1338
1339union_sequence = """\
1340typedef @sequence_template@ _@member@_seq;
1341const _@member@_seq& @member@ () const { return *_pd_@member@; }
1342_@member@_seq& @member@ () { return *_pd_@member@; }
1343void @member@ (const _@member@_seq& _value) {
1344   _release_member();
1345  _pd__initialised = 1;
1346  _pd__d = @discrimvalue@;
1347  _pd__default = @isDefault@;
1348  _pd_@member@ = new _@member@_seq(_value);
1349}
1350#ifdef OMNIORB_EXTENDED_UNION_MAPPING
1351void @member@ (@member@_seq* _value) {
1352  // Non-standard method, consumes _value
1353  _release_member();
1354  _pd__initialised = 1;
1355  _pd__d = @discrimvalue@;
1356  _pd__default = @isDefault@;
1357  _pd_@member@ = _value;
1358}
1359#endif
1360"""
1361
1362union_value = """\
1363@type@* @member@() const { return _pd_@member@; }
1364void @member@(@type@* _value) {
1365  _release_member();
1366  _pd__initialised = 1;
1367  _pd__d = @discrimvalue@;
1368  _pd__default = @isDefault@;
1369  ::CORBA::add_ref(_value);
1370  _pd_@member@ = _value;
1371}
1372"""
1373
1374
1375union_member = """\
1376@type@ _pd_@name@;"""
1377
1378union_member_float = """\
1379#ifndef USING_PROXY_FLOAT
1380@type@ _pd_@name@;
1381#else
1382@type@* _pd_@name@;
1383#endif"""
1384
1385union_forward = """\
1386class @name@;
1387"""
1388
1389union_release_array = """\
1390delete [] _pd_@name@;
1391"""
1392
1393union_release_string = """\
1394::CORBA::string_free(_pd_@name@);
1395"""
1396
1397union_release_wstring = """\
1398::CORBA::wstring_free(_pd_@name@);
1399"""
1400
1401union_release_delete = """\
1402delete _pd_@name@;
1403"""
1404
1405union_release_corba_release = """\
1406::CORBA::release(_pd_@name@);
1407"""
1408
1409union_release_helper = """\
1410@helper@::release(_pd_@name@);
1411"""
1412
1413union_release_valuetype = """\
1414if (_pd_@name@)
1415  _pd_@name@->_remove_ref();
1416"""
1417
1418union_release_case = """\
1419@cases@
1420  @release_member@
1421  break;
1422"""
1423
1424union_release_member = """\
1425void _release_member () {
1426  if (!_pd__initialised)
1427    return;
1428
1429  switch(_pd__d) {
1430    @cases@
1431  }
1432  _pd__initialised = 0;
1433}
1434"""
1435
1436union_release_member_empty = """\
1437inline void _release_member () {
1438}
1439"""
1440
1441##
1442## Enum
1443##
1444enum = """\
1445enum @name@ { @memberlist@ /*, __max_@name@=0xffffffff */ };
1446typedef @name@& @name@_out;
1447"""
1448
1449##
1450## Const
1451##
1452const_inclass_isinteger = """\
1453static _core_attr const @type@ @name@ _init_in_cldecl_( = @val@ );
1454"""
1455const_inclass_notinteger = """\
1456static _core_attr const @type@ @name@;
1457"""
1458const_outsideclass_isinteger = """\
1459_CORBA_@where@_VARINT const @type@ @name@ _init_in_decl_( = @val@ );
1460"""
1461const_outsideclass_notinteger = """\
1462_CORBA_@where@_VAR _core_attr const @type@ @name@;
1463"""
1464
1465##
1466## Typecode_ptr
1467##
1468typecode = """\
1469@qualifier@ _dyn_attr const ::CORBA::TypeCode_ptr _tc_@name@;
1470"""
1471
1472
1473##
1474## Operators
1475##
1476any_struct = """\
1477extern void operator<<=(::CORBA::Any& _a, const @fqname@& _s);
1478extern void operator<<=(::CORBA::Any& _a, @fqname@* _sp);
1479extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, @fqname@*& _sp);
1480extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const @fqname@*& _sp);
1481"""
1482
1483any_exception = """\
1484void operator<<=(::CORBA::Any& _a, const @fqname@& _s);
1485void operator<<=(::CORBA::Any& _a, const @fqname@* _sp);
1486_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const @fqname@*& _sp);
1487"""
1488
1489any_union = """\
1490void operator<<=(::CORBA::Any& _a, const @fqname@& _s);
1491void operator<<=(::CORBA::Any& _a, @fqname@* _sp);
1492_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const @fqname@*& _sp);
1493_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, @fqname@*& _sp);
1494"""
1495
1496any_enum = """\
1497void operator<<=(::CORBA::Any& _a, @name@ _s);
1498_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, @name@& _s);
1499"""
1500
1501any_interface = """\
1502void operator<<=(::CORBA::Any& _a, @fqname@_ptr _s);
1503void operator<<=(::CORBA::Any& _a, @fqname@_ptr* _s);
1504_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, @fqname@_ptr& _s);
1505"""
1506
1507any_array_declarator = """\
1508void operator<<=(::CORBA::Any& _a, const @fqname@_forany& _s);
1509_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, @fqname@_forany& _s);
1510"""
1511
1512any_sequence = """\
1513void operator<<=(::CORBA::Any& _a, const @fqname@& _s);
1514void operator<<=(::CORBA::Any& _a, @fqname@* _sp);
1515_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, @fqname@*& _sp);
1516_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const @fqname@*& _sp);
1517"""
1518
1519any_value = """\
1520void operator<<=(::CORBA::Any& _a, @fqname@* _s);
1521void operator<<=(::CORBA::Any& _a, @fqname@** _s);
1522_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, @fqname@*& _s);
1523"""
1524
1525
1526enum_operators = """\
1527inline void operator >>=(@name@ _e, cdrStream& s) {
1528  ::operator>>=((::CORBA::ULong)_e, s);
1529}
1530
1531inline void operator <<= (@name@& _e, cdrStream& s) {
1532  ::CORBA::ULong @private_prefix@_e;
1533  ::operator<<=(@private_prefix@_e,s);
1534  if (@private_prefix@_e <= @last_item@) {
1535    _e = (@name@) @private_prefix@_e;
1536  }
1537  else {
1538    OMNIORB_THROW(MARSHAL,_OMNI_NS(MARSHAL_InvalidEnumValue),
1539                  (::CORBA::CompletionStatus)s.completion());
1540  }
1541}
1542"""
1543
1544
1545##
1546## tie template
1547##
1548tie_template = """\
1549template <class _omniT>
1550class @tie_name@ : public virtual @inherits@
1551{
1552public:
1553  @tie_name@(_omniT& t)
1554    : pd_obj(&t), pd_poa(0), pd_rel(0) {}
1555  @tie_name@(_omniT& t, ::PortableServer::POA_ptr p)
1556    : pd_obj(&t), pd_poa(::PortableServer::POA::_duplicate(p)), pd_rel(0) {}
1557  @tie_name@(_omniT* t, _CORBA_Boolean r=1)
1558    : pd_obj(t), pd_poa(0), pd_rel(r) {}
1559  @tie_name@(_omniT* t, ::PortableServer::POA_ptr p,_CORBA_Boolean r=1)
1560    : pd_obj(t), pd_poa(::PortableServer::POA::_duplicate(p)), pd_rel(r) {}
1561  ~@tie_name@() {
1562    if (pd_poa)  ::CORBA::release(pd_poa);
1563    if (pd_rel)  delete pd_obj;
1564  }
1565
1566  _omniT* _tied_object() { return pd_obj; }
1567
1568  void _tied_object(_omniT& t) {
1569    if (pd_rel)  delete pd_obj;
1570    pd_obj = &t;
1571    pd_rel = 0;
1572  }
1573
1574  void _tied_object(_omniT* t, _CORBA_Boolean r=1) {
1575    if (pd_rel)  delete pd_obj;
1576    pd_obj = t;
1577    pd_rel = r;
1578  }
1579
1580  _CORBA_Boolean _is_owner()        { return pd_rel; }
1581  void _is_owner(_CORBA_Boolean io) { pd_rel = io;   }
1582
1583  ::PortableServer::POA_ptr _default_POA() {
1584    if (!pd_poa)  return ::PortableServer::POA::_the_root_poa();
1585    else          return ::PortableServer::POA::_duplicate(pd_poa);
1586  }
1587
1588  @callables@
1589
1590private:
1591  _omniT*                   pd_obj;
1592  ::PortableServer::POA_ptr pd_poa;
1593  _CORBA_Boolean            pd_rel;
1594};
1595"""
1596
1597tie_template_old = """\
1598template <class _omniT, _CORBA_Boolean release>
1599class @tie_name@ : public virtual @inherits@
1600{
1601public:
1602  @tie_name@(_omniT& t)
1603    : pd_obj(&t), pd_rel(release) {}
1604  @tie_name@(_omniT* t)
1605    : pd_obj(t),  pd_rel(release) {}
1606  ~@tie_name@() {
1607    if (pd_rel)  delete pd_obj;
1608  }
1609
1610  @callables@
1611
1612private:
1613  _omniT*                  pd_obj;
1614  _CORBA_Boolean           pd_rel;
1615};
1616"""
1617