diff options
| author | Stephen D. Huston <shuston@apache.org> | 2009-03-12 20:55:34 +0000 |
|---|---|---|
| committer | Stephen D. Huston <shuston@apache.org> | 2009-03-12 20:55:34 +0000 |
| commit | 0398410e8894287da530cfb63d6344817445bfc2 (patch) | |
| tree | e4d789cd965f25c8fb0a51e1cf71df0a5330e73b /cpp/src/qpid/client | |
| parent | 47db7ebfc533d2dc8a3dfc3b9d1273730b8779e6 (diff) | |
| download | qpid-python-0398410e8894287da530cfb63d6344817445bfc2.tar.gz | |
Changes to build DLLs instead of static libs on Windows; primarily added decorators to exported names. Fixes QPID-1673
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@753014 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client')
| -rw-r--r-- | cpp/src/qpid/client/ClientImportExport.h | 33 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Connection.h | 27 | ||||
| -rw-r--r-- | cpp/src/qpid/client/ConnectionSettings.h | 7 | ||||
| -rw-r--r-- | cpp/src/qpid/client/FailoverManager.h | 11 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Future.h | 7 | ||||
| -rw-r--r-- | cpp/src/qpid/client/FutureResult.h | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Handle.h | 20 | ||||
| -rw-r--r-- | cpp/src/qpid/client/LocalQueue.h | 15 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Message.h | 19 | ||||
| -rw-r--r-- | cpp/src/qpid/client/MessageListener.h | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/client/MessageReplayTracker.h | 16 | ||||
| -rw-r--r-- | cpp/src/qpid/client/QueueOptions.h | 46 | ||||
| -rw-r--r-- | cpp/src/qpid/client/SessionBase_0_10.h | 31 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Subscription.h | 41 | ||||
| -rw-r--r-- | cpp/src/qpid/client/SubscriptionImpl.h | 37 | ||||
| -rw-r--r-- | cpp/src/qpid/client/SubscriptionManager.h | 49 |
16 files changed, 208 insertions, 158 deletions
diff --git a/cpp/src/qpid/client/ClientImportExport.h b/cpp/src/qpid/client/ClientImportExport.h new file mode 100644 index 0000000000..0e6e5660d6 --- /dev/null +++ b/cpp/src/qpid/client/ClientImportExport.h @@ -0,0 +1,33 @@ +#ifndef QPID_CLIENT_IMPORT_EXPORT_H +#define QPID_CLIENT_IMPORT_EXPORT_H + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) +#if defined(CLIENT_EXPORT) +#define QPID_CLIENT_EXTERN __declspec(dllexport) +#else +#define QPID_CLIENT_EXTERN __declspec(dllimport) +#endif +#else +#define QPID_CLIENT_EXTERN +#endif + +#endif diff --git a/cpp/src/qpid/client/Connection.h b/cpp/src/qpid/client/Connection.h index 03631ef56f..846ac33790 100644 --- a/cpp/src/qpid/client/Connection.h +++ b/cpp/src/qpid/client/Connection.h @@ -24,6 +24,7 @@ #include <map> #include <string> #include "qpid/client/Session.h" +#include "qpid/client/ClientImportExport.h" namespace qpid { @@ -58,9 +59,9 @@ class Connection * Creates a connection object, but does not open the connection. * @see open() */ - Connection(); + QPID_CLIENT_EXTERN Connection(); - ~Connection(); + QPID_CLIENT_EXTERN ~Connection(); /** * Opens a connection to a broker. @@ -79,7 +80,7 @@ class Connection * hosts, where implemented(!), provide namespace partitioning * within a single broker). */ - void open(const std::string& host, int port = 5672, + QPID_CLIENT_EXTERN void open(const std::string& host, int port = 5672, const std::string& uid = "guest", const std::string& pwd = "guest", const std::string& virtualhost = "/", uint16_t maxFrameSize=65535); @@ -101,7 +102,7 @@ class Connection * hosts, where implemented(!), provide namespace partitioning * within a single broker). */ - void open(const Url& url, + QPID_CLIENT_EXTERN void open(const Url& url, const std::string& uid = "guest", const std::string& pwd = "guest", const std::string& virtualhost = "/", uint16_t maxFrameSize=65535); @@ -116,14 +117,14 @@ class Connection * @param settings used for any settings not provided by the URL. * Settings provided by the url (e.g. host, port) are ignored. */ - void open(const Url& url, const ConnectionSettings& settings); + QPID_CLIENT_EXTERN void open(const Url& url, const ConnectionSettings& settings); /** * Opens a connection to a broker. * * @param the settings to use (host, port etc). @see ConnectionSettings. */ - void open(const ConnectionSettings& settings); + QPID_CLIENT_EXTERN void open(const ConnectionSettings& settings); /** * Close the connection. @@ -131,7 +132,7 @@ class Connection * Any further use of this connection (without reopening it) will * not succeed. */ - void close(); + QPID_CLIENT_EXTERN void close(); /** * Create a new session on this connection. Sessions allow @@ -174,23 +175,23 @@ class Connection * If the name is empty (the default) then a unique name will be * chosen using a Universally-unique identifier (UUID) algorithm. */ - Session newSession(const std::string& name=std::string(), uint32_t timeoutSeconds = 0); + QPID_CLIENT_EXTERN Session newSession(const std::string& name=std::string(), uint32_t timeoutSeconds = 0); /** * Resume a suspended session. A session may be resumed * on a different connection to the one that created it. */ - void resume(Session& session); + QPID_CLIENT_EXTERN void resume(Session& session); - bool isOpen() const; + QPID_CLIENT_EXTERN bool isOpen() const; - std::vector<Url> getKnownBrokers(); - void registerFailureCallback ( boost::function<void ()> fn ); + QPID_CLIENT_EXTERN std::vector<Url> getKnownBrokers(); + QPID_CLIENT_EXTERN void registerFailureCallback ( boost::function<void ()> fn ); /** * Return the set of client negotiated settings */ - const ConnectionSettings& getNegotiatedSettings(); + QPID_CLIENT_EXTERN const ConnectionSettings& getNegotiatedSettings(); friend class ConnectionAccess; ///<@internal friend class SessionBase_0_10; ///<@internal diff --git a/cpp/src/qpid/client/ConnectionSettings.h b/cpp/src/qpid/client/ConnectionSettings.h index f60b11a4ab..71fef219b4 100644 --- a/cpp/src/qpid/client/ConnectionSettings.h +++ b/cpp/src/qpid/client/ConnectionSettings.h @@ -25,6 +25,7 @@ #include "qpid/Options.h" #include "qpid/log/Options.h" #include "qpid/Url.h" +#include "qpid/client/ClientImportExport.h" #include <iostream> #include <exception> @@ -42,14 +43,14 @@ namespace client { */ struct ConnectionSettings { - ConnectionSettings(); - virtual ~ConnectionSettings(); + QPID_CLIENT_EXTERN ConnectionSettings(); + QPID_CLIENT_EXTERN virtual ~ConnectionSettings(); /** * Allows socket to be configured; default only sets tcp-nodelay * based on the flag set. Can be overridden. */ - virtual void configureSocket(qpid::sys::Socket&) const; + QPID_CLIENT_EXTERN virtual void configureSocket(qpid::sys::Socket&) const; /** * The protocol used for the connection (defaults to 'tcp') diff --git a/cpp/src/qpid/client/FailoverManager.h b/cpp/src/qpid/client/FailoverManager.h index 8b6eeda8a1..bef5e18840 100644 --- a/cpp/src/qpid/client/FailoverManager.h +++ b/cpp/src/qpid/client/FailoverManager.h @@ -27,6 +27,7 @@ #include "qpid/Exception.h" #include "qpid/client/AsyncSession.h" #include "qpid/sys/Monitor.h" +#include "qpid/client/ClientImportExport.h" #include <vector> namespace qpid { @@ -84,7 +85,7 @@ class FailoverManager * to edit or reorder the list of urls to which reconnection is * attempted */ - FailoverManager(const ConnectionSettings& settings, ReconnectionStrategy* strategy = 0); + QPID_CLIENT_EXTERN FailoverManager(const ConnectionSettings& settings, ReconnectionStrategy* strategy = 0); /** * Return the current connection if open or attept to reconnect to * the specified list of urls. If no list is specified the list of @@ -95,15 +96,15 @@ class FailoverManager * If the full list is tried and all attempts fail, * CannotConnectException is thrown. */ - Connection& connect(std::vector<Url> brokers = std::vector<Url>()); + QPID_CLIENT_EXTERN Connection& connect(std::vector<Url> brokers = std::vector<Url>()); /** * Return the current connection whether open or not */ - Connection& getConnection(); + QPID_CLIENT_EXTERN Connection& getConnection(); /** * Close the current connection */ - void close(); + QPID_CLIENT_EXTERN void close(); /** * Reliably execute the specified command. This involves creating * a session on which to carry out the work of the command, @@ -116,7 +117,7 @@ class FailoverManager * on failover to ensure they continue to use the same logical * connection. */ - void execute(Command&); + QPID_CLIENT_EXTERN void execute(Command&); private: enum State {IDLE, CONNECTING, CANT_CONNECT}; diff --git a/cpp/src/qpid/client/Future.h b/cpp/src/qpid/client/Future.h index 67f39cdf3f..ea01522fe8 100644 --- a/cpp/src/qpid/client/Future.h +++ b/cpp/src/qpid/client/Future.h @@ -30,6 +30,7 @@ #include "FutureCompletion.h" #include "FutureResult.h" #include "SessionImpl.h" +#include "ClientImportExport.h" namespace qpid { namespace client { @@ -54,9 +55,9 @@ public: } } - void wait(SessionImpl& session); - bool isComplete(SessionImpl& session); - void setFutureResult(boost::shared_ptr<FutureResult> r); + QPID_CLIENT_EXTERN void wait(SessionImpl& session); + QPID_CLIENT_EXTERN bool isComplete(SessionImpl& session); + QPID_CLIENT_EXTERN void setFutureResult(boost::shared_ptr<FutureResult> r); }; }} diff --git a/cpp/src/qpid/client/FutureResult.h b/cpp/src/qpid/client/FutureResult.h index e97d80476d..64428c0341 100644 --- a/cpp/src/qpid/client/FutureResult.h +++ b/cpp/src/qpid/client/FutureResult.h @@ -23,6 +23,8 @@ #define _FutureResult_ #include <string> + +#include "ClientImportExport.h" #include "qpid/framing/amqp_framing.h" #include "FutureCompletion.h" @@ -36,7 +38,7 @@ class FutureResult : public FutureCompletion { std::string result; public: - const std::string& getResult(SessionImpl& session) const; + QPID_CLIENT_EXTERN const std::string& getResult(SessionImpl& session) const; void received(const std::string& result); }; diff --git a/cpp/src/qpid/client/Handle.h b/cpp/src/qpid/client/Handle.h index 4fd82b7646..d8b822d0f9 100644 --- a/cpp/src/qpid/client/Handle.h +++ b/cpp/src/qpid/client/Handle.h @@ -22,6 +22,8 @@ * */ +#include "qpid/client/ClientImportExport.h" + namespace qpid { namespace client { @@ -34,23 +36,23 @@ template <class T> class HandlePrivate; */ template <class T> class Handle { public: - ~Handle(); - Handle(const Handle&); - Handle& operator=(const Handle&); + QPID_CLIENT_EXTERN ~Handle(); + QPID_CLIENT_EXTERN Handle(const Handle&); + QPID_CLIENT_EXTERN Handle& operator=(const Handle&); /**@return true if handle is valid, i.e. not null. */ - bool isValid() const { return impl; } + QPID_CLIENT_EXTERN bool isValid() const { return impl; } /**@return true if handle is null. It is an error to call any function on a null handle. */ - bool isNull() const { return !impl; } + QPID_CLIENT_EXTERN bool isNull() const { return !impl; } - operator bool() const { return impl; } - bool operator !() const { return impl; } + QPID_CLIENT_EXTERN operator bool() const { return impl; } + QPID_CLIENT_EXTERN bool operator !() const { return impl; } - void swap(Handle<T>&); + QPID_CLIENT_EXTERN void swap(Handle<T>&); protected: - Handle(T* =0); + QPID_CLIENT_EXTERN Handle(T* =0); T* impl; friend class HandlePrivate<T>; diff --git a/cpp/src/qpid/client/LocalQueue.h b/cpp/src/qpid/client/LocalQueue.h index 30ea00612d..5b739d4303 100644 --- a/cpp/src/qpid/client/LocalQueue.h +++ b/cpp/src/qpid/client/LocalQueue.h @@ -22,6 +22,7 @@ * */ +#include "ClientImportExport.h" #include "qpid/client/Message.h" #include "qpid/client/Subscription.h" #include "qpid/client/Demux.h" @@ -75,16 +76,16 @@ class LocalQueue { * * LocalQueue is an alternative to implementing a MessageListener. */ - LocalQueue(); + QPID_CLIENT_EXTERN LocalQueue(); - ~LocalQueue(); + QPID_CLIENT_EXTERN ~LocalQueue(); /** Wait up to timeout for the next message from the local queue. *@param result Set to the message from the queue. *@param timeout wait up this timeout for a message to appear. *@return true if result was set, false if queue was empty after timeout. */ - bool get(Message& result, sys::Duration timeout=0); + QPID_CLIENT_EXTERN bool get(Message& result, sys::Duration timeout=0); /** Get the next message off the local queue, or wait up to the timeout * for message from the broker queue. @@ -92,16 +93,16 @@ class LocalQueue { *@return message from the queue. *@throw ClosedException if subscription is closed or timeout exceeded. */ - Message get(sys::Duration timeout=sys::TIME_INFINITE); + QPID_CLIENT_EXTERN Message get(sys::Duration timeout=sys::TIME_INFINITE); /** Synonym for get() */ - Message pop(sys::Duration timeout=sys::TIME_INFINITE); + QPID_CLIENT_EXTERN Message pop(sys::Duration timeout=sys::TIME_INFINITE); /** Return true if local queue is empty. */ - bool empty() const; + QPID_CLIENT_EXTERN bool empty() const; /** Number of messages on the local queue */ - size_t size() const; + QPID_CLIENT_EXTERN size_t size() const; private: Demux::QueuePtr queue; diff --git a/cpp/src/qpid/client/Message.h b/cpp/src/qpid/client/Message.h index 3f932efd8b..235e20f97d 100644 --- a/cpp/src/qpid/client/Message.h +++ b/cpp/src/qpid/client/Message.h @@ -25,6 +25,7 @@ #include "qpid/client/Session.h" #include "qpid/framing/MessageTransferBody.h" #include "qpid/framing/TransferContent.h" +#include "qpid/client/ClientImportExport.h" namespace qpid { namespace client { @@ -111,7 +112,7 @@ public: *@param data Data for the message body. *@param routingKey Passed to the exchange that routes the message. */ - Message(const std::string& data=std::string(), + QPID_CLIENT_EXTERN Message(const std::string& data=std::string(), const std::string& routingKey=std::string()); /** The destination of messages sent to the broker is the exchange @@ -119,26 +120,26 @@ public: * the delivery tag identifyig the local subscription (often this * is the name of the subscribed queue.) */ - std::string getDestination() const; + QPID_CLIENT_EXTERN std::string getDestination() const; /** Check the redelivered flag. */ - bool isRedelivered() const; + QPID_CLIENT_EXTERN bool isRedelivered() const; /** Set the redelivered flag. */ - void setRedelivered(bool redelivered); + QPID_CLIENT_EXTERN void setRedelivered(bool redelivered); /** Get a modifyable reference to the message headers. */ - framing::FieldTable& getHeaders(); + QPID_CLIENT_EXTERN framing::FieldTable& getHeaders(); /** Get a non-modifyable reference to the message headers. */ - const framing::FieldTable& getHeaders() const; + QPID_CLIENT_EXTERN const framing::FieldTable& getHeaders() const; ///@internal - const framing::MessageTransferBody& getMethod() const; + QPID_CLIENT_EXTERN const framing::MessageTransferBody& getMethod() const; ///@internal - const framing::SequenceNumber& getId() const; + QPID_CLIENT_EXTERN const framing::SequenceNumber& getId() const; /**@internal for incoming messages */ - Message(const framing::FrameSet& frameset); + QPID_CLIENT_EXTERN Message(const framing::FrameSet& frameset); private: //method and id are only set for received messages: diff --git a/cpp/src/qpid/client/MessageListener.h b/cpp/src/qpid/client/MessageListener.h index 75aad6521b..b86aa10c54 100644 --- a/cpp/src/qpid/client/MessageListener.h +++ b/cpp/src/qpid/client/MessageListener.h @@ -19,6 +19,7 @@ * */ #include <string> +#include "qpid/client/ClientImportExport.h" #ifndef _MessageListener_ #define _MessageListener_ @@ -85,7 +86,7 @@ namespace client { class MessageListener{ public: - virtual ~MessageListener(); + QPID_CLIENT_EXTERN virtual ~MessageListener(); /** Called for each message arriving from the broker. Override * in your own subclass to process messages. diff --git a/cpp/src/qpid/client/MessageReplayTracker.h b/cpp/src/qpid/client/MessageReplayTracker.h index 45b16fb704..280cbae4a5 100644 --- a/cpp/src/qpid/client/MessageReplayTracker.h +++ b/cpp/src/qpid/client/MessageReplayTracker.h @@ -23,7 +23,7 @@ */ #include "AsyncSession.h" #include "Message.h" - +#include "qpid/client/ClientImportExport.h" #include <list> #include <string> @@ -37,13 +37,13 @@ namespace client { class MessageReplayTracker { public: - MessageReplayTracker(uint flushInterval); - void send(const Message& message, const std::string& destination = ""); - void init(AsyncSession session); - void replay(AsyncSession session); - void setFlushInterval(uint interval); - uint getFlushInterval(); - void checkCompletion(); + QPID_CLIENT_EXTERN MessageReplayTracker(uint flushInterval); + QPID_CLIENT_EXTERN void send(const Message& message, const std::string& destination = ""); + QPID_CLIENT_EXTERN void init(AsyncSession session); + QPID_CLIENT_EXTERN void replay(AsyncSession session); + QPID_CLIENT_EXTERN void setFlushInterval(uint interval); + QPID_CLIENT_EXTERN uint getFlushInterval(); + QPID_CLIENT_EXTERN void checkCompletion(); template <class F> void foreach(F& f) { for (std::list<ReplayRecord>::const_iterator i = buffer.begin(); i != buffer.end(); i++) { diff --git a/cpp/src/qpid/client/QueueOptions.h b/cpp/src/qpid/client/QueueOptions.h index d159378198..57d9487217 100644 --- a/cpp/src/qpid/client/QueueOptions.h +++ b/cpp/src/qpid/client/QueueOptions.h @@ -18,6 +18,8 @@ * under the License. * */ + +#include "ClientImportExport.h" #include "qpid/framing/FieldTable.h" #ifndef _QueueOptions_ @@ -36,8 +38,8 @@ enum QueueOrderingPolicy {FIFO, LVQ, LVQ_NO_BROWSE}; class QueueOptions: public framing::FieldTable { public: - QueueOptions(); - virtual ~QueueOptions(); + QPID_CLIENT_EXTERN QueueOptions(); + QPID_CLIENT_EXTERN virtual ~QueueOptions(); /** * Sets the queue sizing policy @@ -51,58 +53,58 @@ class QueueOptions: public framing::FieldTable * @param maxSize Set the max number of bytes for the sizing policies * @param setMaxCount Set the max number of messages for the sizing policies */ - void setSizePolicy(QueueSizePolicy sp, uint64_t maxSize, uint32_t maxCount ); + QPID_CLIENT_EXTERN void setSizePolicy(QueueSizePolicy sp, uint64_t maxSize, uint32_t maxCount ); /** * Enables the persisting of a queue to the store module when a cluster fails down to it's last * node. Does so optimistically. Will start persisting when cluster count >1 again. */ - void setPersistLastNode(); + QPID_CLIENT_EXTERN void setPersistLastNode(); /** * Sets the odering policy on the Queue, default ordering is FIFO. */ - void setOrdering(QueueOrderingPolicy op); + QPID_CLIENT_EXTERN void setOrdering(QueueOrderingPolicy op); /** * Use broker defualt sizing ploicy */ - void clearSizePolicy(); + QPID_CLIENT_EXTERN void clearSizePolicy(); /** * Clear Persist Last Node Policy */ - void clearPersistLastNode(); + QPID_CLIENT_EXTERN void clearPersistLastNode(); /** * get the key used match LVQ in args for message transfer */ - void getLVQKey(std::string& key); + QPID_CLIENT_EXTERN void getLVQKey(std::string& key); /** * Use default odering policy */ - void clearOrdering(); + QPID_CLIENT_EXTERN void clearOrdering(); /** * Turns on event generation for this queue (either enqueue only * or for enqueue and dequeue events); the events can then be * processed by a regsitered broker plugin. */ - void enableQueueEvents(bool enqueueOnly); + QPID_CLIENT_EXTERN void enableQueueEvents(bool enqueueOnly); - static const std::string strMaxCountKey; - static const std::string strMaxSizeKey; - static const std::string strTypeKey; - static const std::string strREJECT; - static const std::string strFLOW_TO_DISK; - static const std::string strRING; - static const std::string strRING_STRICT; - static const std::string strLastValueQueue; - static const std::string strPersistLastNode; - static const std::string strLVQMatchProperty; - static const std::string strLastValueQueueNoBrowse; - static const std::string strQueueEventMode; + static QPID_CLIENT_EXTERN const std::string strMaxCountKey; + static QPID_CLIENT_EXTERN const std::string strMaxSizeKey; + static QPID_CLIENT_EXTERN const std::string strTypeKey; + static QPID_CLIENT_EXTERN const std::string strREJECT; + static QPID_CLIENT_EXTERN const std::string strFLOW_TO_DISK; + static QPID_CLIENT_EXTERN const std::string strRING; + static QPID_CLIENT_EXTERN const std::string strRING_STRICT; + static QPID_CLIENT_EXTERN const std::string strLastValueQueue; + static QPID_CLIENT_EXTERN const std::string strPersistLastNode; + static QPID_CLIENT_EXTERN const std::string strLVQMatchProperty; + static QPID_CLIENT_EXTERN const std::string strLastValueQueueNoBrowse; + static QPID_CLIENT_EXTERN const std::string strQueueEventMode; }; } diff --git a/cpp/src/qpid/client/SessionBase_0_10.h b/cpp/src/qpid/client/SessionBase_0_10.h index 091c977053..3ae21936f6 100644 --- a/cpp/src/qpid/client/SessionBase_0_10.h +++ b/cpp/src/qpid/client/SessionBase_0_10.h @@ -33,6 +33,7 @@ #include "qpid/client/SessionImpl.h" #include "qpid/client/TypedResult.h" #include "qpid/shared_ptr.h" +#include "qpid/client/ClientImportExport.h" #include <string> namespace qpid { @@ -65,19 +66,19 @@ class SessionBase_0_10 { typedef framing::TransferContent DefaultContent; ///@internal - SessionBase_0_10(); - ~SessionBase_0_10(); + QPID_CLIENT_EXTERN SessionBase_0_10(); + QPID_CLIENT_EXTERN ~SessionBase_0_10(); /** Get the next message frame-set from the session. */ - framing::FrameSet::shared_ptr get(); + QPID_CLIENT_EXTERN framing::FrameSet::shared_ptr get(); /** Get the session ID */ - SessionId getId() const; + QPID_CLIENT_EXTERN SessionId getId() const; /** Close the session. * A session is automatically closed when all handles to it are destroyed. */ - void close(); + QPID_CLIENT_EXTERN void close(); /** * Synchronize the session: sync() waits until all commands issued @@ -88,25 +89,25 @@ class SessionBase_0_10 { * AsyncSession::executionSync() directly in the unusual event * that you want to do an asynchronous sync. */ - void sync(); + QPID_CLIENT_EXTERN void sync(); /** Set the timeout for this session. */ - uint32_t timeout(uint32_t seconds); + QPID_CLIENT_EXTERN uint32_t timeout(uint32_t seconds); /** Suspend the session - detach it from its connection */ - void suspend(); + QPID_CLIENT_EXTERN void suspend(); /** Resume a suspended session with a new connection */ - void resume(Connection); + QPID_CLIENT_EXTERN void resume(Connection); /** Get the channel associated with this session */ - uint16_t getChannel() const; + QPID_CLIENT_EXTERN uint16_t getChannel() const; - Execution& getExecution(); - void flush(); - void markCompleted(const framing::SequenceSet& ids, bool notifyPeer); - void markCompleted(const framing::SequenceNumber& id, bool cumulative, bool notifyPeer); - void sendCompletion(); + QPID_CLIENT_EXTERN Execution& getExecution(); + QPID_CLIENT_EXTERN void flush(); + QPID_CLIENT_EXTERN void markCompleted(const framing::SequenceSet& ids, bool notifyPeer); + QPID_CLIENT_EXTERN void markCompleted(const framing::SequenceNumber& id, bool cumulative, bool notifyPeer); + QPID_CLIENT_EXTERN void sendCompletion(); protected: boost::shared_ptr<SessionImpl> impl; diff --git a/cpp/src/qpid/client/Subscription.h b/cpp/src/qpid/client/Subscription.h index 47bb5d42a5..43c6100254 100644 --- a/cpp/src/qpid/client/Subscription.h +++ b/cpp/src/qpid/client/Subscription.h @@ -26,6 +26,7 @@ #include "qpid/client/SubscriptionSettings.h" #include "qpid/client/Handle.h" #include "qpid/client/Message.h" +#include "qpid/client/ClientImportExport.h" namespace qpid { namespace client { @@ -39,74 +40,74 @@ class SubscriptionManager; */ class Subscription : public Handle<SubscriptionImpl> { public: - Subscription(SubscriptionImpl* si=0) : Handle<SubscriptionImpl>(si) {} + QPID_CLIENT_EXTERN Subscription(SubscriptionImpl* si=0) : Handle<SubscriptionImpl>(si) {} - /** The name of the subsctription, used as the "destination" for messages from the broker. + /** The name of the subscription, used as the "destination" for messages from the broker. * Usually the same as the queue name but can be set differently. */ - std::string getName() const; + QPID_CLIENT_EXTERN std::string getName() const; /** Name of the queue this subscription subscribes to */ - std::string getQueue() const; + QPID_CLIENT_EXTERN std::string getQueue() const; /** Get the flow control and acknowledgement settings for this subscription */ - const SubscriptionSettings& getSettings() const; + QPID_CLIENT_EXTERN const SubscriptionSettings& getSettings() const; /** Set the flow control parameters */ - void setFlowControl(const FlowControl&); + QPID_CLIENT_EXTERN void setFlowControl(const FlowControl&); /** Automatically acknowledge (acquire and accept) batches of n messages. * You can disable auto-acknowledgement by setting n=0, and use acquire() and accept() * to manually acquire and accept messages. */ - void setAutoAck(unsigned int n); + QPID_CLIENT_EXTERN void setAutoAck(unsigned int n); /** Get the set of ID's for messages received by this subscription but not yet acquired. * This will always be empty if getSettings().acquireMode=ACQUIRE_MODE_PRE_ACQUIRED */ - SequenceSet getUnacquired() const; + QPID_CLIENT_EXTERN SequenceSet getUnacquired() const; /** Get the set of ID's for messages received by this subscription but not yet accepted. */ - SequenceSet getUnaccepted() const; + QPID_CLIENT_EXTERN SequenceSet getUnaccepted() const; /** Acquire messageIds and remove them from the unacquired set. * oAdd them to the unaccepted set if getSettings().acceptMode == ACCEPT_MODE_EXPLICIT. */ - void acquire(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void acquire(const SequenceSet& messageIds); /** Accept messageIds and remove them from the unaccepted set. *@pre messageIds is a subset of getUnaccepted() */ - void accept(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void accept(const SequenceSet& messageIds); /** Release messageIds and remove them from the unaccepted set. *@pre messageIds is a subset of getUnaccepted() */ - void release(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void release(const SequenceSet& messageIds); /* Acquire a single message */ - void acquire(const Message& m) { acquire(SequenceSet(m.getId())); } + QPID_CLIENT_EXTERN void acquire(const Message& m) { acquire(SequenceSet(m.getId())); } /* Accept a single message */ - void accept(const Message& m) { accept(SequenceSet(m.getId())); } + QPID_CLIENT_EXTERN void accept(const Message& m) { accept(SequenceSet(m.getId())); } /* Release a single message */ - void release(const Message& m) { release(SequenceSet(m.getId())); } + QPID_CLIENT_EXTERN void release(const Message& m) { release(SequenceSet(m.getId())); } /** Get the session associated with this subscription */ - Session getSession() const; + QPID_CLIENT_EXTERN Session getSession() const; /** Get the subscription manager associated with this subscription */ - SubscriptionManager& getSubscriptionManager() const; + QPID_CLIENT_EXTERN SubscriptionManager& getSubscriptionManager() const; /** Cancel the subscription. */ - void cancel(); + QPID_CLIENT_EXTERN void cancel(); /** Grant the specified amount of message credit */ - void grantMessageCredit(uint32_t); + QPID_CLIENT_EXTERN void grantMessageCredit(uint32_t); /** Grant the specified amount of byte credit */ - void grantByteCredit(uint32_t); + QPID_CLIENT_EXTERN void grantByteCredit(uint32_t); friend class SubscriptionManager; }; diff --git a/cpp/src/qpid/client/SubscriptionImpl.h b/cpp/src/qpid/client/SubscriptionImpl.h index 74fbacb951..e2b970ce05 100644 --- a/cpp/src/qpid/client/SubscriptionImpl.h +++ b/cpp/src/qpid/client/SubscriptionImpl.h @@ -30,6 +30,7 @@ #include "qpid/framing/SequenceSet.h" #include "qpid/sys/Mutex.h" #include "qpid/RefCounted.h" +#include "qpid/client/ClientImportExport.h" #include <memory> namespace qpid { @@ -39,62 +40,62 @@ class SubscriptionManager; class SubscriptionImpl : public RefCounted, public MessageListener { public: - SubscriptionImpl(SubscriptionManager&, const std::string& queue, + QPID_CLIENT_EXTERN SubscriptionImpl(SubscriptionManager&, const std::string& queue, const SubscriptionSettings&, const std::string& name, MessageListener* =0); /** The name of the subsctription, used as the "destination" for messages from the broker. * Usually the same as the queue name but can be set differently. */ - std::string getName() const; + QPID_CLIENT_EXTERN std::string getName() const; /** Name of the queue this subscription subscribes to */ - std::string getQueue() const; + QPID_CLIENT_EXTERN std::string getQueue() const; /** Get the flow control and acknowledgement settings for this subscription */ - const SubscriptionSettings& getSettings() const; + QPID_CLIENT_EXTERN const SubscriptionSettings& getSettings() const; /** Set the flow control parameters */ - void setFlowControl(const FlowControl&); + QPID_CLIENT_EXTERN void setFlowControl(const FlowControl&); /** Automatically acknowledge (acquire and accept) batches of n messages. * You can disable auto-acknowledgement by setting n=0, and use acquire() and accept() * to manually acquire and accept messages. */ - void setAutoAck(size_t n); + QPID_CLIENT_EXTERN void setAutoAck(size_t n); /** Get the set of ID's for messages received by this subscription but not yet acquired. * This will always be empty if acquireMode=ACQUIRE_MODE_PRE_ACQUIRED */ - SequenceSet getUnacquired() const; + QPID_CLIENT_EXTERN SequenceSet getUnacquired() const; /** Get the set of ID's for messages acquired by this subscription but not yet accepted. */ - SequenceSet getUnaccepted() const; + QPID_CLIENT_EXTERN SequenceSet getUnaccepted() const; /** Acquire messageIds and remove them from the un-acquired set for the session. */ - void acquire(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void acquire(const SequenceSet& messageIds); /** Accept messageIds and remove them from the un-accepted set for the session. */ - void accept(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void accept(const SequenceSet& messageIds); /** Release messageIds and remove them from the un-accepted set for the session. */ - void release(const SequenceSet& messageIds); + QPID_CLIENT_EXTERN void release(const SequenceSet& messageIds); /** Get the session associated with this subscription */ - Session getSession() const; + QPID_CLIENT_EXTERN Session getSession() const; /** Get the subscription manager associated with this subscription */ - SubscriptionManager& getSubscriptionManager() const; + QPID_CLIENT_EXTERN SubscriptionManager& getSubscriptionManager() const; /** Send subscription request and issue appropriate flow control commands. */ - void subscribe(); + QPID_CLIENT_EXTERN void subscribe(); /** Cancel the subscription. */ - void cancel(); + QPID_CLIENT_EXTERN void cancel(); /** Grant specified credit for this subscription **/ - void grantCredit(framing::message::CreditUnit unit, uint32_t value); + QPID_CLIENT_EXTERN void grantCredit(framing::message::CreditUnit unit, uint32_t value); - void received(Message&); + QPID_CLIENT_EXTERN void received(Message&); /** * Set up demux diversion for messages sent to this subscription @@ -104,7 +105,7 @@ class SubscriptionImpl : public RefCounted, public MessageListener { * Cancel any demux diversion that may have been setup for this * subscription */ - void cancelDiversion(); + QPID_CLIENT_EXTERN void cancelDiversion(); private: diff --git a/cpp/src/qpid/client/SubscriptionManager.h b/cpp/src/qpid/client/SubscriptionManager.h index 6b45092931..91ad2b6d56 100644 --- a/cpp/src/qpid/client/SubscriptionManager.h +++ b/cpp/src/qpid/client/SubscriptionManager.h @@ -30,6 +30,7 @@ #include <qpid/client/LocalQueue.h> #include <qpid/client/Subscription.h> #include <qpid/sys/Runnable.h> +#include <qpid/client/ClientImportExport.h> #include <set> #include <sstream> @@ -97,7 +98,7 @@ class SubscriptionManager : public sys::Runnable { public: /** Create a new SubscriptionManager associated with a session */ - SubscriptionManager(const Session& session); + QPID_CLIENT_EXTERN SubscriptionManager(const Session& session); /** * Subscribe a MessagesListener to receive messages from queue. @@ -110,7 +111,7 @@ class SubscriptionManager : public sys::Runnable *@param settings settings for the subscription. *@param name unique destination name for the subscription, defaults to queue name. */ - Subscription subscribe(MessageListener& listener, + QPID_CLIENT_EXTERN Subscription subscribe(MessageListener& listener, const std::string& queue, const SubscriptionSettings& settings, const std::string& name=std::string()); @@ -125,7 +126,7 @@ class SubscriptionManager : public sys::Runnable *@param name unique destination name for the subscription, defaults to queue name. * If not specified, the queue name is used. */ - Subscription subscribe(LocalQueue& localQueue, + QPID_CLIENT_EXTERN Subscription subscribe(LocalQueue& localQueue, const std::string& queue, const SubscriptionSettings& settings, const std::string& name=std::string()); @@ -141,7 +142,7 @@ class SubscriptionManager : public sys::Runnable *@param name unique destination name for the subscription, defaults to queue name. * If not specified, the queue name is used. */ - Subscription subscribe(MessageListener& listener, + QPID_CLIENT_EXTERN Subscription subscribe(MessageListener& listener, const std::string& queue, const std::string& name=std::string()); @@ -154,7 +155,7 @@ class SubscriptionManager : public sys::Runnable *@param name unique destination name for the subscription, defaults to queue name. * If not specified, the queue name is used. */ - Subscription subscribe(LocalQueue& localQueue, + QPID_CLIENT_EXTERN Subscription subscribe(LocalQueue& localQueue, const std::string& queue, const std::string& name=std::string()); @@ -164,53 +165,53 @@ class SubscriptionManager : public sys::Runnable *@param timeout wait up this timeout for a message to appear. *@return true if result was set, false if no message available after timeout. */ - bool get(Message& result, const std::string& queue, sys::Duration timeout=0); + QPID_CLIENT_EXTERN bool get(Message& result, const std::string& queue, sys::Duration timeout=0); /** Get a single message from a queue. *@param timeout wait up this timeout for a message to appear. *@return message from the queue. *@throw Exception if the timeout is exceeded. */ - Message get(const std::string& queue, sys::Duration timeout=sys::TIME_INFINITE); + QPID_CLIENT_EXTERN Message get(const std::string& queue, sys::Duration timeout=sys::TIME_INFINITE); /** Get a subscription by name. *@throw Exception if not found. */ - Subscription getSubscription(const std::string& name) const; + QPID_CLIENT_EXTERN Subscription getSubscription(const std::string& name) const; /** Cancel a subscription. See also: Subscription.cancel() */ - void cancel(const std::string& name); + QPID_CLIENT_EXTERN void cancel(const std::string& name); /** Deliver messages in the current thread until stop() is called. * Only one thread may be running in a SubscriptionManager at a time. * @see run */ - void run(); + QPID_CLIENT_EXTERN void run(); /** Start a new thread to deliver messages. * Only one thread may be running in a SubscriptionManager at a time. * @see start */ - void start(); + QPID_CLIENT_EXTERN void start(); /** * Wait for the thread started by a call to start() to complete. */ - void wait(); + QPID_CLIENT_EXTERN void wait(); /** If set true, run() will stop when all subscriptions * are cancelled. If false, run will only stop when stop() * is called. True by default. */ - void setAutoStop(bool set=true); + QPID_CLIENT_EXTERN void setAutoStop(bool set=true); /** Stop delivery. Causes run() to return, or the thread started with start() to exit. */ - void stop(); + QPID_CLIENT_EXTERN void stop(); static const uint32_t UNLIMITED=0xFFFFFFFF; /** Set the flow control for a subscription. */ - void setFlowControl(const std::string& name, const FlowControl& flow); + QPID_CLIENT_EXTERN void setFlowControl(const std::string& name, const FlowControl& flow); /** Set the flow control for a subscription. *@param name: name of the subscription. @@ -218,22 +219,22 @@ class SubscriptionManager : public sys::Runnable *@param bytes: byte credit. *@param window: if true use window-based flow control. */ - void setFlowControl(const std::string& name, uint32_t messages, uint32_t bytes, bool window=true); + QPID_CLIENT_EXTERN void setFlowControl(const std::string& name, uint32_t messages, uint32_t bytes, bool window=true); /** Set the default settings for subscribe() calls that don't * include a SubscriptionSettings parameter. */ - void setDefaultSettings(const SubscriptionSettings& s) { defaultSettings = s; } + QPID_CLIENT_EXTERN void setDefaultSettings(const SubscriptionSettings& s) { defaultSettings = s; } /** Get the default settings for subscribe() calls that don't * include a SubscriptionSettings parameter. */ - const SubscriptionSettings& getDefaultSettings() const { return defaultSettings; } + QPID_CLIENT_EXTERN const SubscriptionSettings& getDefaultSettings() const { return defaultSettings; } /** Get the default settings for subscribe() calls that don't * include a SubscriptionSettings parameter. */ - SubscriptionSettings& getDefaultSettings() { return defaultSettings; } + QPID_CLIENT_EXTERN SubscriptionSettings& getDefaultSettings() { return defaultSettings; } /** * Set the default flow control settings for subscribe() calls @@ -243,7 +244,7 @@ class SubscriptionManager : public sys::Runnable *@param bytes: byte credit. *@param window: if true use window-based flow control. */ - void setFlowControl(uint32_t messages, uint32_t bytes, bool window=true) { + QPID_CLIENT_EXTERN void setFlowControl(uint32_t messages, uint32_t bytes, bool window=true) { defaultSettings.flowControl = FlowControl(messages, bytes, window); } @@ -251,16 +252,16 @@ class SubscriptionManager : public sys::Runnable *Set the default accept-mode for subscribe() calls that don't *include a SubscriptionSettings parameter. */ - void setAcceptMode(AcceptMode mode) { defaultSettings.acceptMode = mode; } + QPID_CLIENT_EXTERN void setAcceptMode(AcceptMode mode) { defaultSettings.acceptMode = mode; } /** * Set the default acquire-mode subscribe()s that don't specify SubscriptionSettings. */ - void setAcquireMode(AcquireMode mode) { defaultSettings.acquireMode = mode; } + QPID_CLIENT_EXTERN void setAcquireMode(AcquireMode mode) { defaultSettings.acquireMode = mode; } - void registerFailoverHandler ( boost::function<void ()> fh ); + QPID_CLIENT_EXTERN void registerFailoverHandler ( boost::function<void ()> fh ); - Session getSession() const; + QPID_CLIENT_EXTERN Session getSession() const; private: mutable sys::Mutex lock; |
