You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2010/03/16 19:01:39 UTC
svn commit: r923908 - in /qpid/trunk/qpid/cpp: include/qpid/messaging/
src/qpid/client/amqp0_10/ src/qpid/messaging/
Author: aconway
Date: Tue Mar 16 18:01:38 2010
New Revision: 923908
URL: http://svn.apache.org/viewvc?rev=923908&view=rev
Log:
Removed dependencies in qpid/messaging on qpid/client.
Added:
qpid/trunk/qpid/cpp/include/qpid/messaging/Handle.h (with props)
qpid/trunk/qpid/cpp/include/qpid/messaging/ImportExport.h
- copied, changed from r923845, qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h
qpid/trunk/qpid/cpp/src/qpid/messaging/PrivateImplRef.h (with props)
Modified:
qpid/trunk/qpid/cpp/include/qpid/messaging/Address.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h
qpid/trunk/qpid/cpp/include/qpid/messaging/ListContent.h
qpid/trunk/qpid/cpp/include/qpid/messaging/ListView.h
qpid/trunk/qpid/cpp/include/qpid/messaging/MapContent.h
qpid/trunk/qpid/cpp/include/qpid/messaging/MapView.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Message.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Receiver.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Sender.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Session.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Uuid.h
qpid/trunk/qpid/cpp/include/qpid/messaging/Variant.h
qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp
qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp
qpid/trunk/qpid/cpp/src/qpid/messaging/ConnectionImpl.h
qpid/trunk/qpid/cpp/src/qpid/messaging/Receiver.cpp
qpid/trunk/qpid/cpp/src/qpid/messaging/ReceiverImpl.h
qpid/trunk/qpid/cpp/src/qpid/messaging/Sender.cpp
qpid/trunk/qpid/cpp/src/qpid/messaging/SenderImpl.h
qpid/trunk/qpid/cpp/src/qpid/messaging/Session.cpp
qpid/trunk/qpid/cpp/src/qpid/messaging/SessionImpl.h
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Address.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Address.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Address.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Address.h Tue Mar 16 18:01:38 2010
@@ -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 {
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h Tue Mar 16 18:01:38 2010
@@ -22,7 +22,7 @@
*
*/
#include <string>
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
namespace qpid {
namespace messaging {
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h Tue Mar 16 18:01:38 2010
@@ -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
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::
QPID_CLIENT_EXTERN Session getSession(const std::string& name) const;
private:
- friend class qpid::client::PrivateImplRef<Connection>;
+ friend class qpid::messaging::PrivateImplRef<Connection>;
};
Added: qpid/trunk/qpid/cpp/include/qpid/messaging/Handle.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Handle.h?rev=923908&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Handle.h (added)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Handle.h Tue Mar 16 18:01:38 2010
@@ -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*/
Propchange: qpid/trunk/qpid/cpp/include/qpid/messaging/Handle.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/trunk/qpid/cpp/include/qpid/messaging/Handle.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: qpid/trunk/qpid/cpp/include/qpid/messaging/ImportExport.h (from r923845, qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h)
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/ImportExport.h?p2=qpid/trunk/qpid/cpp/include/qpid/messaging/ImportExport.h&p1=qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h&r1=923845&r2=923908&rev=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Codec.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/ImportExport.h Tue Mar 16 18:01:38 2010
@@ -1,8 +1,7 @@
-#ifndef QPID_MESSAGING_CODEC_H
-#define QPID_MESSAGING_CODEC_H
+#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
@@ -10,35 +9,25 @@
* 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 <string>
-#include "qpid/client/ClientImportExport.h"
-namespace qpid {
-namespace messaging {
-
-class Variant;
-/**
- *
- */
-class Codec
-{
- public:
- QPID_CLIENT_EXTERN virtual ~Codec() {}
- virtual void encode(const Variant&, std::string&) = 0;
- virtual void decode(const std::string&, Variant&) = 0;
- private:
-};
-}} // namespace qpid::messaging
+#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_CODEC_H*/
+#endif /*!QPID_MESSAGING_IMPORTEXPORT_H*/
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/ListContent.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/ListContent.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/ListContent.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/ListContent.h Tue Mar 16 18:01:38 2010
@@ -21,7 +21,7 @@
* under the License.
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
namespace qpid {
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/ListView.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/ListView.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/ListView.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/ListView.h Tue Mar 16 18:01:38 2010
@@ -22,7 +22,7 @@
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
namespace qpid {
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/MapContent.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/MapContent.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/MapContent.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/MapContent.h Tue Mar 16 18:01:38 2010
@@ -22,7 +22,7 @@
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
#include <map>
#include <string>
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/MapView.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/MapView.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/MapView.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/MapView.h Tue Mar 16 18:01:38 2010
@@ -21,7 +21,7 @@
* under the License.
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include "Variant.h"
#include <map>
#include <string>
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Message.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Message.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Message.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Message.h Tue Mar 16 18:01:38 2010
@@ -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;
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Receiver.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Receiver.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Receiver.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Receiver.h Tue Mar 16 18:01:38 2010
@@ -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::Ha
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::Ha
* 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::Ha
QPID_CLIENT_EXTERN Session getSession() const;
private:
- friend class qpid::client::PrivateImplRef<Receiver>;
+ friend class qpid::messaging::PrivateImplRef<Receiver>;
};
}} // namespace qpid::messaging
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Sender.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Sender.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Sender.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Sender.h Tue Mar 16 18:01:38 2010
@@ -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::Hand
*/
QPID_CLIENT_EXTERN Session getSession() const;
private:
- friend class qpid::client::PrivateImplRef<Sender>;
+ friend class qpid::messaging::PrivateImplRef<Sender>;
};
}} // namespace qpid::messaging
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Session.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Session.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Session.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Session.h Tue Mar 16 18:01:38 2010
@@ -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::Han
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::Han
* 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::Han
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::Han
QPID_CLIENT_EXTERN Connection getConnection() const;
private:
- friend class qpid::client::PrivateImplRef<Session>;
+ friend class qpid::messaging::PrivateImplRef<Session>;
};
}} // namespace qpid::messaging
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Uuid.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Uuid.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Uuid.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Uuid.h Tue Mar 16 18:01:38 2010
@@ -22,7 +22,7 @@
*
*/
-#include "qpid/client/ClientImportExport.h"
+#include "qpid/messaging/ImportExport.h"
#include <iosfwd>
#include <string>
Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Variant.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Variant.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Variant.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Variant.h Tue Mar 16 18:01:38 2010
@@ -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 {
Modified: qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp Tue Mar 16 18:01:38 2010
@@ -22,7 +22,7 @@
#include "SessionImpl.h"
#include "SimpleUrlParser.h"
#include "qpid/messaging/Session.h"
-#include "qpid/client/PrivateImplRef.h"
+#include "qpid/messaging/PrivateImplRef.h"
#include "qpid/framing/Uuid.h"
#include "qpid/log/Statement.h"
#include <boost/intrusive_ptr.hpp>
@@ -150,7 +150,7 @@ void ConnectionImpl::close()
boost::intrusive_ptr<SessionImpl> getImplPtr(qpid::messaging::Session& session)
{
return boost::dynamic_pointer_cast<SessionImpl>(
- qpid::client::PrivateImplRef<qpid::messaging::Session>::get(session)
+ qpid::messaging::PrivateImplRef<qpid::messaging::Session>::get(session)
);
}
Modified: qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp Tue Mar 16 18:01:38 2010
@@ -24,7 +24,7 @@
#include "qpid/client/amqp0_10/SenderImpl.h"
#include "qpid/client/amqp0_10/MessageSource.h"
#include "qpid/client/amqp0_10/MessageSink.h"
-#include "qpid/client/PrivateImplRef.h"
+#include "qpid/messaging/PrivateImplRef.h"
#include "qpid/Exception.h"
#include "qpid/log/Statement.h"
#include "qpid/messaging/Address.h"
@@ -114,7 +114,7 @@ void SessionImpl::close()
template <class T, class S> boost::intrusive_ptr<S> getImplPtr(T& t)
{
- return boost::dynamic_pointer_cast<S>(qpid::client::PrivateImplRef<T>::get(t));
+ return boost::dynamic_pointer_cast<S>(qpid::messaging::PrivateImplRef<T>::get(t));
}
template <class T> void getFreeKey(std::string& key, T& map)
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp Tue Mar 16 18:01:38 2010
@@ -23,23 +23,17 @@
#include "qpid/messaging/ConnectionImpl.h"
#include "qpid/messaging/Session.h"
#include "qpid/messaging/SessionImpl.h"
-#include "qpid/client/PrivateImplRef.h"
+#include "qpid/messaging/PrivateImplRef.h"
#include "qpid/client/amqp0_10/ConnectionImpl.h"
#include "qpid/log/Statement.h"
namespace qpid {
-namespace client {
-
-typedef PrivateImplRef<qpid::messaging::Connection> PI;
-
-}
-
namespace messaging {
-using qpid::client::PI;
+typedef PrivateImplRef<qpid::messaging::Connection> PI;
Connection::Connection(ConnectionImpl* impl) { PI::ctor(*this, impl); }
-Connection::Connection(const Connection& c) : qpid::client::Handle<ConnectionImpl>() { PI::copy(*this, c); }
+Connection::Connection(const Connection& c) : Handle<ConnectionImpl>() { PI::copy(*this, c); }
Connection& Connection::operator=(const Connection& c) { return PI::assign(*this, c); }
Connection::~Connection() { PI::dtor(*this); }
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/ConnectionImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/ConnectionImpl.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/ConnectionImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/ConnectionImpl.h Tue Mar 16 18:01:38 2010
@@ -25,9 +25,6 @@
#include "qpid/RefCounted.h"
namespace qpid {
-namespace client {
-}
-
namespace messaging {
class Session;
Added: qpid/trunk/qpid/cpp/src/qpid/messaging/PrivateImplRef.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/PrivateImplRef.h?rev=923908&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/PrivateImplRef.h (added)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/PrivateImplRef.h Tue Mar 16 18:01:38 2010
@@ -0,0 +1,94 @@
+#ifndef QPID_MESSAGING_PRIVATEIMPL_H
+#define QPID_MESSAGING_PRIVATEIMPL_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"
+#include <boost/intrusive_ptr.hpp>
+#include "qpid/RefCounted.h"
+
+namespace qpid {
+namespace messaging {
+
+// FIXME aconway 2009-04-24: details!
+/** @file
+ *
+ * Helper class to implement a class with a private, reference counted
+ * implementation and reference semantics.
+ *
+ * Such classes are used in the public API to hide implementation, they
+ * should. Example of use:
+ *
+ * === Foo.h
+ *
+ * template <class T> PrivateImplRef;
+ * class FooImpl;
+ *
+ * Foo : public Handle<FooImpl> {
+ * public:
+ * Foo(FooImpl* = 0);
+ * Foo(const Foo&);
+ * ~Foo();
+ * Foo& operator=(const Foo&);
+ *
+ * int fooDo(); // and other Foo functions...
+ *
+ * private:
+ * typedef FooImpl Impl;
+ * Impl* impl;
+ * friend class PrivateImplRef<Foo>;
+ *
+ * === Foo.cpp
+ *
+ * typedef PrivateImplRef<Foo> PI;
+ * Foo::Foo(FooImpl* p) { PI::ctor(*this, p); }
+ * Foo::Foo(const Foo& c) : Handle<FooImpl>() { PI::copy(*this, c); }
+ * Foo::~Foo() { PI::dtor(*this); }
+ * Foo& Foo::operator=(const Foo& c) { return PI::assign(*this, c); }
+ *
+ * int foo::fooDo() { return impl->fooDo(); }
+ *
+ */
+template <class T> class PrivateImplRef {
+ public:
+ typedef typename T::Impl Impl;
+ typedef boost::intrusive_ptr<Impl> intrusive_ptr;
+
+ static intrusive_ptr get(const T& t) { return intrusive_ptr(t.impl); }
+
+ static void set(T& t, const intrusive_ptr& p) {
+ if (t.impl == p) return;
+ if (t.impl) boost::intrusive_ptr_release(t.impl);
+ t.impl = p.get();
+ if (t.impl) boost::intrusive_ptr_add_ref(t.impl);
+ }
+
+ // Helper functions to implement the ctor, dtor, copy, assign
+ static void ctor(T& t, Impl* p) { t.impl = p; if (p) boost::intrusive_ptr_add_ref(p); }
+ static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
+ static void dtor(T& t) { if(t.impl) boost::intrusive_ptr_release(t.impl); }
+ static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
+};
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_PRIVATEIMPL_H*/
Propchange: qpid/trunk/qpid/cpp/src/qpid/messaging/PrivateImplRef.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/trunk/qpid/cpp/src/qpid/messaging/PrivateImplRef.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/Receiver.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/Receiver.cpp?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/Receiver.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/Receiver.cpp Tue Mar 16 18:01:38 2010
@@ -22,21 +22,15 @@
#include "qpid/messaging/Message.h"
#include "qpid/messaging/ReceiverImpl.h"
#include "qpid/messaging/Session.h"
-#include "qpid/client/PrivateImplRef.h"
+#include "qpid/messaging/PrivateImplRef.h"
namespace qpid {
-namespace client {
-
-typedef PrivateImplRef<qpid::messaging::Receiver> PI;
-
-}
-
namespace messaging {
-using qpid::client::PI;
+typedef PrivateImplRef<qpid::messaging::Receiver> PI;
Receiver::Receiver(ReceiverImpl* impl) { PI::ctor(*this, impl); }
-Receiver::Receiver(const Receiver& s) : qpid::client::Handle<ReceiverImpl>() { PI::copy(*this, s); }
+Receiver::Receiver(const Receiver& s) : Handle<ReceiverImpl>() { PI::copy(*this, s); }
Receiver::~Receiver() { PI::dtor(*this); }
Receiver& Receiver::operator=(const Receiver& s) { return PI::assign(*this, s); }
bool Receiver::get(Message& message, Duration timeout) { return impl->get(message, timeout); }
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/ReceiverImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/ReceiverImpl.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/ReceiverImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/ReceiverImpl.h Tue Mar 16 18:01:38 2010
@@ -24,9 +24,6 @@
#include "qpid/RefCounted.h"
namespace qpid {
-namespace client {
-}
-
namespace messaging {
class Message;
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/Sender.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/Sender.cpp?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/Sender.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/Sender.cpp Tue Mar 16 18:01:38 2010
@@ -22,21 +22,14 @@
#include "qpid/messaging/Message.h"
#include "qpid/messaging/SenderImpl.h"
#include "qpid/messaging/Session.h"
-#include "qpid/client/PrivateImplRef.h"
+#include "qpid/messaging/PrivateImplRef.h"
namespace qpid {
-namespace client {
-
-typedef PrivateImplRef<qpid::messaging::Sender> PI;
-
-}
-
namespace messaging {
-
-using qpid::client::PI;
+typedef PrivateImplRef<qpid::messaging::Sender> PI;
Sender::Sender(SenderImpl* impl) { PI::ctor(*this, impl); }
-Sender::Sender(const Sender& s) : qpid::client::Handle<SenderImpl>() { PI::copy(*this, s); }
+Sender::Sender(const Sender& s) : qpid::messaging::Handle<SenderImpl>() { PI::copy(*this, s); }
Sender::~Sender() { PI::dtor(*this); }
Sender& Sender::operator=(const Sender& s) { return PI::assign(*this, s); }
void Sender::send(const Message& message) { impl->send(message); }
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/SenderImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/SenderImpl.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/SenderImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/SenderImpl.h Tue Mar 16 18:01:38 2010
@@ -24,9 +24,6 @@
#include "qpid/RefCounted.h"
namespace qpid {
-namespace client {
-}
-
namespace messaging {
class Message;
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/Session.cpp?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/Session.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/Session.cpp Tue Mar 16 18:01:38 2010
@@ -25,21 +25,15 @@
#include "qpid/messaging/Sender.h"
#include "qpid/messaging/Receiver.h"
#include "qpid/messaging/SessionImpl.h"
-#include "qpid/client/PrivateImplRef.h"
+#include "qpid/messaging/PrivateImplRef.h"
namespace qpid {
-namespace client {
-
-typedef PrivateImplRef<qpid::messaging::Session> PI;
-
-}
-
namespace messaging {
-using qpid::client::PI;
+typedef PrivateImplRef<qpid::messaging::Session> PI;
Session::Session(SessionImpl* impl) { PI::ctor(*this, impl); }
-Session::Session(const Session& s) : qpid::client::Handle<SessionImpl>() { PI::copy(*this, s); }
+Session::Session(const Session& s) : Handle<SessionImpl>() { PI::copy(*this, s); }
Session::~Session() { PI::dtor(*this); }
Session& Session::operator=(const Session& s) { return PI::assign(*this, s); }
void Session::commit() { impl->commit(); }
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/SessionImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/SessionImpl.h?rev=923908&r1=923907&r2=923908&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/SessionImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/SessionImpl.h Tue Mar 16 18:01:38 2010
@@ -26,9 +26,6 @@
#include "qpid/messaging/Duration.h"
namespace qpid {
-namespace client {
-}
-
namespace messaging {
class Address;
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org