summaryrefslogtreecommitdiff
path: root/cpp/include
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-03-16 18:01:38 +0000
committerAlan Conway <aconway@apache.org>2010-03-16 18:01:38 +0000
commitdb9e84cd3de1e56ae81e0ca6110c164435e7ca5a (patch)
tree8f75a1ffb2fd6bdf3af3a0d7bf337e54d131520a /cpp/include
parent24952dc43e52362d5e16a5dbd795fae7d07a12d0 (diff)
downloadqpid-python-db9e84cd3de1e56ae81e0ca6110c164435e7ca5a.tar.gz
Removed dependencies in qpid/messaging on qpid/client.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@923908 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/qpid/messaging/Address.h2
-rw-r--r--cpp/include/qpid/messaging/Codec.h2
-rw-r--r--cpp/include/qpid/messaging/Connection.h15
-rw-r--r--cpp/include/qpid/messaging/Handle.h71
-rw-r--r--cpp/include/qpid/messaging/ImportExport.h33
-rw-r--r--cpp/include/qpid/messaging/ListContent.h2
-rw-r--r--cpp/include/qpid/messaging/ListView.h2
-rw-r--r--cpp/include/qpid/messaging/MapContent.h2
-rw-r--r--cpp/include/qpid/messaging/MapView.h2
-rw-r--r--cpp/include/qpid/messaging/Message.h6
-rw-r--r--cpp/include/qpid/messaging/Receiver.h27
-rw-r--r--cpp/include/qpid/messaging/Sender.h15
-rw-r--r--cpp/include/qpid/messaging/Session.h34
-rw-r--r--cpp/include/qpid/messaging/Uuid.h2
-rw-r--r--cpp/include/qpid/messaging/Variant.h2
15 files changed, 153 insertions, 64 deletions
diff --git a/cpp/include/qpid/messaging/Address.h b/cpp/include/qpid/messaging/Address.h
index f3ca30bcd4..55befd2d6d 100644
--- a/cpp/include/qpid/messaging/Address.h
+++ b/cpp/include/qpid/messaging/Address.h
@@ -24,7 +24,7 @@
#include <string>
#include "qpid/Exception.h"
#include "qpid/messaging/Variant.h"
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include <ostream>
namespace qpid {
diff --git a/cpp/include/qpid/messaging/Codec.h b/cpp/include/qpid/messaging/Codec.h
index bacec5c786..b9b1cc862a 100644
--- a/cpp/include/qpid/messaging/Codec.h
+++ b/cpp/include/qpid/messaging/Codec.h
@@ -22,7 +22,7 @@
*
*/
#include <string>
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
namespace qpid {
namespace messaging {
diff --git a/cpp/include/qpid/messaging/Connection.h b/cpp/include/qpid/messaging/Connection.h
index e2d1cc2ed4..7f324cea1e 100644
--- a/cpp/include/qpid/messaging/Connection.h
+++ b/cpp/include/qpid/messaging/Connection.h
@@ -22,19 +22,14 @@
*
*/
#include <string>
-#include "qpid/client/ClientImportExport.h"
-#include "qpid/client/Handle.h"
+#include "qpid/messaging/ImportExport.h"
+#include "qpid/messaging/Handle.h"
#include "qpid/messaging/Variant.h"
namespace qpid {
-namespace client {
-
-template <class> class PrivateImplRef;
-
-}
-
namespace messaging {
+template <class> class PrivateImplRef;
class ConnectionImpl;
class Session;
@@ -43,7 +38,7 @@ struct InvalidOptionString : public qpid::Exception
InvalidOptionString(const std::string& msg);
};
-class Connection : public qpid::client::Handle<ConnectionImpl>
+class Connection : public qpid::messaging::Handle<ConnectionImpl>
{
public:
QPID_CLIENT_EXTERN Connection(ConnectionImpl* impl);
@@ -92,7 +87,7 @@ class Connection : public qpid::client::Handle<ConnectionImpl>
QPID_CLIENT_EXTERN Session getSession(const std::string& name) const;
private:
- friend class qpid::client::PrivateImplRef<Connection>;
+ friend class qpid::messaging::PrivateImplRef<Connection>;
};
diff --git a/cpp/include/qpid/messaging/Handle.h b/cpp/include/qpid/messaging/Handle.h
new file mode 100644
index 0000000000..c528c39e19
--- /dev/null
+++ b/cpp/include/qpid/messaging/Handle.h
@@ -0,0 +1,71 @@
+#ifndef QPID_MESSAGING_HANDLE_H
+#define QPID_MESSAGING_HANDLE_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.
+ *
+ */
+
+#include "qpid/messaging/ImportExport.h"
+
+namespace qpid {
+namespace messaging {
+
+template <class> class PrivateImplRef;
+
+/**
+ * A handle is like a pointer: refers to an underlying implementation object.
+ * Copying the handle does not copy the object.
+ *
+ * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the
+ * conversion to bool to test for a null handle.
+ */
+template <class T> class Handle {
+ public:
+
+ /**@return true if handle is valid, i.e. not null. */
+ 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. */
+ QPID_CLIENT_EXTERN bool isNull() const { return !impl; }
+
+ /** Conversion to bool supports idiom if (handle) { handle->... } */
+ QPID_CLIENT_EXTERN operator bool() const { return impl; }
+
+ /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+ QPID_CLIENT_EXTERN bool operator !() const { return !impl; }
+
+ void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+ protected:
+ typedef T Impl;
+ QPID_CLIENT_EXTERN Handle() :impl() {}
+
+ // Not implemented,subclasses must implement.
+ QPID_CLIENT_EXTERN Handle(const Handle&);
+ QPID_CLIENT_EXTERN Handle& operator=(const Handle&);
+
+ Impl* impl;
+
+ friend class PrivateImplRef<T>;
+};
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_HANDLE_H*/
diff --git a/cpp/include/qpid/messaging/ImportExport.h b/cpp/include/qpid/messaging/ImportExport.h
new file mode 100644
index 0000000000..7113b437be
--- /dev/null
+++ b/cpp/include/qpid/messaging/ImportExport.h
@@ -0,0 +1,33 @@
+#ifndef QPID_MESSAGING_IMPORTEXPORT_H
+#define QPID_MESSAGING_IMPORTEXPORT_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) || defined (qpidclient_EXPORTS)
+#define QPID_CLIENT_EXTERN __declspec(dllexport)
+#else
+#define QPID_CLIENT_EXTERN __declspec(dllimport)
+#endif
+#else
+#define QPID_CLIENT_EXTERN
+#endif
+
+#endif /*!QPID_MESSAGING_IMPORTEXPORT_H*/
diff --git a/cpp/include/qpid/messaging/ListContent.h b/cpp/include/qpid/messaging/ListContent.h
index f57a920a88..3db8a8eac6 100644
--- a/cpp/include/qpid/messaging/ListContent.h
+++ b/cpp/include/qpid/messaging/ListContent.h
@@ -21,7 +21,7 @@
* under the License.
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
namespace qpid {
diff --git a/cpp/include/qpid/messaging/ListView.h b/cpp/include/qpid/messaging/ListView.h
index 4970a20072..d7c3536a9c 100644
--- a/cpp/include/qpid/messaging/ListView.h
+++ b/cpp/include/qpid/messaging/ListView.h
@@ -22,7 +22,7 @@
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
namespace qpid {
diff --git a/cpp/include/qpid/messaging/MapContent.h b/cpp/include/qpid/messaging/MapContent.h
index 3a80a38732..78ef51e593 100644
--- a/cpp/include/qpid/messaging/MapContent.h
+++ b/cpp/include/qpid/messaging/MapContent.h
@@ -22,7 +22,7 @@
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
#include <map>
#include <string>
diff --git a/cpp/include/qpid/messaging/MapView.h b/cpp/include/qpid/messaging/MapView.h
index 910dfca5c2..baa999b4ad 100644
--- a/cpp/include/qpid/messaging/MapView.h
+++ b/cpp/include/qpid/messaging/MapView.h
@@ -21,7 +21,7 @@
* under the License.
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
#include <map>
#include <string>
diff --git a/cpp/include/qpid/messaging/Message.h b/cpp/include/qpid/messaging/Message.h
index 30e15d79a3..21404d482b 100644
--- a/cpp/include/qpid/messaging/Message.h
+++ b/cpp/include/qpid/messaging/Message.h
@@ -25,12 +25,9 @@
#include <string>
#include "qpid/messaging/Duration.h"
#include "qpid/messaging/Variant.h"
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
namespace qpid {
-namespace client {
-}
-
namespace messaging {
class Address;
@@ -87,6 +84,7 @@ class Message
QPID_CLIENT_EXTERN const std::string& getContent() const;
QPID_CLIENT_EXTERN std::string& getContent();
+
QPID_CLIENT_EXTERN void setContent(const std::string&);
QPID_CLIENT_EXTERN void setContent(const char* chars, size_t count);
QPID_CLIENT_EXTERN void getContent(std::pair<const char*, size_t>& content) const;
diff --git a/cpp/include/qpid/messaging/Receiver.h b/cpp/include/qpid/messaging/Receiver.h
index bc1f39bfc1..80b58106d7 100644
--- a/cpp/include/qpid/messaging/Receiver.h
+++ b/cpp/include/qpid/messaging/Receiver.h
@@ -22,19 +22,15 @@
*
*/
#include "qpid/Exception.h"
-#include "qpid/client/ClientImportExport.h"
-#include "qpid/client/Handle.h"
+#include "qpid/messaging/ImportExport.h"
+#include "qpid/messaging/Handle.h"
#include "qpid/messaging/Duration.h"
namespace qpid {
-namespace client {
+namespace messaging {
template <class> class PrivateImplRef;
-}
-
-namespace messaging {
-
class Message;
class ReceiverImpl;
class Session;
@@ -42,7 +38,7 @@ class Session;
/**
* Interface through which messages are received.
*/
-class Receiver : public qpid::client::Handle<ReceiverImpl>
+class Receiver : public qpid::messaging::Handle<ReceiverImpl>
{
public:
struct NoMessageAvailable : qpid::Exception {};
@@ -60,14 +56,16 @@ class Receiver : public qpid::client::Handle<ReceiverImpl>
QPID_CLIENT_EXTERN bool get(Message& message, Duration timeout=INFINITE_DURATION);
/**
* Retrieves a message from this receivers local queue, or waits
- * for upto the specified timeout for a message to become
- * available. Throws NoMessageAvailable if there is no
- * message to give after waiting for the specified timeout.
+ * for up to the specified timeout for a message to become
+ * available.
+ *
+ *@exception NoMessageAvailable if there is no message to give
+ * after waiting for the specified timeout.
*/
QPID_CLIENT_EXTERN Message get(Duration timeout=INFINITE_DURATION);
/**
* Retrieves a message for this receivers subscription or waits
- * for upto the specified timeout for one to become
+ * for up to the specified timeout for one to become
* available. Unlike get() this method will check with the server
* that there is no message for the subscription this receiver is
* serving before returning false.
@@ -79,6 +77,9 @@ class Receiver : public qpid::client::Handle<ReceiverImpl>
* available. Unlike get() this method will check with the server
* that there is no message for the subscription this receiver is
* serving before throwing an exception.
+ *
+ *@exception NoMessageAvailable if there is no message to give
+ * after waiting for the specified timeout.
*/
QPID_CLIENT_EXTERN Message fetch(Duration timeout=INFINITE_DURATION);
/**
@@ -123,7 +124,7 @@ class Receiver : public qpid::client::Handle<ReceiverImpl>
QPID_CLIENT_EXTERN Session getSession() const;
private:
- friend class qpid::client::PrivateImplRef<Receiver>;
+ friend class qpid::messaging::PrivateImplRef<Receiver>;
};
}} // namespace qpid::messaging
diff --git a/cpp/include/qpid/messaging/Sender.h b/cpp/include/qpid/messaging/Sender.h
index eb8ccc2f84..b7dd015a55 100644
--- a/cpp/include/qpid/messaging/Sender.h
+++ b/cpp/include/qpid/messaging/Sender.h
@@ -21,27 +21,22 @@
* under the License.
*
*/
-#include "qpid/client/ClientImportExport.h"
-#include "qpid/client/Handle.h"
+#include "qpid/messaging/ImportExport.h"
+#include "qpid/messaging/Handle.h"
#include "qpid/sys/IntegerTypes.h"
#include <string>
namespace qpid {
-namespace client {
-
-template <class> class PrivateImplRef;
-
-}
-
namespace messaging {
+template <class> class PrivateImplRef;
class Message;
class SenderImpl;
class Session;
/**
* Interface through which messages are sent.
*/
-class Sender : public qpid::client::Handle<SenderImpl>
+class Sender : public qpid::messaging::Handle<SenderImpl>
{
public:
QPID_CLIENT_EXTERN Sender(SenderImpl* impl = 0);
@@ -79,7 +74,7 @@ class Sender : public qpid::client::Handle<SenderImpl>
*/
QPID_CLIENT_EXTERN Session getSession() const;
private:
- friend class qpid::client::PrivateImplRef<Sender>;
+ friend class qpid::messaging::PrivateImplRef<Sender>;
};
}} // namespace qpid::messaging
diff --git a/cpp/include/qpid/messaging/Session.h b/cpp/include/qpid/messaging/Session.h
index 87f69f268a..5375b4d346 100644
--- a/cpp/include/qpid/messaging/Session.h
+++ b/cpp/include/qpid/messaging/Session.h
@@ -23,20 +23,15 @@
*/
#include "qpid/Exception.h"
#include "qpid/messaging/Duration.h"
-#include "qpid/client/ClientImportExport.h"
-#include "qpid/client/Handle.h"
+#include "qpid/messaging/ImportExport.h"
+#include "qpid/messaging/Handle.h"
#include "qpid/sys/Time.h"
#include <string>
namespace qpid {
-namespace client {
-
-template <class> class PrivateImplRef;
-
-}
-
namespace messaging {
+template <class> class PrivateImplRef;
class Address;
class Connection;
class Message;
@@ -55,7 +50,7 @@ struct KeyError : qpid::Exception
* A session represents a distinct 'conversation' which can involve
* sending and receiving messages to and from different addresses.
*/
-class Session : public qpid::client::Handle<SessionImpl>
+class Session : public qpid::messaging::Handle<SessionImpl>
{
public:
QPID_CLIENT_EXTERN Session(SessionImpl* impl = 0);
@@ -83,8 +78,8 @@ class Session : public qpid::client::Handle<SessionImpl>
QPID_CLIENT_EXTERN void flush();
/**
- * Returns the number of messages received and waiting to be
- * fetched.
+ * Returns the total number of messages received and waiting to be
+ * fetched by all Receivers belonging to this session.
*/
QPID_CLIENT_EXTERN uint32_t available();
/**
@@ -99,14 +94,15 @@ class Session : public qpid::client::Handle<SessionImpl>
* to the specified timeout waiting for one to arrive. Returns
* true if a message was available at the point of return, in
* which case the passed in receiver reference will be set to the
- * receiver for that message or fals if no message was available.
+ * receiver for that message or false if no message was available.
*/
QPID_CLIENT_EXTERN bool nextReceiver(Receiver&, Duration timeout=INFINITE_DURATION);
/**
* Returns the receiver for the next available message. If there
* are no available messages at present the call will block for up
- * to the specified timeout waiting for one to arrive. Will throw
- * Receiver::NoMessageAvailable if no message became available in
+ * to the specified timeout waiting for one to arrive.
+ *
+ *@exception Receiver::NoMessageAvailable if no message became available in
* time.
*/
QPID_CLIENT_EXTERN Receiver nextReceiver(Duration timeout=INFINITE_DURATION);
@@ -126,13 +122,13 @@ class Session : public qpid::client::Handle<SessionImpl>
QPID_CLIENT_EXTERN Receiver createReceiver(const std::string& address);
/**
- * Returns the sender with the specified name or throws KeyError
- * if there is none for that name.
+ * Returns the sender with the specified name.
+ *@exception KeyError if there is none for that name.
*/
QPID_CLIENT_EXTERN Sender getSender(const std::string& name) const;
/**
- * Returns the receiver with the specified name or throws KeyError
- * if there is none for that name.
+ * Returns the receiver with the specified name.
+ *@exception KeyError if there is none for that name.
*/
QPID_CLIENT_EXTERN Receiver getReceiver(const std::string& name) const;
/**
@@ -142,7 +138,7 @@ class Session : public qpid::client::Handle<SessionImpl>
QPID_CLIENT_EXTERN Connection getConnection() const;
private:
- friend class qpid::client::PrivateImplRef<Session>;
+ friend class qpid::messaging::PrivateImplRef<Session>;
};
}} // namespace qpid::messaging
diff --git a/cpp/include/qpid/messaging/Uuid.h b/cpp/include/qpid/messaging/Uuid.h
index bbc9bd7a97..d83f8495b7 100644
--- a/cpp/include/qpid/messaging/Uuid.h
+++ b/cpp/include/qpid/messaging/Uuid.h
@@ -22,7 +22,7 @@
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include <iosfwd>
#include <string>
diff --git a/cpp/include/qpid/messaging/Variant.h b/cpp/include/qpid/messaging/Variant.h
index 0bf62a9909..51c6bd98fe 100644
--- a/cpp/include/qpid/messaging/Variant.h
+++ b/cpp/include/qpid/messaging/Variant.h
@@ -28,7 +28,7 @@
#include "Uuid.h"
#include "qpid/Exception.h"
#include "qpid/sys/IntegerTypes.h"
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
namespace qpid {
namespace messaging {