sequence implementation
- From: Bowie Owens <bowie owens csiro au>
- To: orbitcpp-list gnome org
- Subject: sequence implementation
- Date: Wed, 26 Mar 2003 12:43:57 +1100
Hi,
I have just checked in a bug report regarding the implementation of
sequences of enums.
http://bugzilla.gnome.org/show_bug.cgi?id=109212
Included in the bug report is a patch that implements
IDLEnum::get_seq_typename.
I have been trying to put together a similar patch to implement sequence
of sequences.
http://bugzilla.gnome.org/show_bug.cgi?id=108644
However, I am stuck because I am not sure what types I should be using
for the member type/sequences. I have attached a patch which shows my
current changes to the orbitcpp-1.3.5 source. Any direction on where to
go from here would be appreciated.
--
Bowie Owens
CSIRO Mathematical & Information Sciences
phone : +61 3 9545 8055
fax : +61 3 9545 8080
mobile : 0425 729 875
email : Bowie Owens csiro au
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/idl-compiler/types/IDLSequence.cc ./orbitcpp/idl-compiler/types/IDLSequence.cc
*** ../orig/orbitcpp-1.3.5/orbitcpp/idl-compiler/types/IDLSequence.cc Sun Mar 16 00:38:36 2003
--- ./orbitcpp/idl-compiler/types/IDLSequence.cc Wed Mar 26 11:56:51 2003
***************
*** 407,413 ****
IDLSequence::get_seq_typename (unsigned int length,
const IDLTypedef *active_typedef) const
{
! #warning "WRITE ME"
}
string
--- 407,436 ----
IDLSequence::get_seq_typename (unsigned int length,
const IDLTypedef *active_typedef) const
{
! string retval;
!
! char *tmp = 0;
! std::string c_member_typename_base = get_c_member_typename (active_typedef);
! std::string::size_type pos = c_member_typename_base.find('*');
! g_assert (pos != std::string::npos);
! c_member_typename_base.replace(pos, 1, "");
! 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 () ,
! c_member_typename_base.c_str (),
! c_member_typename_base.c_str (),
! c_member_typename_base.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;
}
string
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]