qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [37/50] [abbrv] qpid-proton git commit: NO-JIRA: c++ const correctness and other minor fixes.
Date Fri, 23 Oct 2015 14:36:39 GMT
NO-JIRA: c++ const correctness and other minor fixes.

- Made inspector functions const
- Removed link_prefix, generated generated link names are XXX + "@" + container.id()
- Removed redundant terminus::has_* functions.
- Removed redundant 'acking' class


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cf221b45
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cf221b45
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cf221b45

Branch: refs/heads/go1
Commit: cf221b45793fd1d1e12a4f470483c5b4fc2ad39d
Parents: d72f161
Author: Alan Conway <aconway@redhat.com>
Authored: Tue Oct 20 13:22:09 2015 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Tue Oct 20 14:22:40 2015 -0400

----------------------------------------------------------------------
 examples/cpp/server_direct.cpp                  |  2 +-
 proton-c/bindings/cpp/include/proton/acking.hpp | 50 --------------------
 .../cpp/include/proton/blocking_connection.hpp  |  4 +-
 .../cpp/include/proton/blocking_sender.hpp      |  2 +-
 .../bindings/cpp/include/proton/connection.hpp  | 12 ++---
 .../bindings/cpp/include/proton/container.hpp   | 13 ++---
 proton-c/bindings/cpp/include/proton/data.hpp   |  2 +-
 .../bindings/cpp/include/proton/delivery.hpp    | 12 ++---
 .../bindings/cpp/include/proton/endpoint.hpp    | 20 ++++----
 proton-c/bindings/cpp/include/proton/event.hpp  | 14 +++---
 proton-c/bindings/cpp/include/proton/link.hpp   | 41 +++++++---------
 .../bindings/cpp/include/proton/message.hpp     | 16 ++++---
 .../bindings/cpp/include/proton/reactor.hpp     |  2 +-
 .../cpp/include/proton/request_response.hpp     |  2 +-
 .../bindings/cpp/include/proton/session.hpp     | 14 +++---
 .../bindings/cpp/include/proton/terminus.hpp    | 10 ++--
 .../bindings/cpp/include/proton/transport.hpp   |  2 +-
 .../bindings/cpp/src/blocking_connection.cpp    |  4 +-
 proton-c/bindings/cpp/src/blocking_sender.cpp   |  2 +-
 proton-c/bindings/cpp/src/connection.cpp        | 12 ++---
 proton-c/bindings/cpp/src/container.cpp         |  7 +--
 proton-c/bindings/cpp/src/container_impl.cpp    |  2 +-
 proton-c/bindings/cpp/src/container_impl.hpp    |  1 -
 proton-c/bindings/cpp/src/data.cpp              |  2 +
 proton-c/bindings/cpp/src/delivery.cpp          | 13 ++---
 proton-c/bindings/cpp/src/event.cpp             | 14 +++---
 proton-c/bindings/cpp/src/link.cpp              | 31 ++++++------
 proton-c/bindings/cpp/src/message.cpp           |  4 +-
 proton-c/bindings/cpp/src/messaging_event.cpp   | 12 ++---
 proton-c/bindings/cpp/src/messaging_event.hpp   | 12 ++---
 proton-c/bindings/cpp/src/proton_event.cpp      | 14 +++---
 proton-c/bindings/cpp/src/proton_event.hpp      | 16 +++----
 proton-c/bindings/cpp/src/request_response.cpp  |  2 +-
 proton-c/bindings/cpp/src/session.cpp           |  6 +--
 proton-c/bindings/cpp/src/terminus.cpp          | 10 ++--
 proton-c/bindings/cpp/src/transport.cpp         |  2 +-
 36 files changed, 165 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/examples/cpp/server_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server_direct.cpp b/examples/cpp/server_direct.cpp
