
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Interesting proposals, I agree, lets think big and see what the best mapping could be. Not worry about the old mapping, just make something completely new. Johnny On 08/02/2010 03:59 PM, Jon Biggar wrote:
On 7/22/10 7:57 AM, Mathias Gaunard wrote:
On 14/07/10 22:58, Kevin Heifner wrote:
- IDL string is std::string - IDL sequence and array are std::vector - Java maps them to the same thing
std::vector<octet> object_id(); std::shared_ptr<Object> id_to_reference(const std::vector<octet>&);
Can you use templates? When you take strings/sequences, why not take ranges instead of specific types the user would have to convert to?
YES! YES! YES!
Although it's tricker than you think, because IDL allows you to declare composite types with embedded sequences.
I'd like to see IDL sequences mapped into templates that use trait classes that allow the programmer to use any of the appropriate STL ordered container abstractions (vector, list, deque, or user defined ones) as the underlying storage. IDL sequence classes should also be a sequence container so that <algorithm> works with them.
So something like this:
// IDL struct Foo { long l; string s; };
typedef sequence<Foo> FooSeq;
interface Bar { FooSeq manipulate(in FooSeq arg); };
would map to something like this:
// C++ struct Foo { CORBA::Long l; std::string s; };
template < class Storage = CORBA::ConcreteSequenceStorage<std::vector,Foo>
class FooSeq : public CORBA::AbstractSequence<Foo> { ... };
class Bar : public CORBA::Object { template<class _ResultType = FooSeq<>, class _argType = FooSeq<> > virtual _ResultType manipulate( const CORBA::SequenceInAdapter<_argType> &arg ) = 0; };
// Example client code
Bar mybar = ...; // get from a factory somewhere
FooSeq<> simpleresult, simplearg;
simpleresult = bar->manipulate<>(simplearg);
// or for the more adventurous
typedef FooSeq<CORBA::ConcreteStorage<std::list,Foo> MyFoo; MyFoo myresult MyFoo myarg;
myresult = mybar->manipulate<MyFoo>(arg);
// and perhaps even
typedef CORBA::SequenceResultContainerAdaptor<std::deque,Foo> MyFooResult; std::deque<Foo> myresult2; std::set<Foo> myarg2;
myresult2 = mybar->manipulate<MyFooResult>(myarg2);
Let's think big.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMVtFmAAoJEF6eObUNSFTQL0MH/2TWKdUPgOHw4Nu7HjVkG6uM 4rNYAl+Dx515rBpqHPfFBGmoq9tCnN1621ZzYVVfN6w1jAWRDZyhb3bGKGCqk08b TNckNbq6w0HgF6aRQxcIc+5wk4KbBgCaictIh8XESdc6tbvt7L3u+Pv31ebl8b2Z PGFWQIWMINzfgmu/06tKQwi9BbjPhPktSJAuWtu+Sdl8E2wre/WkQC1h9G2hfQfz 4j2Kp9brJiaj0WO8+KxMdardykC8Uw3vuTPWOHxDnWZLQX3unyttur6kq8TFu1Qu J2kL9eK+sYdpi7Egz35Hm8hQDN81Zmd9bg72N8XtRr+6fvPJQG6WnvDLLXUqBt8= =t+xG -----END PGP SIGNATURE-----