diff options
author | Gordon Sim <gsim@apache.org> | 2008-04-20 12:10:37 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-04-20 12:10:37 +0000 |
commit | 0637677cf6653256b67c82dcb74f35133601220c (patch) | |
tree | 8507bb8373e8b6dfd8c9b96fcb4b262fd4d61501 /cpp/src/qpid/client/SessionBase.h | |
parent | 48dab065ef526f68a5a7d4c4ba22c5b8b2e2e026 (diff) | |
download | qpid-python-0637677cf6653256b67c82dcb74f35133601220c.tar.gz |
QPID-920: converted c++ client to use final 0-10 protocol
* connection handler converted to using invoker & proxy and updated to final method defs
* SessionCore & ExecutionHandler replace by SessionImpl
* simplified handling of completion & results, removed handling of responses
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@649915 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/SessionBase.h')
-rw-r--r-- | cpp/src/qpid/client/SessionBase.h | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/cpp/src/qpid/client/SessionBase.h b/cpp/src/qpid/client/SessionBase.h index 3565145bb9..54484113b1 100644 --- a/cpp/src/qpid/client/SessionBase.h +++ b/cpp/src/qpid/client/SessionBase.h @@ -29,8 +29,8 @@ #include "qpid/framing/TransferContent.h" #include "qpid/client/Completion.h" #include "qpid/client/ConnectionImpl.h" -#include "qpid/client/Response.h" -#include "qpid/client/SessionCore.h" +#include "qpid/client/Execution.h" +#include "qpid/client/SessionImpl.h" #include "qpid/client/TypedResult.h" #include "qpid/shared_ptr.h" #include <string> @@ -61,8 +61,11 @@ using framing::Uuid; * <em>later</em> function call. * * If you need to notify some extenal agent that some actions have - * been taken (e.g. binding queues to exchanages), you must call - * Session::sync() first, to ensure that all the commands are complete. + * been taken (e.g. binding queues to exchanges), you must ensure that + * the broker has completed the command. In synchronous mode this is + * when the session method for the command returns. In asynchronous + * mode you can call Session::sync(), to ensure that all the commands + * are complete. * * You can freely switch between modes by calling Session::setSynchronous() * @@ -77,6 +80,21 @@ enum SynchronousMode { SYNC=true, ASYNC=false }; class SessionBase { public: + /** + * Instances of this class turn synchronous mode on for the + * duration of their scope (and revert back to async if required + * afterwards). + */ + class ScopedSync + { + SessionBase& session; + const bool change; + public: + ScopedSync(SessionBase& s); + ~ScopedSync(); + }; + + SessionBase(); ~SessionBase(); @@ -110,23 +128,17 @@ class SessionBase /** Close the session */ void close(); - - /** - * Synchronize with the broker. Wait for all commands issued so far in - * the session to complete. - * @see SynchronousMode - */ - void sync(); Execution& getExecution(); + void sync(); typedef framing::TransferContent DefaultContent; protected: - shared_ptr<SessionCore> impl; + shared_ptr<SessionImpl> impl; framing::ProtocolVersion version; friend class Connection; - SessionBase(shared_ptr<SessionCore>); + SessionBase(shared_ptr<SessionImpl>); }; }} // namespace qpid::client |