qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject C++ client API
Date Wed, 31 Jan 2007 21:40:05 GMT
Currently the C++ client API is like this:

Connection myConnection;
myConnection.open(...);
Channel myChannel;
myConnection.openChannel(myChannel);
myChannel.dostuff...

I would like to change it to be like this:

Connection::shared_ptr myConnection = Connection::open(...); 
Channel::shared_ptr myChannel = myConnection->open(...channel args);
myChannel->dostuff...

There are two problems with the current approach:
 - constructor creates "lame" objects, need an open() call to make them
useful.
 - Letting user call constructor directly means we can't change the
implementation class, whereas the second approach allows us to return
anything inheriting from the user-visible class.

The former issue is plaguing me right now, allowing channels and
connections in a created-but-useless state makes it more complicated to
get exception behavior during startup/shutdown right.

Any objections to this change?

Cheers,
Alan.


Mime
View raw message