index 2b6d8e2..76bb5ad 100644
--- a/examples/cpp/server_direct.cpp
+++ b/examples/cpp/server_direct.cpp
@@ -63,7 +63,7 @@ class server : public proton::messaging_handler {
 
     void on_link_opening(proton::event& e) {
         proton::link& link = e.link();
-        if (link.sender() && link.has_remote_source() && link.remote_source().dynamic()) {
+        if (link.sender() && link.remote_source().dynamic()) {
             link.source().address(generate_address());
             senders[link.source().address()] = link.sender()->ptr();
         }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/acking.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/acking.hpp b/proton-c/bindings/cpp/include/proton/acking.hpp
deleted file mode 100644
index 8a6d75b..0000000
--- a/proton-c/bindings/cpp/include/proton/acking.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef PROTON_CPP_ACKING_H
-#define PROTON_CPP_ACKING_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 "proton/export.hpp"
-#include "proton/delivery.hpp"
-
-namespace proton {
-
-
-/** acking provides simple functions to acknowledge, or settle, a delivery */
-class acking
-{
-  public:
-    /** accept a delivery */
-    PN_CPP_EXTERN virtual void accept(delivery &d);
-    /** reject a delivery */
-    PN_CPP_EXTERN virtual void reject(delivery &d);
-    /** release a delivery. Mark it delivery::MODIFIED if it has already been delivered,
-     * delivery::RELEASED otherwise.
-     */
-    PN_CPP_EXTERN virtual void release(delivery &d, bool delivered=true);
-    /** settle a delivery with the given delivery::state */
-    PN_CPP_EXTERN virtual void settle(delivery &d, delivery::state s = delivery::REJECTED);
-};
-
-
-}
-
-#endif  /*!PROTON_CPP_ACKING_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
index f7787cb..87e9b2e 100644
--- a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
@@ -42,8 +42,8 @@ class blocking_connection
     PN_CPP_EXTERN blocking_connection(const proton::url &url, duration timeout = duration::FOREVER);
     PN_CPP_EXTERN ~blocking_connection();
     PN_CPP_EXTERN void close();
-    PN_CPP_EXTERN duration timeout();
-    PN_CPP_EXTERN class connection& connection();
+    PN_CPP_EXTERN duration timeout() const;
+    PN_CPP_EXTERN class connection& connection() const;
 
   private:
     blocking_connection(const blocking_connection&);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/blocking_sender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_sender.hpp b/proton-c/bindings/cpp/include/proton/blocking_sender.hpp
index 713ae6d..b7c2697 100644
--- a/proton-c/bindings/cpp/include/proton/blocking_sender.hpp
+++ b/proton-c/bindings/cpp/include/proton/blocking_sender.hpp
@@ -42,7 +42,7 @@ class blocking_sender : public blocking_link
     PN_CPP_EXTERN delivery& send(const message &msg);
     PN_CPP_EXTERN delivery& send(const message &msg, duration timeout);
 
-    PN_CPP_EXTERN class sender& sender();
+    PN_CPP_EXTERN class sender& sender() const;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/connection.hpp b/proton-c/bindings/cpp/include/proton/connection.hpp
index c7ce447..efbd549 100644
--- a/proton-c/bindings/cpp/include/proton/connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/connection.hpp
@@ -39,9 +39,9 @@ class connection : public counted_facade<pn_connection_t, connection, endpoint>
 {
   public:
     ///@name getters @{
-    PN_CPP_EXTERN class transport& transport();
-    PN_CPP_EXTERN class container& container();
-    PN_CPP_EXTERN std::string hostname();
+    PN_CPP_EXTERN class transport& transport() const;
+    PN_CPP_EXTERN class container& container() const;
+    PN_CPP_EXTERN std::string host() const;
     ///@}
 
     /** Initiate local open, not complete till messaging_handler::on_connection_opened()
@@ -67,13 +67,13 @@ class connection : public counted_facade<pn_connection_t, connection, endpoint>
     PN_CPP_EXTERN receiver& open_receiver(const std::string &addr, bool dynamic=false, handler *h=0);
 
     /** Return links on this connection matching the state mask. */
-    PN_CPP_EXTERN link_range find_links(endpoint::state mask);
+    PN_CPP_EXTERN link_range find_links(endpoint::state mask) const;
 
     /** Return sessions on this connection matching the state mask. */
-    PN_CPP_EXTERN session_range find_sessions(endpoint::state mask);
+    PN_CPP_EXTERN session_range find_sessions(endpoint::state mask) const;
 
     /** Get the endpoint state */
-    PN_CPP_EXTERN endpoint::state state();
+    PN_CPP_EXTERN endpoint::state state() const;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/container.hpp b/proton-c/bindings/cpp/include/proton/container.hpp
index ddb12e9..059416f 100644
--- a/proton-c/bindings/cpp/include/proton/container.hpp
+++ b/proton-c/bindings/cpp/include/proton/container.hpp
@@ -43,6 +43,9 @@ class container_impl;
 
 /**
  * Top level container for connections and other objects, runs the event loop.
+ *
+ * Note that by default, links belonging to the container have generated link-names
+ * of the form
  */
 class container
 {
@@ -71,16 +74,10 @@ class container
     PN_CPP_EXTERN receiver& open_receiver(const url &);
 
     /// Identifier for the container
-    PN_CPP_EXTERN std::string id();
-
-    /// Set the prefix to be used when generating link names. @see proton::session
-    PN_CPP_EXTERN void link_prefix(const std::string&);
-
-    /// Get the prefix to be used when generating link names. @see proton::session
-    PN_CPP_EXTERN std::string link_prefix();
+    PN_CPP_EXTERN std::string id() const;
 
     /// The reactor associated with this container.
-    PN_CPP_EXTERN class reactor& reactor();
+    PN_CPP_EXTERN class reactor& reactor() const;
 
     // Schedule a timer task event in delay milliseconds.
     PN_CPP_EXTERN task& schedule(int delay, handler *h = 0);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/data.hpp b/proton-c/bindings/cpp/include/proton/data.hpp
index 17e55fb..bbc49c2 100644
--- a/proton-c/bindings/cpp/include/proton/data.hpp
+++ b/proton-c/bindings/cpp/include/proton/data.hpp
@@ -59,7 +59,7 @@ class data : public facade<pn_data_t, data, comparable<data> > {
     PN_CPP_EXTERN class decoder& decoder();
 
     /** Type of the current value*/
-    PN_CPP_EXTERN type_id type() { return decoder().type(); }
+    PN_CPP_EXTERN type_id type() const;
 
     /** Get the current value, don't move the decoder pointer. */
     template<class T> void get(T &t) { decoder() >> t; decoder().backup(); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/delivery.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/delivery.hpp b/proton-c/bindings/cpp/include/proton/delivery.hpp
index 1bd1dea..08389c9 100644
--- a/proton-c/bindings/cpp/include/proton/delivery.hpp
+++ b/proton-c/bindings/cpp/include/proton/delivery.hpp
@@ -43,7 +43,7 @@ class delivery : public counted_facade<pn_delivery_t, delivery> {
     };  // AMQP spec 3.4 delivery State
 
     /** Return true if the delivery has been settled. */
-    PN_CPP_EXTERN bool settled();
+    PN_CPP_EXTERN bool settled() const;
 
     /** Settle the delivery, informs the remote end. */
     PN_CPP_EXTERN void settle();
@@ -72,7 +72,7 @@ class delivery : public counted_facade<pn_delivery_t, delivery> {
      * A delivery is considered readable if it is the current delivery on
      * an incoming link.
      */
-    PN_CPP_EXTERN bool partial();
+    PN_CPP_EXTERN bool partial() const;
 
     /**
      * Check if a delivery is writable.
@@ -80,7 +80,7 @@ class delivery : public counted_facade<pn_delivery_t, delivery> {
      * A delivery is considered writable if it is the current delivery on
      * an outgoing link, and the link has positive credit.
      */
-    PN_CPP_EXTERN bool writable();
+    PN_CPP_EXTERN bool writable() const;
 
     /**
      * Check if a delivery is readable.
@@ -88,7 +88,7 @@ class delivery : public counted_facade<pn_delivery_t, delivery> {
      * A delivery is considered readable if it is the current delivery on
      * an incoming link.
      */
-    PN_CPP_EXTERN bool readable();
+    PN_CPP_EXTERN bool readable() const;
 
     /**
      * Check if a delivery is updated.
@@ -97,7 +97,7 @@ class delivery : public counted_facade<pn_delivery_t, delivery> {
      * new disposition for the delivery. Once a delivery becomes updated,
      * it will remain so until clear() is called.
      */
-    PN_CPP_EXTERN bool updated();
+    PN_CPP_EXTERN bool updated() const;
 
     /**
      * Clear the updated flag for a delivery.
@@ -107,7 +107,7 @@ class delivery : public counted_facade<pn_delivery_t, delivery> {
     /**
      * Get the remote disposition state for a delivery.
      */
-    PN_CPP_EXTERN state remote_state();
+    PN_CPP_EXTERN state remote_state() const;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/endpoint.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/endpoint.hpp b/proton-c/bindings/cpp/include/proton/endpoint.hpp
index 9fb5368..e31fce6 100644
--- a/proton-c/bindings/cpp/include/proton/endpoint.hpp
+++ b/proton-c/bindings/cpp/include/proton/endpoint.hpp
@@ -49,14 +49,14 @@ class endpoint
     typedef int state;
 
     /// endpoint state bit values @{
-    PN_CPP_EXTERN static const int LOCAL_UNINIT;    ///< Local endpoint is un-initialized
-    PN_CPP_EXTERN static const int REMOTE_UNINIT;   ///< Remote endpoint is un-initialized
-    PN_CPP_EXTERN static const int LOCAL_ACTIVE;    ///< Local endpoint is active
-    PN_CPP_EXTERN static const int REMOTE_ACTIVE;   ///< Remote endpoint is active
-    PN_CPP_EXTERN static const int LOCAL_CLOSED;    ///< Local endpoint has been closed
-    PN_CPP_EXTERN static const int REMOTE_CLOSED;   ///< Remote endpoint has been closed
-    PN_CPP_EXTERN static const int LOCAL_MASK;      ///< Mask including all LOCAL_ bits (UNINIT, ACTIVE, CLOSED)
-    PN_CPP_EXTERN static const int REMOTE_MASK;     ///< Mask including all REMOTE_ bits (UNINIT, ACTIVE, CLOSED)
+    PN_CPP_EXTERN static const state LOCAL_UNINIT;    ///< Local endpoint is un-initialized
+    PN_CPP_EXTERN static const state REMOTE_UNINIT;   ///< Remote endpoint is un-initialized
+    PN_CPP_EXTERN static const state LOCAL_ACTIVE;    ///< Local endpoint is active
+    PN_CPP_EXTERN static const state REMOTE_ACTIVE;   ///< Remote endpoint is active
+    PN_CPP_EXTERN static const state LOCAL_CLOSED;    ///< Local endpoint has been closed
+    PN_CPP_EXTERN static const state REMOTE_CLOSED;   ///< Remote endpoint has been closed
+    PN_CPP_EXTERN static const state LOCAL_MASK;      ///< Mask including all LOCAL_ bits (UNINIT, ACTIVE, CLOSED)
+    PN_CPP_EXTERN static const state REMOTE_MASK;     ///< Mask including all REMOTE_ bits (UNINIT, ACTIVE, CLOSED)
     ///@}
 
     // TODO: condition, remote_condition, update_condition, get/handler
@@ -112,11 +112,11 @@ class link_iterator : public iter_base<link, link_iterator> {
   public:
     explicit link_iterator(link* p = 0, endpoint::state s = 0) :
         iter_base(p, s), session_(0) {}
-    explicit link_iterator(const link_iterator& i, session *ssn) :
+    explicit link_iterator(const link_iterator& i, const session *ssn) :
         iter_base(i.ptr_, i.state_), session_(ssn) {}
   private:
     PN_CPP_EXTERN void advance();
-    session* session_;
+    const session* session_;
   friend class iter_base<link, link_iterator>;
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/event.hpp b/proton-c/bindings/cpp/include/proton/event.hpp
index 82f6cb6..65d8c7b 100644
--- a/proton-c/bindings/cpp/include/proton/event.hpp
+++ b/proton-c/bindings/cpp/include/proton/event.hpp
@@ -46,19 +46,19 @@ class event {
     virtual PN_CPP_EXTERN std::string name() const = 0;
 
     /// Get container.
-    virtual PN_CPP_EXTERN class container &container();
+    virtual PN_CPP_EXTERN class container &container() const;
     /// Get connection.
-    virtual PN_CPP_EXTERN class connection &connection();
+    virtual PN_CPP_EXTERN class connection &connection() const;
     /// Get sender @throws error if no sender.
-    virtual PN_CPP_EXTERN class sender& sender();
+    virtual PN_CPP_EXTERN class sender& sender() const;
     /// Get receiver @throws error if no receiver.
-    virtual PN_CPP_EXTERN class receiver& receiver();
+    virtual PN_CPP_EXTERN class receiver& receiver() const;
     /// Get link @throws error if no link.
-    virtual PN_CPP_EXTERN class link& link();
+    virtual PN_CPP_EXTERN class link& link() const;
     /// Get delivey @throws error if no delivery.
-    virtual PN_CPP_EXTERN class delivery& delivery();
+    virtual PN_CPP_EXTERN class delivery& delivery() const;
     /** Get message @throws error if no message. */
-    virtual PN_CPP_EXTERN class message &message();
+    virtual PN_CPP_EXTERN class message &message() const;
 
   protected:
     PN_CPP_EXTERN event();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/link.hpp b/proton-c/bindings/cpp/include/proton/link.hpp
index 4e502e1..b4b40e0 100644
--- a/proton-c/bindings/cpp/include/proton/link.hpp
+++ b/proton-c/bindings/cpp/include/proton/link.hpp
@@ -51,37 +51,32 @@ class link : public counted_facade<pn_link_t, link, endpoint>
 
     /** Return sender if this link is a sender, 0 if not. */
     PN_CPP_EXTERN class sender* sender();
+    PN_CPP_EXTERN const class sender* sender() const;
+
     /** Return receiver if this link is a receiver, 0 if not. */
     PN_CPP_EXTERN class receiver* receiver();
+    PN_CPP_EXTERN const class receiver* receiver() const;
+
     /** Credit available on the link */
-    PN_CPP_EXTERN int credit();
-
-    /** True if link has source */
-    PN_CPP_EXTERN bool has_source();
-    /** True if link has target */
-    PN_CPP_EXTERN bool has_target();
-    /** True if link has remote source */
-    PN_CPP_EXTERN bool has_remote_source();
-    /** True if link has remote target */
-    PN_CPP_EXTERN bool has_remote_target();
-
-    /** Local source of the link. @throw error if !has_source() */
-    PN_CPP_EXTERN terminus& source();
-    /** Local target of the link. @throw error if !has_target() */
-    PN_CPP_EXTERN terminus& target();
-    /** Remote source of the link. @throw error if !has_remote_source() */
-    PN_CPP_EXTERN terminus& remote_source();
-    /** Remote target of the link. @throw error if !has_remote_target() */
-    PN_CPP_EXTERN terminus& remote_target();
+    PN_CPP_EXTERN int credit() const;
+
+    /** Local source of the link. */
+    PN_CPP_EXTERN terminus& source() const;
+    /** Local target of the link. */
+    PN_CPP_EXTERN terminus& target() const;
+    /** Remote source of the link. */
+    PN_CPP_EXTERN terminus& remote_source() const;
+    /** Remote target of the link. */
+    PN_CPP_EXTERN terminus& remote_target() const;
 
     /** Link name */
-    PN_CPP_EXTERN std::string name();
+    PN_CPP_EXTERN std::string name() const;
 
     /** Connection that owns this link */
-    PN_CPP_EXTERN class connection &connection();
+    PN_CPP_EXTERN class connection &connection() const;
 
     /** Session that owns this link */
-    PN_CPP_EXTERN class session &session();
+    PN_CPP_EXTERN class session &session() const;
 
     /** Set a custom handler for this link. */
     PN_CPP_EXTERN void handler(class handler &);
@@ -90,7 +85,7 @@ class link : public counted_facade<pn_link_t, link, endpoint>
     PN_CPP_EXTERN void detach_handler();
 
     /** Get the endpoint state */
-    PN_CPP_EXTERN endpoint::state state();
+    PN_CPP_EXTERN endpoint::state state() const;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/message.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/message.hpp b/proton-c/bindings/cpp/include/proton/message.hpp
index 92086d1..14eb9a8 100644
--- a/proton-c/bindings/cpp/include/proton/message.hpp
+++ b/proton-c/bindings/cpp/include/proton/message.hpp
@@ -56,11 +56,12 @@ class message
     ///@name Message properties
     ///@{
 
-    /// Globally unique identifier, can be an a string, an unsigned long, a uuid or a binary value.
+    ///@ Set message identifier, can be a string, unsigned long, uuid or binary.
     PN_CPP_EXTERN void id(const data& id);
-    /// Globally unique identifier, can be an a string, an unsigned long, a uuid or a binary value.
-    PN_CPP_EXTERN const data& id() const;
+    ///@ Get message identifier
     PN_CPP_EXTERN data& id();
+    ///@ Get message identifier reference, allows modification in-place.
+    PN_CPP_EXTERN const data& id() const;
 
     PN_CPP_EXTERN void user(const std::string &user);
     PN_CPP_EXTERN std::string user() const;
@@ -74,10 +75,11 @@ class message
     PN_CPP_EXTERN void reply_to(const std::string &s);
     PN_CPP_EXTERN std::string reply_to() const;
 
-    /// Correlation identifier, can be an a string, an unsigned long, a uuid or a binary value.
+    /// Get correlation identifier, can be a string, unsigned long, uuid or binary.
     PN_CPP_EXTERN void correlation_id(const data&);
-    /// Correlation identifier, can be an a string, an unsigned long, a uuid or a binary value.
+    /// Get correlation identifier.
     PN_CPP_EXTERN const data& correlation_id() const;
+    /// Get correlation identifier reference, allows modification in-place.
     PN_CPP_EXTERN data& correlation_id();
 
     PN_CPP_EXTERN void content_type(const std::string &s);
@@ -86,8 +88,8 @@ class message
     PN_CPP_EXTERN void content_encoding(const std::string &s);
     PN_CPP_EXTERN std::string content_encoding() const;
 
-    PN_CPP_EXTERN void expiry(amqp_timestamp t);
-    PN_CPP_EXTERN amqp_timestamp expiry() const;
+    PN_CPP_EXTERN void expiry_time(amqp_timestamp t);
+    PN_CPP_EXTERN amqp_timestamp expiry_time() const;
 
     PN_CPP_EXTERN void creation_time(amqp_timestamp t);
     PN_CPP_EXTERN amqp_timestamp creation_time() const;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/reactor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/reactor.hpp b/proton-c/bindings/cpp/include/proton/reactor.hpp
index b9e9427..8508e20 100644
--- a/proton-c/bindings/cpp/include/proton/reactor.hpp
+++ b/proton-c/bindings/cpp/include/proton/reactor.hpp
@@ -56,7 +56,7 @@ class reactor : public facade<pn_reactor_t, reactor> {
     PN_CPP_EXTERN void stop();
 
     /// Identifier for the container
-    PN_CPP_EXTERN std::string id();
+    PN_CPP_EXTERN std::string id() const;
 
     /// Get timeout, process() will return if there is no activity within the timeout.
     PN_CPP_EXTERN duration timeout();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/request_response.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/request_response.hpp b/proton-c/bindings/cpp/include/proton/request_response.hpp
index 9bc4392..957c91a 100644
--- a/proton-c/bindings/cpp/include/proton/request_response.hpp
+++ b/proton-c/bindings/cpp/include/proton/request_response.hpp
@@ -48,7 +48,7 @@ class request_response
      */
     PN_CPP_EXTERN message call(message &request);
     /** Return the dynamic address of our receiver. */
-    PN_CPP_EXTERN std::string reply_to();
+    PN_CPP_EXTERN std::string reply_to() const;
 
   private:
     blocking_connection &connection_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/session.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/session.hpp b/proton-c/bindings/cpp/include/proton/session.hpp
index b3dc446..0e6aa69 100644
--- a/proton-c/bindings/cpp/include/proton/session.hpp
+++ b/proton-c/bindings/cpp/include/proton/session.hpp
@@ -52,19 +52,19 @@ class session : public counted_facade<pn_session_t, session, endpoint>
     PN_CPP_EXTERN void close();
 
     /// Get connection
-    PN_CPP_EXTERN class connection &connection();
+    PN_CPP_EXTERN class connection &connection() const;
 
     /** An un-opened receiver link, you can set link properties before calling open().
      *
-     *@param name must be unique within a container, if empty a unique name is
-     * generated beginning with connection().container().link_prefix()
+     *@param name if specified must be unique, by default the container generates a name
+     * of the form: <hex-digits> + "@" + container.id()
      */
     PN_CPP_EXTERN receiver& create_receiver(const std::string& name=std::string());
 
     /** An un-opened sender link, you can set link properties before calling open().
      *
-     *@param name must be unique within a container, if empty a unique name is
-     * generated beginning with connection().container().link_prefix()
+     *@param name if specified must be unique, by default the container generates a name
+     * of the form: <hex-digits> + "@" + container.id()
      */
     PN_CPP_EXTERN sender& create_sender(const std::string& name=std::string());
 
@@ -75,10 +75,10 @@ class session : public counted_facade<pn_session_t, session, endpoint>
     PN_CPP_EXTERN receiver& open_receiver(const std::string &addr, bool dynamic=false, handler *h=0);
 
     /** Get the endpoint state */
-    PN_CPP_EXTERN endpoint::state state();
+    PN_CPP_EXTERN endpoint::state state() const;
 
     /** Return the links on this session matching the state mask. */
-    PN_CPP_EXTERN link_range find_links(endpoint::state mask);
+    PN_CPP_EXTERN link_range find_links(endpoint::state mask) const;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/terminus.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/terminus.hpp b/proton-c/bindings/cpp/include/proton/terminus.hpp
index e058e84..86b56f7 100644
--- a/proton-c/bindings/cpp/include/proton/terminus.hpp
+++ b/proton-c/bindings/cpp/include/proton/terminus.hpp
@@ -59,15 +59,15 @@ class terminus : public counted_facade<pn_terminus_t, terminus>
         MOVE = PN_DIST_MODE_MOVE
     };
 
-    PN_CPP_EXTERN type_t type();
+    PN_CPP_EXTERN type_t type() const;
     PN_CPP_EXTERN void type(type_t);
-    PN_CPP_EXTERN expiry_policy_t expiry_policy();
+    PN_CPP_EXTERN expiry_policy_t expiry_policy() const;
     PN_CPP_EXTERN void expiry_policy(expiry_policy_t);
-    PN_CPP_EXTERN distribution_mode_t distribution_mode();
+    PN_CPP_EXTERN distribution_mode_t distribution_mode() const;
     PN_CPP_EXTERN void distribution_mode(distribution_mode_t);
-    PN_CPP_EXTERN std::string address();
+    PN_CPP_EXTERN std::string address() const;
     PN_CPP_EXTERN void address(const std::string &);
-    PN_CPP_EXTERN bool dynamic();
+    PN_CPP_EXTERN bool dynamic() const;
     PN_CPP_EXTERN void dynamic(bool);
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/include/proton/transport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/transport.hpp b/proton-c/bindings/cpp/include/proton/transport.hpp
index c909166..3d602b7 100644
--- a/proton-c/bindings/cpp/include/proton/transport.hpp
+++ b/proton-c/bindings/cpp/include/proton/transport.hpp
@@ -36,7 +36,7 @@ class connection;
 class transport : public counted_facade<pn_transport_t, transport>
 {
   public:
-    class connection* connection();
+    class connection* connection() const;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/blocking_connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_connection.cpp b/proton-c/bindings/cpp/src/blocking_connection.cpp
index 6b0308c..d830872 100644
--- a/proton-c/bindings/cpp/src/blocking_connection.cpp
+++ b/proton-c/bindings/cpp/src/blocking_connection.cpp
@@ -32,8 +32,8 @@ blocking_connection::~blocking_connection() {}
 
 void blocking_connection::close() { impl_->close(); }
 
-duration blocking_connection::timeout() { return impl_->container_->reactor().timeout(); }
+duration blocking_connection::timeout() const { return impl_->container_->reactor().timeout(); }
 
-connection& blocking_connection::connection() { return *impl_->connection_; }
+connection& blocking_connection::connection() const { return *impl_->connection_; }
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/blocking_sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_sender.cpp b/proton-c/bindings/cpp/src/blocking_sender.cpp
index 1fca30b..43480d6 100644
--- a/proton-c/bindings/cpp/src/blocking_sender.cpp
+++ b/proton-c/bindings/cpp/src/blocking_sender.cpp
@@ -63,6 +63,6 @@ delivery& blocking_sender::send(const message &msg) {
     return send(msg, connection_.timeout());
 }
 
-sender& blocking_sender::sender() { return *link_->sender(); }
+sender& blocking_sender::sender() const { return *link_->sender(); }
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection.cpp b/proton-c/bindings/cpp/src/connection.cpp
index 19657fd..1b35e03 100644
--- a/proton-c/bindings/cpp/src/connection.cpp
+++ b/proton-c/bindings/cpp/src/connection.cpp
@@ -37,7 +37,7 @@
 
 namespace proton {
 
-transport &connection::transport() {
+transport &connection::transport() const {
     return *transport::cast(pn_connection_transport(pn_cast(this)));
 }
 
@@ -45,19 +45,19 @@ void connection::open() { pn_connection_open(pn_cast(this)); }
 
 void connection::close() { pn_connection_close(pn_cast(this)); }
 
-std::string connection::hostname() {
+std::string connection::host() const {
     return std::string(pn_connection_get_hostname(pn_cast(this)));
 }
 
-container& connection::container() {
+container& connection::container() const {
     return container_context(pn_object_reactor(pn_cast(this)));
 }
 
-link_range connection::find_links(endpoint::state mask)  {
+link_range connection::find_links(endpoint::state mask) const {
     return link_range(link_iterator(link::cast(pn_link_head(pn_cast(this), mask))));
 }
 
-session_range connection::find_sessions(endpoint::state mask) {
+session_range connection::find_sessions(endpoint::state mask) const {
     return session_range(
         session_iterator(session::cast(pn_session_head(pn_cast(this), mask))));
 }
@@ -82,6 +82,6 @@ receiver& connection::open_receiver(const std::string &addr, bool dynamic, handl
     return default_session().open_receiver(addr, dynamic, h);
 }
 
-endpoint::state connection::state() { return pn_connection_state(pn_cast(this)); }
+endpoint::state connection::state() const { return pn_connection_state(pn_cast(this)); }
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container.cpp b/proton-c/bindings/cpp/src/container.cpp
index 9b681b9..13f12d9 100644
--- a/proton-c/bindings/cpp/src/container.cpp
+++ b/proton-c/bindings/cpp/src/container.cpp
@@ -49,9 +49,9 @@ container::~container() {}
 
 connection& container::connect(const url &host, handler *h) { return impl_->connect(host, h); }
 
-reactor &container::reactor() { return *impl_->reactor_; }
+reactor &container::reactor() const { return *impl_->reactor_; }
 
-std::string container::id() { return impl_->id_; }
+std::string container::id() const { return impl_->id_; }
 
 void container::run() { impl_->reactor_->run(); }
 
@@ -67,9 +67,6 @@ acceptor& container::listen(const proton::url &url) {
     return impl_->listen(url);
 }
 
-void container::link_prefix(const std::string& s) { impl_->prefix_ = s; }
-std::string  container::link_prefix() { return impl_->prefix_; }
-
 task& container::schedule(int delay, handler *h) { return impl_->schedule(delay, h); }
 
 } // namespace proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp
index cb32d75..fc97a3e 100644
--- a/proton-c/bindings/cpp/src/container_impl.cpp
+++ b/proton-c/bindings/cpp/src/container_impl.cpp
@@ -186,7 +186,7 @@ acceptor& container_impl::listen(const proton::url& url) {
 std::string container_impl::next_link_name() {
     std::ostringstream s;
     // TODO aconway 2015-09-01: atomic operation
-    s << prefix_ << std::hex << ++link_id_;
+    s << std::hex << ++link_id_ << "@" << id_;
     return s.str();
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/container_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.hpp b/proton-c/bindings/cpp/src/container_impl.hpp
index 76d30fb..ec356e2 100644
--- a/proton-c/bindings/cpp/src/container_impl.hpp
+++ b/proton-c/bindings/cpp/src/container_impl.hpp
@@ -68,7 +68,6 @@ class container_impl
     pn_unique_ptr<handler> flow_controller_;
     std::string id_;
     uint64_t link_id_;
-    std::string prefix_;
 
   friend class container;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/data.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/data.cpp b/proton-c/bindings/cpp/src/data.cpp
index ad82040..53b8c37 100644
--- a/proton-c/bindings/cpp/src/data.cpp
+++ b/proton-c/bindings/cpp/src/data.cpp
@@ -39,6 +39,8 @@ pn_unique_ptr<data> data::create() { return pn_unique_ptr<data>(cast(::pn_data(0
 encoder& data::encoder() { return reinterpret_cast<class encoder&>(*this); }
 decoder& data::decoder() { return reinterpret_cast<class decoder&>(*this); }
 
+type_id data::type() const { return reinterpret_cast<const class decoder&>(*this).type(); }
+
 namespace {
 
 // Compare nodes, return -1 if a<b, 0 if a==b, +1 if a>b

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/delivery.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/delivery.cpp b/proton-c/bindings/cpp/src/delivery.cpp
index b292c70..d02904f 100644
--- a/proton-c/bindings/cpp/src/delivery.cpp
+++ b/proton-c/bindings/cpp/src/delivery.cpp
@@ -24,7 +24,7 @@
 
 namespace proton {
 
-bool delivery::settled() { return pn_delivery_settled(pn_cast(this)); }
+bool delivery::settled() const { return pn_delivery_settled(pn_cast(this)); }
 
 void delivery::settle() { pn_delivery_settle(pn_cast(this)); }
 
@@ -35,10 +35,11 @@ void delivery::settle(delivery::state state) {
     settle();
 }
 
-bool delivery::partial()  { return pn_delivery_partial(pn_cast(this)); }
-bool delivery::readable() { return pn_delivery_readable(pn_cast(this)); }
-bool delivery::writable() { return pn_delivery_writable(pn_cast(this)); }
-bool delivery::updated()  { return pn_delivery_updated(pn_cast(this)); }
+bool delivery::partial()  const { return pn_delivery_partial(pn_cast(this)); }
+bool delivery::readable() const { return pn_delivery_readable(pn_cast(this)); }
+bool delivery::writable() const { return pn_delivery_writable(pn_cast(this)); }
+bool delivery::updated()  const { return pn_delivery_updated(pn_cast(this)); }
+
 void delivery::clear()  { pn_delivery_clear(pn_cast(this)); }
-delivery::state delivery::remote_state() { return state(pn_delivery_remote_state(pn_cast(this))); }
+delivery::state delivery::remote_state() const { return state(pn_delivery_remote_state(pn_cast(this))); }
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/event.cpp b/proton-c/bindings/cpp/src/event.cpp
index 84927c4..d79df33 100644
--- a/proton-c/bindings/cpp/src/event.cpp
+++ b/proton-c/bindings/cpp/src/event.cpp
@@ -38,32 +38,32 @@ event::event() {}
 
 event::~event() {}
 
-container &event::container() {
+container &event::container() const {
     // Subclasses to override as appropriate
     throw error(MSG("No container context for event"));
 }
 
-connection &event::connection() {
+connection &event::connection() const {
     throw error(MSG("No connection context for event"));
 }
 
-sender& event::sender() {
+sender& event::sender() const {
     throw error(MSG("No sender context for event"));
 }
 
-receiver& event::receiver() {
+receiver& event::receiver() const {
     throw error(MSG("No receiver context for event"));
 }
 
-link& event::link() {
+link& event::link() const {
     throw error(MSG("No link context for event"));
 }
 
-delivery& event::delivery() {
+delivery& event::delivery() const {
     throw error(MSG("No link context for event"));
 }
 
-class message &event::message() {
+class message &event::message() const {
     throw error(MSG("No message associated with event"));
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/link.cpp b/proton-c/bindings/cpp/src/link.cpp
index 45c23aa..23345b5 100644
--- a/proton-c/bindings/cpp/src/link.cpp
+++ b/proton-c/bindings/cpp/src/link.cpp
@@ -47,27 +47,30 @@ receiver* link::receiver() {
     return pn_link_is_receiver(pn_cast(this)) ? reinterpret_cast<class receiver*>(this) : 0;
 }
 
-int link::credit() {
-    return pn_link_credit(pn_cast(this));
+const sender* link::sender() const {
+    return pn_link_is_sender(pn_cast(this)) ? reinterpret_cast<const class sender*>(this) : 0;
+}
+
+const receiver* link::receiver() const {
+    return pn_link_is_receiver(pn_cast(this)) ? reinterpret_cast<const class receiver*>(this) : 0;
 }
 
-bool link::has_source() { return pn_link_source(pn_cast(this)); }
-bool link::has_target() { return pn_link_target(pn_cast(this)); }
-bool link::has_remote_source() { return pn_link_remote_source(pn_cast(this)); }
-bool link::has_remote_target() { return pn_link_remote_target(pn_cast(this)); }
+int link::credit() const {
+    return pn_link_credit(pn_cast(this));
+}
 
-terminus& link::source() { return *terminus::cast(pn_link_source(pn_cast(this))); }
-terminus& link::target() { return *terminus::cast(pn_link_target(pn_cast(this))); }
-terminus& link::remote_source() { return *terminus::cast(pn_link_remote_source(pn_cast(this))); }
-terminus& link::remote_target() { return *terminus::cast(pn_link_remote_target(pn_cast(this))); }
+terminus& link::source() const { return *terminus::cast(pn_link_source(pn_cast(this))); }
+terminus& link::target() const { return *terminus::cast(pn_link_target(pn_cast(this))); }
+terminus& link::remote_source() const { return *terminus::cast(pn_link_remote_source(pn_cast(this))); }
+terminus& link::remote_target() const { return *terminus::cast(pn_link_remote_target(pn_cast(this))); }
 
-std::string link::name() { return std::string(pn_link_name(pn_cast(this)));}
+std::string link::name() const { return std::string(pn_link_name(pn_cast(this)));}
 
-class connection &link::connection() {
+class connection &link::connection() const {
     return *connection::cast(pn_session_connection(pn_link_session(pn_cast(this))));
 }
 
-class session &link::session() {
+class session &link::session() const {
     return *session::cast(pn_link_session(pn_cast(this)));
 }
 
@@ -83,5 +86,5 @@ void link::detach_handler() {
     pn_record_set_handler(record, 0);
 }
 
-endpoint::state link::state() { return pn_link_state(pn_cast(this)); }
+endpoint::state link::state() const { return pn_link_state(pn_cast(this)); }
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/message.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/message.cpp b/proton-c/bindings/cpp/src/message.cpp
index b056cd7..79c15b8 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -132,10 +132,10 @@ std::string message::content_encoding() const {
     return s ? std::string(s) : std::string();
 }
 
-void message::expiry(amqp_timestamp t) {
+void message::expiry_time(amqp_timestamp t) {
     pn_message_set_expiry_time(message_, t.milliseconds);
 }
-amqp_timestamp message::expiry() const {
+amqp_timestamp message::expiry_time() const {
     return amqp_timestamp(pn_message_get_expiry_time(message_));
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/messaging_event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_event.cpp b/proton-c/bindings/cpp/src/messaging_event.cpp
index a9347d1..3e59b1c 100644
--- a/proton-c/bindings/cpp/src/messaging_event.cpp
+++ b/proton-c/bindings/cpp/src/messaging_event.cpp
@@ -55,7 +55,7 @@ messaging_event::~messaging_event() {}
 
 messaging_event::event_type messaging_event::type() const { return type_; }
 
-connection &messaging_event::connection() {
+connection &messaging_event::connection() const {
     if (type_ == messaging_event::PROTON)
         return proton_event::connection();
     if (parent_event_)
@@ -63,7 +63,7 @@ connection &messaging_event::connection() {
     throw error(MSG("No connection context for event"));
 }
 
-sender& messaging_event::sender() {
+sender& messaging_event::sender() const {
     if (type_ == messaging_event::PROTON)
         return proton_event::sender();
     if (parent_event_)
@@ -71,7 +71,7 @@ sender& messaging_event::sender() {
     throw error(MSG("No sender context for event"));
 }
 
-receiver& messaging_event::receiver() {
+receiver& messaging_event::receiver() const {
     if (type_ == messaging_event::PROTON)
         return proton_event::receiver();
     if (parent_event_)
@@ -79,7 +79,7 @@ receiver& messaging_event::receiver() {
     throw error(MSG("No receiver context for event"));
 }
 
-link& messaging_event::link() {
+link& messaging_event::link() const {
     if (type_ == messaging_event::PROTON)
         return proton_event::link();
     if (parent_event_)
@@ -87,7 +87,7 @@ link& messaging_event::link() {
     throw error(MSG("No link context for event"));
 }
 
-delivery& messaging_event::delivery() {
+delivery& messaging_event::delivery() const {
     if (type_ == messaging_event::PROTON)
         return proton_event::delivery();
     if (parent_event_)
@@ -95,7 +95,7 @@ delivery& messaging_event::delivery() {
     throw error(MSG("No delivery context for event"));
 }
 
-message &messaging_event::message() {
+message &messaging_event::message() const {
     if (type_ != messaging_event::MESSAGE || !parent_event_)
         throw error(MSG("event type does not provide message"));
     return *message_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/messaging_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_event.hpp b/proton-c/bindings/cpp/src/messaging_event.hpp
index 1f73477..84cf3f3 100644
--- a/proton-c/bindings/cpp/src/messaging_event.hpp
+++ b/proton-c/bindings/cpp/src/messaging_event.hpp
@@ -88,12 +88,12 @@ class messaging_event : public proton_event
     ~messaging_event();
 
     virtual PN_CPP_EXTERN void dispatch(handler &h);
-    virtual PN_CPP_EXTERN class connection &connection();
-    virtual PN_CPP_EXTERN class sender& sender();
-    virtual PN_CPP_EXTERN class receiver& receiver();
-    virtual PN_CPP_EXTERN class link& link();
-    virtual PN_CPP_EXTERN class delivery& delivery();
-    virtual PN_CPP_EXTERN class message& message();
+    virtual PN_CPP_EXTERN class connection &connection() const;
+    virtual PN_CPP_EXTERN class sender& sender() const;
+    virtual PN_CPP_EXTERN class receiver& receiver() const;
+    virtual PN_CPP_EXTERN class link& link() const;
+    virtual PN_CPP_EXTERN class delivery& delivery() const;
+    virtual PN_CPP_EXTERN class message& message() const;
 
     PN_CPP_EXTERN event_type type() const;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/proton_event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_event.cpp b/proton-c/bindings/cpp/src/proton_event.cpp
index 80e678e..649d908 100644
--- a/proton-c/bindings/cpp/src/proton_event.cpp
+++ b/proton-c/bindings/cpp/src/proton_event.cpp
@@ -46,34 +46,34 @@ int proton_event::type() const { return type_; }
 
 std::string proton_event::name() const { return pn_event_type_name(pn_event_type_t(type_)); }
 
-pn_event_t *proton_event::pn_event() { return pn_event_; }
+pn_event_t *proton_event::pn_event() const { return pn_event_; }
 
-container &proton_event::container() { return container_; }
+container &proton_event::container() const { return container_; }
 
-connection &proton_event::connection() {
+connection &proton_event::connection() const {
     pn_connection_t *conn = pn_event_connection(pn_event());
     if (!conn)
         throw error(MSG("No connection context for this event"));
     return *connection::cast(conn);
 }
 
-link& proton_event::link() {
+link& proton_event::link() const {
     class link *lnk = link::cast(pn_event_link(pn_event()));
     if (!lnk) throw error(MSG("No link context for this event"));
     return *lnk;
 }
 
-sender& proton_event::sender() {
+sender& proton_event::sender() const {
     if (!link().sender()) throw error(MSG("No sender context for this event"));
     return *link().sender();
 }
 
-receiver& proton_event::receiver() {
+receiver& proton_event::receiver() const {
     if (!link().receiver()) throw error(MSG("No receiver context for this event"));
     return *link().receiver();
 }
 
-delivery& proton_event::delivery() {
+delivery& proton_event::delivery() const {
     class delivery *dlv = delivery::cast(pn_event_delivery(pn_event()));
     if (!dlv) throw error(MSG("No delivery context for this event"));
     return *dlv;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/proton_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_event.hpp b/proton-c/bindings/cpp/src/proton_event.hpp
index f71af55..66b8ed9 100644
--- a/proton-c/bindings/cpp/src/proton_event.hpp
+++ b/proton-c/bindings/cpp/src/proton_event.hpp
@@ -273,22 +273,22 @@ class proton_event : public event
     ///@}
 
     virtual PN_CPP_EXTERN void dispatch(handler &h);
-    virtual PN_CPP_EXTERN class container &container();
-    virtual PN_CPP_EXTERN class connection &connection();
-    virtual PN_CPP_EXTERN class sender& sender();
-    virtual PN_CPP_EXTERN class receiver& receiver();
-    virtual PN_CPP_EXTERN class link& link();
-    virtual PN_CPP_EXTERN class delivery& delivery();
+    virtual PN_CPP_EXTERN class container &container() const;
+    virtual PN_CPP_EXTERN class connection &connection() const;
+    virtual PN_CPP_EXTERN class sender& sender() const;
+    virtual PN_CPP_EXTERN class receiver& receiver() const;
+    virtual PN_CPP_EXTERN class link& link() const;
+    virtual PN_CPP_EXTERN class delivery& delivery() const;
 
     /** Get type of event */
     PN_CPP_EXTERN event_type type() const;
 
-    PN_CPP_EXTERN pn_event_t* pn_event();
+    PN_CPP_EXTERN pn_event_t* pn_event() const;
 
   protected:
     PN_CPP_EXTERN proton_event(pn_event_t *ce, proton_event::event_type t, class container &c);
   private:
-    pn_event_t *pn_event_;
+    mutable pn_event_t *pn_event_;
     event_type type_;
     class container &container_;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/request_response.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/request_response.cpp b/proton-c/bindings/cpp/src/request_response.cpp
index 9b8207c..38a701c 100644
--- a/proton-c/bindings/cpp/src/request_response.cpp
+++ b/proton-c/bindings/cpp/src/request_response.cpp
@@ -50,7 +50,7 @@ message request_response::call(message &request) {
     return response;
 }
 
-std::string request_response::reply_to() {
+std::string request_response::reply_to() const {
     return receiver_->receiver().remote_source().address();
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/session.cpp b/proton-c/bindings/cpp/src/session.cpp
index 468e4b8..6d0d955 100644
--- a/proton-c/bindings/cpp/src/session.cpp
+++ b/proton-c/bindings/cpp/src/session.cpp
@@ -33,7 +33,7 @@ void session::open() {
     pn_session_open(pn_cast(this));
 }
 
-connection &session::connection() {
+connection &session::connection() const {
     return *proton::connection::cast(pn_session_connection(pn_cast(this)));
 }
 
@@ -74,9 +74,9 @@ receiver& session::open_receiver(const std::string &addr, bool dynamic, handler
     return rcv;
 }
 
-endpoint::state session::state() { return pn_session_state(pn_cast(this)); }
+endpoint::state session::state() const { return pn_session_state(pn_cast(this)); }
 
-link_range session::find_links(endpoint::state mask)  {
+link_range session::find_links(endpoint::state mask)  const {
     link_range r(connection().find_links(mask));
     link_iterator i(r.begin(), this);
     if (i && this != &i->session())

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/terminus.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/terminus.cpp b/proton-c/bindings/cpp/src/terminus.cpp
index 6d17786..8948eb5 100644
--- a/proton-c/bindings/cpp/src/terminus.cpp
+++ b/proton-c/bindings/cpp/src/terminus.cpp
@@ -24,7 +24,7 @@
 
 namespace proton {
 
-terminus::type_t terminus::type() {
+terminus::type_t terminus::type() const {
     return (type_t) pn_terminus_get_type(pn_cast(this));
 }
 
@@ -32,7 +32,7 @@ void terminus::type(type_t type) {
     pn_terminus_set_type(pn_cast(this), (pn_terminus_type_t) type);
 }
 
-terminus::expiry_policy_t terminus::expiry_policy() {
+terminus::expiry_policy_t terminus::expiry_policy() const {
     return (expiry_policy_t) pn_terminus_get_type(pn_cast(this));
 }
 
@@ -40,7 +40,7 @@ void terminus::expiry_policy(expiry_policy_t policy) {
     pn_terminus_set_expiry_policy(pn_cast(this), (pn_expiry_policy_t) policy);
 }
 
-terminus::distribution_mode_t terminus::distribution_mode() {
+terminus::distribution_mode_t terminus::distribution_mode() const {
     return (distribution_mode_t) pn_terminus_get_type(pn_cast(this));
 }
 
@@ -48,7 +48,7 @@ void terminus::distribution_mode(distribution_mode_t mode) {
     pn_terminus_set_distribution_mode(pn_cast(this), (pn_distribution_mode_t) mode);
 }
 
-std::string terminus::address() {
+std::string terminus::address() const {
     const char *addr = pn_terminus_get_address(pn_cast(this));
     return addr ? std::string(addr) : std::string();
 }
@@ -57,7 +57,7 @@ void terminus::address(const std::string &addr) {
     pn_terminus_set_address(pn_cast(this), addr.c_str());
 }
 
-bool terminus::dynamic() {
+bool terminus::dynamic() const {
     return (type_t) pn_terminus_is_dynamic(pn_cast(this));
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cf221b45/proton-c/bindings/cpp/src/transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/transport.cpp b/proton-c/bindings/cpp/src/transport.cpp
index e128492..58114ae 100644
--- a/proton-c/bindings/cpp/src/transport.cpp
+++ b/proton-c/bindings/cpp/src/transport.cpp
@@ -24,7 +24,7 @@
 
 namespace proton {
 
-connection* transport::connection() {
+connection* transport::connection() const {
     return connection::cast(pn_transport_connection(pn_cast(this)));
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message