After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 109212 - sequence of enum not implemented
sequence of enum not implemented
Status: RESOLVED FIXED
Product: orbit-cpp
Classification: Deprecated
Component: idl-compiler
1.3
Other Linux
: Normal normal
: ---
Assigned To: ÉRDI Gergõ
ÉRDI Gergõ
Depends on:
Blocks:
 
 
Reported: 2003-03-26 00:27 UTC by Bowie Owens
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2



Description Bowie Owens 2003-03-26 00:27:01 UTC
ORBit-cpp 1.3.5 ORBit 2.6.1

IDLEnum needs to redefine get_seq_typename since the implementation it
inherits from IDLSimpleType doesn't work (there are no sequence traits for
enums).

The following patch provides an implementation of IDLEnum::get_seq_typename
which compiles (RedHat Linux 8.0 g++ 3.2) and behaves for simple tests.
Essentially I have added a generic sequence traits class (to
orbit_simple_seq.h) which takes the CPP element type, the C element type,
the C sequence type and the CORBA_Typecode (need for the allocation
routines). IDLEnum::get_seq_typename uses this class template to provide
the traits class needed by Simple{,Un}BoundedSeq.

diff -r -C 3 ../orig/orbitcpp-1.3.5/orbitcpp/idl-compiler/types/IDLEnum.cc
./orbitcpp/idl-compiler/types/IDLEnum.cc
*** ../orig/orbitcpp-1.3.5/orbitcpp/idl-compiler/types/IDLEnum.cc       Thu
Feb  6 07:48:28 2003
--- ./orbitcpp/idl-compiler/types/IDLEnum.cc    Wed Mar 26 11:04:07 2003
***************
*** 66,68 ****
--- 66,94 ----
   
        return result;
  }
+
+ string
+ IDLEnum::get_seq_typename (unsigned int      length,
+                              const IDLTypedef *active_typedef) const
+ {
+       string retval;
+
+       char *tmp = 0;
+       char *traits = g_strdup_printf(IDL_IMPL_NS "::enum_seq_traits< %s,
%s, CORBA_sequence_%s, TC_CORBA_sequence_%s>",
+                                      get_cpp_member_typename ().c_str (),
+                                      get_c_member_typename ().c_str (),
+                                      get_c_member_typename ().c_str (),
+                                      get_c_member_typename ().c_str ());
+       if (length)
+               tmp = g_strdup_printf (IDL_IMPL_NS "::SimpleBoundedSeq< %s,
%d>",
+                                      traits, length);
+       else
+               tmp = g_strdup_printf (IDL_IMPL_NS "::SimpleUnboundedSeq<
%s >",
+                                      traits);
+
+       g_free (traits);
+       retval = tmp;
+       g_free (tmp);
+
+       return retval;
+ }
diff -r -C 3 ../orig/orbitcpp-1.3.5/orbitcpp/idl-compiler/types/IDLEnum.h
./orbitcpp/idl-compiler/types/IDLEnum.h
*** ../orig/orbitcpp-1.3.5/orbitcpp/idl-compiler/types/IDLEnum.h        Thu
Feb  6 07:48:28 2003
--- ./orbitcpp/idl-compiler/types/IDLEnum.h     Tue Mar 25 10:32:57 2003
***************
*** 58,63 ****
--- 58,66 ----
        std::string discr_get_cpp_typename () const {
                return get_fixed_cpp_typename ();
        }
+
+       std::string get_seq_typename (unsigned int      length,
+                              const IDLTypedef *active_typedef) const;
  };
   
  #endif //ORBITCPP_TYPES_IDLENUM
diff -r -C 3 ../orig/orbitcpp-1.3.5/orbitcpp/orb-cpp/orbitcpp_simple_seq.h
./orbitcpp/orb-cpp/orbitcpp_simple_seq.h
*** ../orig/orbitcpp-1.3.5/orbitcpp/orb-cpp/orbitcpp_simple_seq.h       Sun
Feb  9 00:16:01 2003
--- ./orbitcpp/orb-cpp/orbitcpp_simple_seq.h    Wed Mar 26 11:04:23 2003
***************
*** 179,184 ****
--- 179,198 ----
            _length = new_length;
        }
      };
+
+     template <class CPPElem, class CElem, class CElemSeq, CORBA_TypeCode
seq_typecode>
+     struct enum_seq_traits {
+       typedef CPPElem value_t;
+       typedef CElem c_value_t;
+       typedef CElemSeq c_seq_t;
+       static c_seq_t* alloc_c () {
+           return (c_seq_t *)ORBit_small_alloc (seq_typecode);
+       }
+
+       static c_value_t* alloc_c_buf (CORBA::ULong l) {
+           return (c_value_t *)ORBit_small_allocbuf(seq_typecode, l);
+       }
+     };
       
  } // namespace _orbitcpp
Comment 1 Bowie Owens 2003-03-26 21:31:33 UTC
The patch http://bugzilla.gnome.org/showattachment.cgi?attach_id=15219
attached to http://bugzilla.gnome.org/show_bug.cgi?id=108644 includes
the patch inlined above.
Comment 2 ÉRDI Gergõ 2003-03-28 13:00:03 UTC
Fixed as part of #108644