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 2016/02/26 00:36:36 UTC
[2/6] qpid-proton git commit: PROTON-1138: c++: Make id_generator
class private
PROTON-1138: c++: Make id_generator class private
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/6e857089
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/6e857089
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/6e857089
Branch: refs/heads/master
Commit: 6e8570898998beea953628238c897989a0344ca1
Parents: 1de2f11
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Feb 23 12:17:06 2016 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Feb 25 17:50:55 2016 -0500
----------------------------------------------------------------------
.../cpp/include/proton/connection_engine.hpp | 8 ++--
.../cpp/include/proton/id_generator.hpp | 47 --------------------
proton-c/bindings/cpp/src/connection_engine.cpp | 24 +++++++---
proton-c/bindings/cpp/src/container_impl.hpp | 12 ++---
proton-c/bindings/cpp/src/contexts.hpp | 2 +-
proton-c/bindings/cpp/src/id_generator.cpp | 2 +-
proton-c/bindings/cpp/src/id_generator.hpp | 47 ++++++++++++++++++++
7 files changed, 76 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e857089/proton-c/bindings/cpp/include/proton/connection_engine.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/connection_engine.hpp b/proton-c/bindings/cpp/include/proton/connection_engine.hpp
index beeefc5..0c509d2 100644
--- a/proton-c/bindings/cpp/include/proton/connection_engine.hpp
+++ b/proton-c/bindings/cpp/include/proton/connection_engine.hpp
@@ -23,7 +23,6 @@
#include "proton/connection.hpp"
#include "proton/connection_options.hpp"
#include "proton/export.hpp"
-#include "proton/id_generator.hpp"
#include "proton/pn_unique_ptr.hpp"
#include "proton/types.hpp"
@@ -70,6 +69,7 @@ PN_CPP_CLASS_EXTERN connection_engine {
/// Create a container with id. Default to random UUID if id
/// == "".
PN_CPP_EXTERN container(const std::string &id = "");
+ PN_CPP_EXTERN ~container();
/// Return the container-id
PN_CPP_EXTERN std::string id() const;
@@ -86,11 +86,9 @@ PN_CPP_CLASS_EXTERN connection_engine {
PN_CPP_EXTERN void options(const connection_options&);
private:
- const std::string id_;
- id_generator id_gen_;
- connection_options options_;
+ class impl;
+ pn_unique_ptr<impl> impl_;
};
-
/// Create a connection engine that dispatches to handler.
PN_CPP_EXTERN connection_engine(handler&, const connection_options& = no_opts);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e857089/proton-c/bindings/cpp/include/proton/id_generator.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/id_generator.hpp b/proton-c/bindings/cpp/include/proton/id_generator.hpp
deleted file mode 100644
index 687d27e..0000000
--- a/proton-c/bindings/cpp/include/proton/id_generator.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-///@internal
-#include "proton/types.hpp"
-
-#ifndef ID_GENERATOR_HPP
-#define ID_GENERATOR_HPP
-
-namespace proton {
-
-/// @cond INTERNAL
-/// XXX should this be in the interface at all?
-/// XXX decision - make this private
-class id_generator {
- public:
- PN_CPP_EXTERN id_generator(const std::string &prefix="");
- PN_CPP_EXTERN std::string next();
- void prefix(const std::string &p) { prefix_ = p; }
- const std::string& prefix() const { return prefix_; }
-
- private:
- std::string prefix_;
- uint64_t count_;
-};
-
-}
-
-/// @endcond
-
-#endif
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e857089/proton-c/bindings/cpp/src/connection_engine.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection_engine.cpp b/proton-c/bindings/cpp/src/connection_engine.cpp
index 940bca6..a15fe95 100644
--- a/proton-c/bindings/cpp/src/connection_engine.cpp
+++ b/proton-c/bindings/cpp/src/connection_engine.cpp
@@ -23,10 +23,11 @@
#include "proton/uuid.hpp"
#include "contexts.hpp"
+#include "id_generator.hpp"
#include "messaging_adapter.hpp"
+#include "messaging_event.hpp"
#include "msg.hpp"
#include "proton_bits.hpp"
-#include "messaging_event.hpp"
#include "proton_bits.hpp"
#include <proton/connection.h>
@@ -56,18 +57,29 @@ void close_transport(connection_engine_context *ctx_) {
std::string make_id(const std::string s="") { return s.empty() ? uuid::random().str() : s; }
}
-connection_engine::container::container(const std::string& s) : id_(make_id(s)) {}
+class connection_engine::container::impl {
+ public:
+ impl(const std::string s="") : id_(make_id(s)) {}
+
+ const std::string id_;
+ id_generator id_gen_;
+ connection_options options_;
+};
+
+connection_engine::container::container(const std::string& s) : impl_(new impl(s)) {}
+
+connection_engine::container::~container() {}
-std::string connection_engine::container::id() const { return id_; }
+std::string connection_engine::container::id() const { return impl_->id_; }
connection_options connection_engine::container::make_options() {
- connection_options opts = options_;
- opts.container_id(id()).link_prefix(id_gen_.next()+"/");
+ connection_options opts = impl_->options_;
+ opts.container_id(id()).link_prefix(impl_->id_gen_.next()+"/");
return opts;
}
void connection_engine::container::options(const connection_options &opts) {
- options_ = opts;
+ impl_->options_ = opts;
}
connection_engine::connection_engine(class handler &h, const connection_options& opts) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e857089/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 8d4eb9d..049493e 100644
--- a/proton-c/bindings/cpp/src/container_impl.hpp
+++ b/proton-c/bindings/cpp/src/container_impl.hpp
@@ -21,18 +21,18 @@
* under the License.
*
*/
+
+#include "id_generator.hpp"
+
+#include "proton/connection.hpp"
+#include "proton/duration.hpp"
#include "proton/export.hpp"
#include "proton/handler.hpp"
-#include "proton/connection.hpp"
#include "proton/link.hpp"
-#include "proton/duration.hpp"
+#include "proton/reactor.h"
#include "proton/reactor.hpp"
-#include "proton/id_generator.hpp"
-
#include "proton_handler.hpp"
-#include "proton/reactor.h"
-
#include <string>
namespace proton {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e857089/proton-c/bindings/cpp/src/contexts.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.hpp b/proton-c/bindings/cpp/src/contexts.hpp
index e558158..219a909 100644
--- a/proton-c/bindings/cpp/src/contexts.hpp
+++ b/proton-c/bindings/cpp/src/contexts.hpp
@@ -27,8 +27,8 @@
#include "proton/connection.hpp"
#include "proton/container.hpp"
#include "proton/connection_engine.hpp"
-#include "proton/id_generator.hpp"
+#include "id_generator.hpp"
#include "proton_handler.hpp"
struct pn_session_t;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e857089/proton-c/bindings/cpp/src/id_generator.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/id_generator.cpp b/proton-c/bindings/cpp/src/id_generator.cpp
index b1b4d06..c12d5a4 100644
--- a/proton-c/bindings/cpp/src/id_generator.cpp
+++ b/proton-c/bindings/cpp/src/id_generator.cpp
@@ -17,7 +17,7 @@
* under the License.
*/
-#include "proton/id_generator.hpp"
+#include "id_generator.hpp"
#include <sstream>
namespace proton {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e857089/proton-c/bindings/cpp/src/id_generator.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/id_generator.hpp b/proton-c/bindings/cpp/src/id_generator.hpp
new file mode 100644
index 0000000..687d27e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/id_generator.hpp
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+///@internal
+#include "proton/types.hpp"
+
+#ifndef ID_GENERATOR_HPP
+#define ID_GENERATOR_HPP
+
+namespace proton {
+
+/// @cond INTERNAL
+/// XXX should this be in the interface at all?
+/// XXX decision - make this private
+class id_generator {
+ public:
+ PN_CPP_EXTERN id_generator(const std::string &prefix="");
+ PN_CPP_EXTERN std::string next();
+ void prefix(const std::string &p) { prefix_ = p; }
+ const std::string& prefix() const { return prefix_; }
+
+ private:
+ std::string prefix_;
+ uint64_t count_;
+};
+
+}
+
+/// @endcond
+
+#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org