Repository: qpid-proton Updated Branches: refs/heads/cjansen-cpp-client 7bca703a9 -> aaf0430d7
PROTON-865: Remove duplicate UUID code. There's no need UUID generation in the binding now (container-id is not required.) If it arises later we should use proton's UUID code, not duplicate it in the binding. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/aaf0430d Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/aaf0430d Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/aaf0430d Branch: refs/heads/cjansen-cpp-client Commit: aaf0430d7f24b176d69f9306c69243b99e5b9e43 Parents: 052d466 Author: Alan Conway <[email protected]> Authored: Thu Jun 11 18:49:01 2015 -0400 Committer: Alan Conway <[email protected]> Committed: Thu Jun 11 19:19:25 2015 -0400 ---------------------------------------------------------------------- proton-c/bindings/cpp/CMakeLists.txt | 99 ++++++++++-------------- proton-c/bindings/cpp/src/Container.cpp | 1 - proton-c/bindings/cpp/src/ContainerImpl.cpp | 5 +- proton-c/bindings/cpp/src/grep | 3 - proton-c/bindings/cpp/src/platform.cpp | 81 ------------------- proton-c/bindings/cpp/src/platform.h | 39 ---------- proton-c/bindings/cpp/src/pn_data.h | 30 ------- 7 files changed, 42 insertions(+), 216 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aaf0430d/proton-c/bindings/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt index 6cad69f..cc1c74a 100644 --- a/proton-c/bindings/cpp/CMakeLists.txt +++ b/proton-c/bindings/cpp/CMakeLists.txt @@ -22,64 +22,45 @@ include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src") include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include") -set (qpid-proton-cpp-platform - "src/platform" - ) - -set (qpid-proton-cpp-core - src/Acceptor.cpp - src/Acking.cpp - src/Connection.cpp - src/ConnectionImpl.cpp - src/Connector.cpp - src/Connector.h - src/Container.cpp - src/ContainerImpl.cpp - src/Data.cpp - src/Decoder.cpp - src/Delivery.cpp - src/Duration.cpp - src/Encoder.cpp - src/Endpoint.cpp - src/Event.cpp - src/Handler.cpp - src/Link.cpp - src/Message.cpp - src/MessagingAdapter.cpp - src/MessagingEvent.cpp - src/MessagingHandler.cpp - src/ProtonEvent.cpp - src/ProtonHandler.cpp - src/Receiver.cpp - src/Sender.cpp - src/Session.cpp - src/Terminus.cpp - src/Transport.cpp - src/Url.cpp - src/Value.cpp - src/proton_bits.cpp - src/blocking/BlockingConnection.cpp - src/blocking/BlockingConnectionImpl.cpp - src/blocking/BlockingLink.cpp - src/blocking/BlockingSender.cpp - src/contexts.cpp - src/types.cpp - ) - -set_source_files_properties (${qpid-proton-cpp-platform} PROPERTIES LANGUAGE CXX) -set_source_files_properties ( - ${qpid-proton-cpp-platform} - PROPERTIES - COMPILE_FLAGS "${COMPILE_PLATFORM_FLAGS}" - COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}" - ) - add_library ( qpid-proton-cpp SHARED - - ${qpid-proton-cpp-core} - ${qpid-proton-cpp-platform} - + src/Acceptor.cpp + src/Acking.cpp + src/Connection.cpp + src/ConnectionImpl.cpp + src/Connector.cpp + src/Connector.h + src/Container.cpp + src/ContainerImpl.cpp + src/Data.cpp + src/Decoder.cpp + src/Delivery.cpp + src/Duration.cpp + src/Encoder.cpp + src/Endpoint.cpp + src/Event.cpp + src/Handler.cpp + src/Link.cpp + src/Message.cpp + src/MessagingAdapter.cpp + src/MessagingEvent.cpp + src/MessagingHandler.cpp + src/ProtonEvent.cpp + src/ProtonHandler.cpp + src/Receiver.cpp + src/Sender.cpp + src/Session.cpp + src/Terminus.cpp + src/Transport.cpp + src/Url.cpp + src/Value.cpp + src/proton_bits.cpp + src/blocking/BlockingConnection.cpp + src/blocking/BlockingConnectionImpl.cpp + src/blocking/BlockingLink.cpp + src/blocking/BlockingSender.cpp + src/contexts.cpp + src/types.cpp ) target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton) @@ -103,9 +84,9 @@ macro(add_cpp_test test) target_link_libraries (${test} qpid-proton qpid-proton-cpp) if (CMAKE_SYSTEM_NAME STREQUAL Windows) add_test (NAME cpp_${test} - COMMAND ${env_py} - "PATH=$<TARGET_FILE_DIR:qpid-proton>" - ${test}> ${ARGN}) + COMMAND ${env_py} + "PATH=$<TARGET_FILE_DIR:qpid-proton>" + ${test}> ${ARGN}) else () add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} ${test} ${ARGN}) endif () http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aaf0430d/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 5a551a1..3ae1963 100644 --- a/proton-c/bindings/cpp/src/Container.cpp +++ b/proton-c/bindings/cpp/src/Container.cpp @@ -31,7 +31,6 @@ #include "Connector.h" #include "contexts.h" #include "Url.h" -#include "platform.h" #include "proton/connection.h" #include "proton/session.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aaf0430d/proton-c/bindings/cpp/src/ContainerImpl.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp index ce69928..61fc860 100644 --- a/proton-c/bindings/cpp/src/ContainerImpl.cpp +++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp @@ -32,7 +32,6 @@ #include "Connector.h" #include "contexts.h" #include "Url.h" -#include "platform.h" #include "PrivateImplRef.h" #include "proton/connection.h" @@ -192,13 +191,13 @@ void ContainerImpl::decref(ContainerImpl *impl) { ContainerImpl::ContainerImpl(Handler &h) : reactor(0), handler(&h), messagingAdapter(0), - overrideHandler(0), flowController(0), containerId(generateUuid()), + overrideHandler(0), flowController(0), containerId(), refCount(0) {} ContainerImpl::ContainerImpl() : reactor(0), handler(0), messagingAdapter(0), - overrideHandler(0), flowController(0), containerId(generateUuid()), + overrideHandler(0), flowController(0), containerId(), refCount(0) {} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aaf0430d/proton-c/bindings/cpp/src/grep ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/grep b/proton-c/bindings/cpp/src/grep index a53cfb8..6be6b10 100644 --- a/proton-c/bindings/cpp/src/grep +++ b/proton-c/bindings/cpp/src/grep @@ -32,9 +32,6 @@ -rw-rw-r--. 1 aconway aconway 5864 Jun 10 08:40 MessagingEvent.cpp -rw-rw-r--. 1 aconway aconway 5230 Jun 10 08:40 MessagingHandler.cpp -rw-rw-r--. 1 aconway aconway 2587 Jun 10 08:40 Msg.h - -rw-rw-r--. 1 aconway aconway 2208 Jun 10 08:40 platform.cpp - -rw-rw-r--. 1 aconway aconway 1145 Jun 10 08:40 platform.h - -rw-rw-r--. 1 aconway aconway 1072 Jun 11 11:49 pn_data.h -rw-rw-r--. 1 aconway aconway 3000 Jun 10 08:40 PrivateImplRef.h -rw-rw-r--. 1 aconway aconway 6032 Jun 10 08:40 ProtonEvent.cpp -rw-rw-r--. 1 aconway aconway 3818 Jun 10 08:40 ProtonHandler.cpp http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aaf0430d/proton-c/bindings/cpp/src/platform.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/platform.cpp b/proton-c/bindings/cpp/src/platform.cpp deleted file mode 100644 index 80e3d51..0000000 --- a/proton-c/bindings/cpp/src/platform.cpp +++ /dev/null @@ -1,81 +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. - * - */ - -#include "platform.h" -#include <string> - -// FIXME aconway 2015-06-09: probably don't need UUIDs in the binding. - -// Copy neccesary platform neutral functionality from Proton-C -// TODO: make this sensibly maintainable (even though it is mostly static) - -#ifdef USE_UUID_GENERATE -#include <uuid/uuid.h> -#include <stdlib.h> -char* pn_i_genuuid(void) { - char *generated = (char *) malloc(37*sizeof(char)); - uuid_t uuid; - uuid_generate(uuid); - uuid_unparse(uuid, generated); - return generated; -} -#elif USE_UUID_CREATE -#include <uuid.h> -char* pn_i_genuuid(void) { - char *generated; - uuid_t uuid; - uint32_t rc; - uuid_create(&uuid, &rc); - // Under FreeBSD the returned string is newly allocated from the heap - uuid_to_string(&uuid, &generated, &rc); - return generated; -} -#elif USE_WIN_UUID -#include <rpc.h> -char* pn_i_genuuid(void) { - unsigned char *generated; - UUID uuid; - UuidCreate(&uuid); - UuidToString(&uuid, &generated); - char* r = pn_strdup((const char*)generated); - RpcStringFree(&generated); - return r; -} -#else -#error "Don't know how to generate uuid strings on this platform" -#endif - - - -namespace proton { -namespace reactor { - -// include Proton-c platform routines into a local namespace - - -std::string generateUuid() { - char *s = pn_i_genuuid(); - std::string url(s); - free(s); - return url; -} - -}} // namespace proton::reactor http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aaf0430d/proton-c/bindings/cpp/src/platform.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/platform.h b/proton-c/bindings/cpp/src/platform.h deleted file mode 100644 index 5e5b726..0000000 --- a/proton-c/bindings/cpp/src/platform.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef PROTON_CPP_PLATFORM_H -#define PROTON_CPP_PLATFORM_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/cpp/ProtonHandler.h" -#include "proton/event.h" -#include "proton/reactor.h" -#include <string> - - -namespace proton { -namespace reactor { - -std::string generateUuid(); -// Todo: TimeNow(); - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_PLATFORM_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aaf0430d/proton-c/bindings/cpp/src/pn_data.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/pn_data.h b/proton-c/bindings/cpp/src/pn_data.h deleted file mode 100644 index 371d82c..0000000 --- a/proton-c/bindings/cpp/src/pn_data.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef PN_DATA_H -#define PN_DATA_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. - */ - -// Some routines for handling pn_data_t - -std::ostream& operator<<(std::ostream& o, const Value& v) { - pn_string_t* str = pn_string(""); - pn_inspect(v.data, str); - return o << pn_string_get(str); -} - -#endif // PN_DATA_H --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
