qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: [c++]: Sketch of a high-level, protocol independent API
Date Mon, 27 Apr 2009 14:14:10 GMT
Jonathan Robie wrote:
> On the whole, I really like this. Comparing the example programs to the 
> existing examples, I think it does simplify quite a bit.
> 
> A few thoughts:
> 
> 1. Streaming data into or out of messages
> 
> I really want to be able to stream into or out of messages directly.
> 
> Instead of:
> 
>            message_data << "Message " << i;
>            message.setData(message_data.str());
> 
> I would like to be able to do something like:
> 
>            message.getData() << "Message " << i;
> 

The problem here is that there are many different ways that users might want to 
encode their messages. ostream-style streaming as human-readable strings is 
great for demos but quite unlikely for a real application. So I would be 
reluctant to build it into the Message class. I think it's best to keep 
Message's role entirely separate from the business of encoding, so users can 
format their data using any method they like and then attach it to the message.

> 4. I notice you do not use keyword arguments. Is the move away from them 
> intentional? Why?
Keyword arguments are not common in C++. Being mapped directly from the 
protocol, the existing API has functions with a LOT of arguments so the keywords 
are very helpful. However a protocol-neutral API designed for C++ programmers 
should be able to avoid such long argument lists.


Cheers,
Alan.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Mime
View raw message