[omniORB] omniidl: bounded sequences

David Scott djs@uk.research.att.com
Thu, 18 May 2000 17:02:01 +0100 (BST)


On Thu, 18 May 2000, Adriaan Joubert wrote:

> If I have a bounded sequence, e.g.
> 
> typedef sequence<octet,1500> seq_t;
> 
> omniidl does not emit a constructor of the form
> 
>     seq_t (long len, T *value, bool release=0)
>
Thanks for the bug report- this problem has now been fixed. The change
will find its way to the external CVS repository overnight, but since the
patch is small here it is:

--- src/lib/omniORB2/omniidl_be/cxx/header//defs.py	2000/05/04 14:35:02	1.31.2.7
+++ src/lib/omniORB2/omniidl_be/cxx/header//defs.py	2000/05/18 15:36:28
@@ -670,11 +670,14 @@
                 def bounds(bounded = bounded, derivedName = derivedName,
                            element_ptr = element_ptr,
                            templateName = templateName):
-                    if not(bounded):
-                        stream.out(template.sequence_type_bounds,
-                                   name = derivedName,
-                                   element = element_ptr,
-                                   derived = templateName)
+                    if bounded:
+                        ctor_template = template.sequence_bounded_ctors
+                    else:
+                        ctor_template = template.sequence_unbounded_ctors
+                    stream.out(ctor_template,
+                               name = derivedName,
+                               element = element_ptr,
+                               derived = templateName)
                         
                 # output the main sequence definition
                 stream.out(template.sequence_type,
--- src/lib/omniORB2/omniidl_be/cxx/header//template.py	2000/03/20 11:50:20	1.3.2.5
+++ src/lib/omniORB2/omniidl_be/cxx/header//template.py	2000/05/18 15:37:30
@@ -487,11 +487,16 @@
 };
 """
 
-sequence_type_bounds = """\
+sequence_unbounded_ctors = """\
 inline @name@(_CORBA_ULong _max)
   : @derived@(_max) {}
 inline @name@(_CORBA_ULong _max, _CORBA_ULong _len, @element@* _val, _CORBA_Boolean _rel=0)
   : @derived@(_max, _len, _val, _rel) {}
+"""
+
+sequence_bounded_ctors = """\
+inline @name@(_CORBA_ULong _len, @element@* _val, _CORBA_Boolean _rel=0)
+  : @derived@(_len, _val, _rel) {}
 """
 
 sequence_var_array_subscript = """\