00001 #ifndef QPID_CLIENT_SESSIONBASE_H
00002 #define QPID_CLIENT_SESSIONBASE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "qpid/framing/Uuid.h"
00026 #include "qpid/framing/amqp_structs.h"
00027 #include "qpid/framing/ProtocolVersion.h"
00028 #include "qpid/framing/MethodContent.h"
00029 #include "qpid/framing/TransferContent.h"
00030 #include "qpid/client/Completion.h"
00031 #include "qpid/client/ConnectionImpl.h"
00032 #include "qpid/client/Execution.h"
00033 #include "qpid/client/SessionImpl.h"
00034 #include "qpid/client/TypedResult.h"
00035 #include "qpid/shared_ptr.h"
00036 #include <string>
00037
00038 namespace qpid {
00039 namespace client {
00040
00041 using std::string;
00042 using framing::Content;
00043 using framing::FieldTable;
00044 using framing::MethodContent;
00045 using framing::SequenceNumberSet;
00046 using framing::Uuid;
00047
00048 enum CreditUnit { MESSAGE=0, BYTE=1 };
00049
00073 enum SynchronousMode { SYNC=true, ASYNC=false };
00074
00075
00079 class SessionBase
00080 {
00081 public:
00087 class ScopedSync
00088 {
00089 SessionBase& session;
00090 const bool change;
00091 public:
00092 ScopedSync(SessionBase& s);
00093 ~ScopedSync();
00094 };
00095
00096
00097 SessionBase();
00098 ~SessionBase();
00099
00101 framing::FrameSet::shared_ptr get();
00102
00104 Uuid getId() const;
00105
00117 void setSynchronous(SynchronousMode mode);
00118 void setSynchronous(bool set);
00119 bool isSynchronous() const;
00120 SynchronousMode getSynchronous() const;
00121
00126 void suspend();
00127
00129 void close();
00130
00131 Execution& getExecution();
00132 void sync();
00133 void flush();
00134 void markCompleted(const framing::SequenceNumber& id, bool cumulative, bool notifyPeer);
00135 void sendCompletion();
00136
00137 typedef framing::TransferContent DefaultContent;
00138
00139 protected:
00140 shared_ptr<SessionImpl> impl;
00141 framing::ProtocolVersion version;
00142 friend class Connection;
00143 SessionBase(shared_ptr<SessionImpl>);
00144 };
00145
00146 }}
00147
00148 #endif