[omniORB] 2.8.0 changes to sequence_var methods - now non-const.

Dietmar May dcmay@dmis.com
Thu, 6 Jul 2000 16:08:32 -0400


omniORB 2.8.0 generates a non-const "operator->()". 2.7.1 generates a "operator->() const" method.
A similar problem exists with operator[].

These changes (from omniORB 2.7.1) prevent access to data members in const objects.

"const" access seems to be required by the CORBA spec (2.2 and 2.3).

A patch that works within our test cases is to modify src\tool\omniidl2\omniorb2_be\o2be_sequence.cc, line 965:

+  IND(s); s << "inline const " << (const char*) index_ret_type
+            << " operator [] (_CORBA_ULong i) const { ";
+  if( is_seq_of_array )
+    s << "  return (const " << (const char*) index_ret_type
+      << ") ((pd_seq->NP_data())[i]); }\n";
+  else
+    s << "  return (*pd_seq)[i]; }\n";
+  IND(s); s << "inline _Tseq* operator -> () const { return pd_seq; }\n";
-  IND(s); s << "inline _Tseq* operator -> () { return pd_seq; }\n";
  s << "#if defined(__GNUG__) && __GNUG__ == 2 && __GNUC_MINOR__ == 7\n";

Dietmar