http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/codec/encoder.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/codec/encoder.hpp b/proton-c/bindings/cpp/include/proton/codec/encoder.hpp deleted file mode 100644 index 222e95b..0000000 --- a/proton-c/bindings/cpp/include/proton/codec/encoder.hpp +++ /dev/null @@ -1,202 +0,0 @@ -#ifndef PROTON_CODEC_ENCODER_HPP -#define PROTON_CODEC_ENCODER_HPP - -/* - * - * 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 "../internal/data.hpp" -#include "../internal/type_traits.hpp" -#include "../types_fwd.hpp" -#include "./common.hpp" - -#include <proton/type_compat.h> - -namespace proton { -class scalar_base; - -namespace internal{ -class value_base; -} - -namespace codec { - -/// **Experimental** - Stream-like encoder from C++ values to AMQP -/// bytes. -/// -/// For internal use only. -/// -/// @see @ref types_page for the recommended ways to manage AMQP data -class encoder : public internal::data { - public: - /// Wrap Proton-C data object. - explicit encoder(const data& d) : data(d) {} - - /// Encoder into v. Clears any current value in v. - PN_CPP_EXTERN explicit encoder(internal::value_base& v); - - /// Encode the current values into buffer and update size to reflect the - /// number of bytes encoded. - /// - /// Clears the encoder. - /// - /// @return if buffer == 0 or size is too small, then return false - /// and size to the required size. Otherwise, return true and set - /// size to the number of bytes encoded. - PN_CPP_EXTERN bool encode(char* buffer, size_t& size); - - /// Encode the current values into a std::string and resize the - /// string if necessary. Clears the encoder. - PN_CPP_EXTERN void encode(std::string&); - - /// Encode the current values into a std::string. Clears the - /// encoder. - PN_CPP_EXTERN std::string encode(); - - /// @name Insert built-in types - /// @{ - PN_CPP_EXTERN encoder& operator<<(bool); - PN_CPP_EXTERN encoder& operator<<(uint8_t); - PN_CPP_EXTERN encoder& operator<<(int8_t); - PN_CPP_EXTERN encoder& operator<<(uint16_t); - PN_CPP_EXTERN encoder& operator<<(int16_t); - PN_CPP_EXTERN encoder& operator<<(uint32_t); - PN_CPP_EXTERN encoder& operator<<(int32_t); - PN_CPP_EXTERN encoder& operator<<(wchar_t); - PN_CPP_EXTERN encoder& operator<<(uint64_t); - PN_CPP_EXTERN encoder& operator<<(int64_t); - PN_CPP_EXTERN encoder& operator<<(timestamp); - PN_CPP_EXTERN encoder& operator<<(float); - PN_CPP_EXTERN encoder& operator<<(double); - PN_CPP_EXTERN encoder& operator<<(decimal32); - PN_CPP_EXTERN encoder& operator<<(decimal64); - PN_CPP_EXTERN encoder& operator<<(decimal128); - PN_CPP_EXTERN encoder& operator<<(const uuid&); - PN_CPP_EXTERN encoder& operator<<(const std::string&); - PN_CPP_EXTERN encoder& operator<<(const symbol&); - PN_CPP_EXTERN encoder& operator<<(const binary&); - PN_CPP_EXTERN encoder& operator<<(const scalar_base&); - PN_CPP_EXTERN encoder& operator<<(const null&); - /// @} - - /// Insert a proton::value. - /// - /// @internal NOTE insert value_base, not value to avoid recursive - /// implicit conversions. - PN_CPP_EXTERN encoder& operator<<(const internal::value_base&); - - /// Start a complex type - PN_CPP_EXTERN encoder& operator<<(const start&); - - /// Finish a complex type - PN_CPP_EXTERN encoder& operator<<(const finish&); - - /// @cond INTERNAL - - // Undefined template to prevent pointers being implicitly converted to bool. - template <class T> void* operator<<(const T*); - - template <class T> struct list_cref { T& ref; list_cref(T& r) : ref(r) {} }; - template <class T> struct map_cref { T& ref; map_cref(T& r) : ref(r) {} }; - - template <class T> struct array_cref { - start array_start; - T& ref; - array_cref(T& r, type_id el, bool described) : array_start(ARRAY, el, described), ref(r) {} - }; - - template <class T> static list_cref<T> list(T& x) { return list_cref<T>(x); } - template <class T> static map_cref<T> map(T& x) { return map_cref<T>(x); } - template <class T> static array_cref<T> array(T& x, type_id element, bool described=false) { - return array_cref<T>(x, element, described); - } - - template <class T> encoder& operator<<(const map_cref<T>& x) { - internal::state_guard sg(*this); - *this << start::map(); - for (typename T::const_iterator i = x.ref.begin(); i != x.ref.end(); ++i) - *this << i->first << i->second; - *this << finish(); - return *this; - } - - template <class T> encoder& operator<<(const list_cref<T>& x) { - internal::state_guard sg(*this); - *this << start::list(); - for (typename T::const_iterator i = x.ref.begin(); i != x.ref.end(); ++i) - *this << *i; - *this << finish(); - return *this; - } - - template <class T> encoder& operator<<(const array_cref<T>& x) { - internal::state_guard sg(*this); - *this << x.array_start; - for (typename T::const_iterator i = x.ref.begin(); i != x.ref.end(); ++i) - *this << *i; - *this << finish(); - return *this; - } - /// @endcond - - private: - template<class T, class U> encoder& insert(const T& x, int (*put)(pn_data_t*, U)); - void check(long result); -}; - -/// Treat char* as string -inline encoder& operator<<(encoder& e, const char* s) { return e << std::string(s); } - -/// operator << for integer types that are not covered by the standard overrides. -template <class T> typename internal::enable_if<internal::is_unknown_integer<T>::value, encoder&>::type -operator<<(encoder& e, T i) { - using namespace internal; - return e << static_cast<typename integer_type<sizeof(T), is_signed<T>::value>::type>(i); -} - -/// @cond INTERNAL - -namespace is_encodable_impl { // Protect the world from fallback operator<< - -using namespace internal; - -sfinae::no operator<<(encoder const&, const sfinae::any_t &); // Fallback - -template<typename T> struct is_encodable : public sfinae { - static yes test(encoder&); - static no test(...); // Failed test, no match. - static encoder* e; - static const T* t; - static bool const value = sizeof(test(*e << *t)) == sizeof(yes); -}; - -// Avoid recursion -template <> struct is_encodable<value> : public true_type {}; - -} // is_encodable_impl - -using is_encodable_impl::is_encodable; - -/// @endcond - -} // codec -} // proton - -#endif /// PROTON_CODEC_ENCODER_HPP
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/codec/forward_list.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/codec/forward_list.hpp b/proton-c/bindings/cpp/include/proton/codec/forward_list.hpp deleted file mode 100644 index 0038b8f..0000000 --- a/proton-c/bindings/cpp/include/proton/codec/forward_list.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef PROTON_CODEC_FORWARD_LIST_HPP -#define PROTON_CODEC_FORWARD_LIST_HPP - -/* - * 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 "./encoder.hpp" -#include "./decoder.hpp" - -#include <forward_list> -#include <utility> - -namespace proton { -namespace codec { - -/// std::forward_list<T> for most T is encoded as an AMQP array. -template <class T, class A> -encoder& operator<<(encoder& e, const std::forward_list<T, A>& x) { - return e << encoder::array(x, internal::type_id_of<T>::value); -} - -/// Specialize for std::forward_list<value>, encode as AMQP forward_list (variable type) -template <class A> -encoder& operator<<(encoder& e, const std::forward_list<value, A>& x) { return e << encoder::list(x); } - -/// Specialize for std::forward_list<scalar>, encode as AMQP list (variable type) -template <class A> -encoder& operator<<(encoder& e, const std::forward_list<scalar, A>& x) { return e << encoder::list(x); } - -/// Specialize for std::forward_list<std::pair<k,t> >, encode as AMQP map. -/// Allows control over the order of encoding map entries. -template <class A, class K, class T> -encoder& operator<<(encoder& e, const std::forward_list<std::pair<K,T>, A>& x) { return e << encoder::map(x); } - -/// Decode to std::forward_list<T> from an amqp::LIST or amqp::ARRAY. -template <class T, class A> decoder& operator>>(decoder& d, std::forward_list<T, A>& x) { return d >> decoder::sequence(x); } - -/// Decode to std::forward_list<std::pair<K, T> from an amqp::MAP. -template <class A, class K, class T> decoder& operator>>(decoder& d, std::forward_list<std::pair<K, T> , A>& x) { return d >> decoder::pair_sequence(x); } - -} // codec -} // proton - -#endif // PROTON_CODEC_FORWARD_LIST_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/codec/list.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/codec/list.hpp b/proton-c/bindings/cpp/include/proton/codec/list.hpp deleted file mode 100644 index a2c71b8..0000000 --- a/proton-c/bindings/cpp/include/proton/codec/list.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef PROTON_CODEC_LIST_HPP -#define PROTON_CODEC_LIST_HPP - -/* - * - * 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 "./encoder.hpp" -#include "./decoder.hpp" - -#include <list> -#include <utility> - -namespace proton { -namespace codec { - -/// std::list<T> for most T is encoded as an AMQP array. -template <class T, class A> -encoder& operator<<(encoder& e, const std::list<T, A>& x) { - return e << encoder::array(x, internal::type_id_of<T>::value); -} - -/// Specialize for std::list<value>, encode as AMQP list (variable type) -template <class A> -encoder& operator<<(encoder& e, const std::list<value, A>& x) { return e << encoder::list(x); } - -/// Specialize for std::list<scalar>, encode as AMQP list (variable type) -template <class A> -encoder& operator<<(encoder& e, const std::list<scalar, A>& x) { return e << encoder::list(x); } - -/// Specialize for std::list<std::pair<k,t> >, encode as AMQP map. -/// Allows control over the order of encoding map entries. -template <class A, class K, class T> -encoder& operator<<(encoder& e, const std::list<std::pair<K,T>, A>& x) { return e << encoder::map(x); } - -/// Decode to std::list<T> from an amqp::LIST or amqp::ARRAY. -template <class T, class A> decoder& operator>>(decoder& d, std::list<T, A>& x) { return d >> decoder::sequence(x); } - -/// Decode to std::list<std::pair<K, T> from an amqp::MAP. -template <class A, class K, class T> decoder& operator>>(decoder& d, std::list<std::pair<K, T> , A>& x) { return d >> decoder::pair_sequence(x); } - -} // codec -} // proton - -#endif // PROTON_CODEC_LIST_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/codec/map.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/codec/map.hpp b/proton-c/bindings/cpp/include/proton/codec/map.hpp deleted file mode 100644 index d3b0c4d..0000000 --- a/proton-c/bindings/cpp/include/proton/codec/map.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef PROTON_CODEC_MAP_HPP -#define PROTON_CODEC_MAP_HPP - -/* - * - * 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 "./encoder.hpp" -#include "./decoder.hpp" - -#include <map> - -namespace proton { -namespace codec { - -/// Encode std::map<K, T> as amqp::MAP. -template <class K, class T, class C, class A> -encoder& operator<<(encoder& e, const std::map<K, T, C, A>& m) { return e << encoder::map(m); } - -/// Decode to std::map<K, T> from amqp::MAP. -template <class K, class T, class C, class A> -decoder& operator>>(decoder& d, std::map<K, T, C, A>& m) { return d >> decoder::associative(m); } - -} // codec -} // proton - -#endif // PROTON_CODEC_MAP_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/codec/unordered_map.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/codec/unordered_map.hpp b/proton-c/bindings/cpp/include/proton/codec/unordered_map.hpp deleted file mode 100644 index b081ff8..0000000 --- a/proton-c/bindings/cpp/include/proton/codec/unordered_map.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef PROTON_CODEC_UNORDERED_MAP_HPP -#define PROTON_CODEC_UNORDERED_MAP_HPP - -/* - * - * 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 "./encoder.hpp" -#include "./decoder.hpp" - -#include <unordered_map> - -namespace proton { -namespace codec { - -/// Encode std::unordered_map<K, T> as amqp::UNORDERED_MAP. -template <class K, class T, class C, class A> -encoder& operator<<(encoder& e, const std::unordered_map<K, T, C, A>& m) { return e << encoder::map(m); } - -/// Decode to std::unordered_map<K, T> from amqp::UNORDERED_MAP. -template <class K, class T, class C, class A> -decoder& operator>>(decoder& d, std::unordered_map<K, T, C, A>& m) { return d >> decoder::associative(m); } - -} // codec -} // proton - -#endif // PROTON_CODEC_UNORDERED_MAP_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/codec/vector.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/codec/vector.hpp b/proton-c/bindings/cpp/include/proton/codec/vector.hpp deleted file mode 100644 index 4edae25..0000000 --- a/proton-c/bindings/cpp/include/proton/codec/vector.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef PROTON_CODEC_VECTOR_HPP -#define PROTON_CODEC_VECTOR_HPP - -/* - * - * 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 "./encoder.hpp" -#include "./decoder.hpp" - -#include <vector> -#include <utility> - -namespace proton { -namespace codec { - -/// Encode std::vector<T> as amqp::ARRAY (same type elements) -template <class T, class A> encoder& operator<<(encoder& e, const std::vector<T, A>& x) { - return e << encoder::array(x, internal::type_id_of<T>::value); -} - -/// Encode std::vector<value> encode as amqp::LIST (mixed type elements) -template <class A> encoder& operator<<(encoder& e, const std::vector<value, A>& x) { return e << encoder::list(x); } - -/// Encode std::vector<scalar> as amqp::LIST (mixed type elements) -template <class A> encoder& operator<<(encoder& e, const std::vector<scalar, A>& x) { return e << encoder::list(x); } - -/// Encode std::deque<std::pair<k,t> > as amqp::MAP, preserves order of entries. -template <class A, class K, class T> -encoder& operator<<(encoder& e, const std::vector<std::pair<K,T>, A>& x) { return e << encoder::map(x); } - -/// Decode to std::vector<T> from an amqp::LIST or amqp::ARRAY. -template <class T, class A> decoder& operator>>(decoder& d, std::vector<T, A>& x) { return d >> decoder::sequence(x); } - -/// Decode to std::vector<std::pair<K, T> from an amqp::MAP. -template <class A, class K, class T> decoder& operator>>(decoder& d, std::vector<std::pair<K, T> , A>& x) { return d >> decoder::pair_sequence(x); } - -} // codec -} // proton - -#endif // PROTON_CODEC_VECTOR_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/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 deleted file mode 100644 index a4046be..0000000 --- a/proton-c/bindings/cpp/include/proton/connection.hpp +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef PROTON_CONNECTION_HPP -#define PROTON_CONNECTION_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./internal/object.hpp" -#include "./endpoint.hpp" -#include "./session.hpp" - -#include <proton/type_compat.h> - -#include <string> - -struct pn_connection_t; - -namespace proton { - -/// A connection to a remote AMQP peer. -class -PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, public endpoint { - /// @cond INTERNAL - PN_CPP_EXTERN connection(pn_connection_t* c) : internal::object<pn_connection_t>(c) {} - /// @endcond - - public: - /// Create an empty connection. - connection() : internal::object<pn_connection_t>(0) {} - - PN_CPP_EXTERN bool uninitialized() const; - PN_CPP_EXTERN bool active() const; - PN_CPP_EXTERN bool closed() const; - - PN_CPP_EXTERN class error_condition error() const; - - /// Get the container. - /// - /// @throw proton::error if this connection is not managed by a - /// container - PN_CPP_EXTERN class container &container() const; - - /// Get the transport for the connection. - PN_CPP_EXTERN class transport transport() const; - - /// Return the AMQP hostname attribute for the connection. - PN_CPP_EXTERN std::string virtual_host() const; - - /// Return the container ID for the connection. - PN_CPP_EXTERN std::string container_id() const; - - /// Return authenticated user for the connection - /// Note: The value returned is not stable until the on_transport_open event is received - PN_CPP_EXTERN std::string user() const; - - /// Open the connection. - /// - /// @see endpoint_lifecycle - PN_CPP_EXTERN void open(); - - /// @copydoc open - PN_CPP_EXTERN void open(const connection_options &); - - PN_CPP_EXTERN void close(); - PN_CPP_EXTERN void close(const error_condition&); - - /// Open a new session. - PN_CPP_EXTERN session open_session(); - - /// @copydoc open_session - PN_CPP_EXTERN session open_session(const session_options &); - - /// Get the default session. A default session is created on the - /// first call and reused for the lifetime of the connection. - PN_CPP_EXTERN session default_session(); - - /// Open a sender for `addr` on default_session(). - PN_CPP_EXTERN sender open_sender(const std::string &addr); - - /// @copydoc open_sender - PN_CPP_EXTERN sender open_sender(const std::string &addr, const sender_options &); - - /// Open a receiver for `addr` on default_session(). - PN_CPP_EXTERN receiver open_receiver(const std::string &addr); - - /// @copydoc open_receiver - PN_CPP_EXTERN receiver open_receiver(const std::string &addr, - const receiver_options &); - - /// Return all sessions on this connection. - PN_CPP_EXTERN session_range sessions() const; - - /// Return all receivers on this connection. - PN_CPP_EXTERN receiver_range receivers() const; - - /// Return all senders on this connection. - PN_CPP_EXTERN sender_range senders() const; - - /// Get the maximum frame size. - /// - /// @see @ref connection_options::max_frame_size - PN_CPP_EXTERN uint32_t max_frame_size() const; - - /// Get the maximum number of open sessions. - /// - /// @see @ref connection_options::max_sessions - PN_CPP_EXTERN uint16_t max_sessions() const; - - /// Get the idle timeout. - /// - /// @see @ref connection_options::idle_timeout - PN_CPP_EXTERN uint32_t idle_timeout() const; - - /// @cond INTERNAL - friend class internal::factory<connection>; - friend class container; - friend class proton::thread_safe<connection>; - /// @endcond -}; - -} // proton - -#endif // PROTON_CONNECTION_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/connection_options.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/connection_options.hpp b/proton-c/bindings/cpp/include/proton/connection_options.hpp deleted file mode 100644 index 9c7923e..0000000 --- a/proton-c/bindings/cpp/include/proton/connection_options.hpp +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef PROTON_CONNECTION_OPTIONS_H -#define PROTON_CONNECTION_OPTIONS_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 "./fwd.hpp" -#include "./types_fwd.hpp" -#include "./internal/config.hpp" -#include "./internal/export.hpp" -#include "./internal/pn_unique_ptr.hpp" -#include "./duration.hpp" - -#include <proton/type_compat.h> - -#include <vector> -#include <string> - -struct pn_connection_t; - -namespace proton { - -/// Options for creating a connection. -/// -/// Options can be "chained" like this: -/// -/// @code -/// c = container.connect(url, connection_options().handler(h).max_frame_size(1234)); -/// @endcode -/// -/// You can also create an options object with common settings and use -/// it as a base for different connections that have mostly the same -/// settings: -/// -/// @code -/// connection_options opts; -/// opts.idle_timeout(1000).max_frame_size(10000); -/// c1 = container.connect(url1, opts.handler(h1)); -/// c2 = container.connect(url2, opts.handler(h2)); -/// @endcode -/// -/// Normal value semantics: copy or assign creates a separate copy of -/// the options. -class connection_options { - public: - /// Create an empty set of options. - PN_CPP_EXTERN connection_options(); - - /// Shorthand for connection_options().handler(h) - PN_CPP_EXTERN connection_options(class messaging_handler& h); - - /// Copy options. - PN_CPP_EXTERN connection_options(const connection_options&); - - PN_CPP_EXTERN ~connection_options(); - - /// Copy options. - PN_CPP_EXTERN connection_options& operator=(const connection_options&); - - // XXX add C++11 move operations - Still relevant, and applies to all options - - /// Set a connection handler. - /// - /// The handler must not be deleted until messaging_handler::on_transport_close() is called. - PN_CPP_EXTERN connection_options& handler(class messaging_handler&); - - /// Set the maximum frame size. - PN_CPP_EXTERN connection_options& max_frame_size(uint32_t max); - - /// Set the maximum number of open sessions. - PN_CPP_EXTERN connection_options& max_sessions(uint16_t max); - - // XXX document relationship to heartbeat interval - /// Set the idle timeout. - PN_CPP_EXTERN connection_options& idle_timeout(duration); - - /// Set the container ID. - PN_CPP_EXTERN connection_options& container_id(const std::string &id); - - /// Set the virtual host name for the connection. If making a - /// client connection by SSL/TLS, this name is also used for - /// certificate verification and Server Name Indication. For - /// client connections, it defaults to the host name used to set - /// up the connection. It is not set by default for server - /// connections. - PN_CPP_EXTERN connection_options& virtual_host(const std::string &name); - - /// Set the user name used to authenticate the connection. - /// - /// This will override any user name that is specified in the url - /// used for container::connect. - /// It will be ignored if the connection is created by container::listen as - /// a listening connection has no user name. - PN_CPP_EXTERN connection_options& user(const std::string& user); - - /// Set the password used to authenticate the connection - PN_CPP_EXTERN connection_options& password(const std::string& pass); - - /// @cond INTERNAL - // XXX settle questions about reconnect_timer - consider simply - // reconnect_options and making reconnect_timer internal - /// **Experimental** - PN_CPP_EXTERN connection_options& reconnect(const reconnect_timer &); - /// @endcond - - /// Set SSL client options. - PN_CPP_EXTERN connection_options& ssl_client_options(const class ssl_client_options &); - - /// Set SSL server options. - PN_CPP_EXTERN connection_options& ssl_server_options(const class ssl_server_options &); - - /// Enable or disable SASL. - PN_CPP_EXTERN connection_options& sasl_enabled(bool); - - /// Force the enabling of SASL mechanisms that disclose clear text - /// passwords over the connection. By default, such mechanisms - /// are disabled. - PN_CPP_EXTERN connection_options& sasl_allow_insecure_mechs(bool); - - /// Specify the allowed mechanisms for use on the connection. - PN_CPP_EXTERN connection_options& sasl_allowed_mechs(const std::string &); - - /// **Experimental** - Set the SASL configuration name. - PN_CPP_EXTERN connection_options& sasl_config_name(const std::string &); - - /// **Experimental** - Set the SASL configuration path. - PN_CPP_EXTERN connection_options& sasl_config_path(const std::string &); - - /// Update option values from values set in other. - PN_CPP_EXTERN connection_options& update(const connection_options& other); - - private: - void apply_unbound(connection&) const; - void apply_bound(connection&) const; - messaging_handler* handler() const; - - class impl; - internal::pn_unique_ptr<impl> impl_; - - /// @cond INTERNAL - friend class container; - friend class io::connection_driver; - friend class connection; - /// @endcond -}; - -} // proton - -#endif // PROTON_CONNECTION_OPTIONS_H http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/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 deleted file mode 100644 index 0c40f3d..0000000 --- a/proton-c/bindings/cpp/include/proton/container.hpp +++ /dev/null @@ -1,234 +0,0 @@ -#ifndef PROTON_CONTAINER_HPP -#define PROTON_CONTAINER_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./types_fwd.hpp" - -#include "./internal/config.hpp" -#include "./internal/export.hpp" -#include "./internal/pn_unique_ptr.hpp" - -#include <string> - -namespace proton { - -/// A top-level container of connections, sessions, senders, and -/// receivers. -/// -/// A container gives a unique identity to each communicating peer. It -/// is often a process-level object. -/// -/// It serves as an entry point to the API, allowing connections, -/// senders, and receivers to be established. It can be supplied with -/// an event handler in order to intercept important messaging events, -/// such as newly received messages or newly issued credit for sending -/// messages. -class PN_CPP_CLASS_EXTERN container { - public: - /// Create a container. - PN_CPP_EXTERN container(messaging_handler& h, const std::string& id=""); - - /// Create a container. - PN_CPP_EXTERN container(const std::string& id=""); - - PN_CPP_EXTERN ~container(); - - /// Connect to `url` and send an open request to the remote peer. - /// - /// Options are applied to the connection as follows, values in later - /// options override earlier ones: - /// - /// 1. client_connection_options() - /// 2. options passed to connect() - /// - /// The handler in the composed options is used to call - /// proton::messaging_handler::on_connection_open() when the remote peer's - /// open response is received. - PN_CPP_EXTERN returned<connection> connect(const std::string& url, const connection_options &); - - /// Connect to `url` and send an open request to the remote peer. - PN_CPP_EXTERN returned<connection> connect(const std::string& url); - - /// @cond INTERNAL - /// Stop listening on url, must match the url string given to listen(). - /// You can also use the proton::listener object returned by listen() - PN_CPP_EXTERN void stop_listening(const std::string& url); - /// @endcond - - /// Start listening on url. - /// - /// Calls to the @ref listen_handler are serialized for this listener, - /// but handlers attached to separate listeners may be called concurrently. - /// - /// @param url identifies a listening url. - /// @param lh handles listening events - /// @return listener lets you stop listening - PN_CPP_EXTERN listener listen(const std::string& url, listen_handler& lh); - - /// Listen with a fixed set of options for all accepted connections. - /// See listen(const std::string&, listen_handler&) - PN_CPP_EXTERN listener listen(const std::string& url, const connection_options&); - - /// Start listening on URL. - /// New connections will use the handler from server_connection_options() - PN_CPP_EXTERN listener listen(const std::string& url); - - /// Run the container in this thread. - /// Returns when the container stops. - /// @see auto_stop() and stop(). - /// - /// With a multithreaded container, call run() in multiple threads to create a thread pool. - PN_CPP_EXTERN void run(); - - /// If true, stop the container when all active connections and listeners are closed. - /// If false the container will keep running till stop() is called. - /// - /// auto_stop is set by default when a new container is created. - PN_CPP_EXTERN void auto_stop(bool); - - /// **Experimental** - Stop the container with an error_condition - /// err. - /// - /// - Abort all open connections and listeners. - /// - Process final handler events and injected functions - /// - If `!err.empty()`, handlers will receive on_transport_error - /// - run() will return in all threads. - PN_CPP_EXTERN void stop(const error_condition& err); - - /// **Experimental** - Stop the container with an empty error - /// condition. - /// - /// @see stop(const error_condition&) - PN_CPP_EXTERN void stop(); - - /// Open a connection and sender for `url`. - PN_CPP_EXTERN returned<sender> open_sender(const std::string &url); - - /// Open a connection and sender for `url`. - /// - /// Supplied sender options will override the container's - /// template options. - PN_CPP_EXTERN returned<sender> open_sender(const std::string &url, - const proton::sender_options &o); - - /// Open a connection and sender for `url`. - /// - /// Supplied connection options will override the - /// container's template options. - PN_CPP_EXTERN returned<sender> open_sender(const std::string &url, - const connection_options &c); - - /// Open a connection and sender for `url`. - /// - /// Supplied sender or connection options will override the - /// container's template options. - PN_CPP_EXTERN returned<sender> open_sender(const std::string &url, - const proton::sender_options &o, - const connection_options &c); - - /// Open a connection and receiver for `url`. - PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url); - - - /// Open a connection and receiver for `url`. - /// - /// Supplied receiver options will override the container's - /// template options. - PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url, - const proton::receiver_options &o); - - /// Open a connection and receiver for `url`. - /// - /// Supplied receiver or connection options will override the - /// container's template options. - PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url, - const connection_options &c); - - /// Open a connection and receiver for `url`. - /// - /// Supplied receiver or connection options will override the - /// container's template options. - PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url, - const proton::receiver_options &o, - const connection_options &c); - - /// A unique identifier for the container. - PN_CPP_EXTERN std::string id() const; - - /// Connection options that will be to outgoing connections. These - /// are applied first and overriden by options provided in - /// connect() and messaging_handler::on_connection_open(). - PN_CPP_EXTERN void client_connection_options(const connection_options &); - - /// @copydoc client_connection_options - PN_CPP_EXTERN connection_options client_connection_options() const; - - /// Connection options that will be applied to incoming - /// connections. These are applied first and overridden by options - /// provided in listen(), listen_handler::on_accept() and - /// messaging_handler::on_connection_open(). - PN_CPP_EXTERN void server_connection_options(const connection_options &); - - /// @copydoc server_connection_options - PN_CPP_EXTERN connection_options server_connection_options() const; - - /// Sender options applied to senders created by this - /// container. They are applied before messaging_handler::on_sender_open() - /// and can be overridden. - PN_CPP_EXTERN void sender_options(const class sender_options &); - - /// @copydoc sender_options - PN_CPP_EXTERN class sender_options sender_options() const; - - /// Receiver options applied to receivers created by this - /// container. They are applied before messaging_handler::on_receiver_open() - /// and can be overridden. - PN_CPP_EXTERN void receiver_options(const class receiver_options &); - - /// @copydoc receiver_options - PN_CPP_EXTERN class receiver_options receiver_options() const; - - /// Schedule a function to be called after the duration. C++03 - /// compatible, for C++11 use schedule(duration, - /// std::function<void()>) - PN_CPP_EXTERN void schedule(duration, void_function0&); - -#if PN_CPP_HAS_STD_FUNCTION - /// Schedule a function to be called after the duration - PN_CPP_EXTERN void schedule(duration, std::function<void()>); -#endif - - private: - class impl; - internal::pn_unique_ptr<impl> impl_; - - friend class connection_options; - friend class session_options; - friend class receiver_options; - friend class sender_options; -}; - -} // proton - -#endif // PROTON_CONTAINER_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/decimal.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/decimal.hpp b/proton-c/bindings/cpp/include/proton/decimal.hpp deleted file mode 100644 index efca029..0000000 --- a/proton-c/bindings/cpp/include/proton/decimal.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef PROTON_DECIMAL_HPP -#define PROTON_DECIMAL_HPP - -/* - * - * 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 "./byte_array.hpp" -#include "./internal/export.hpp" -#include "./internal/comparable.hpp" - -#include <iosfwd> - -namespace proton { - -/// @name AMQP decimal types. -/// -/// AMQP uses the standard IEEE 754-2008 encoding for decimal types. -/// -/// This library does not provide support for decimal arithmetic but it does -/// provide access to the byte representation of decimal values. You can pass -/// these values uninterpreted via AMQP, or you can use a library that supports -/// IEEE 754-2008 and make a byte-wise copy between the real decimal values and -/// proton::decimal values. -/// -/// @{ - -/// 32-bit decimal floating point. -class decimal32 : public byte_array<4> {}; - -/// 64-bit decimal floating point. -class decimal64 : public byte_array<8> {}; - -/// 128-bit decimal floating point. -class decimal128 : public byte_array<16> {}; -/// @} - -/// Print decimal values -/// @{ -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const decimal32&); -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const decimal64&); -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const decimal128&); -/// @} - -} // proton - -#endif // PROTON_DECIMAL_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/default_container.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/default_container.hpp b/proton-c/bindings/cpp/include/proton/default_container.hpp deleted file mode 100644 index 0f245a0..0000000 --- a/proton-c/bindings/cpp/include/proton/default_container.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef PROTON_DEFAULT_CONTAINER_HPP -#define PROTON_DEFAULT_CONTAINER_HPP - -/* - * - * 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. - * - */ - -namespace proton { - -/// @cond INTERNAL -typedef class container default_container; -/// @endcond - -} // proton - -#endif // PROTON_DEFAULT_CONTAINER_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/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 deleted file mode 100644 index 7c89f0c..0000000 --- a/proton-c/bindings/cpp/include/proton/delivery.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef PROTON_DELIVERY_HPP -#define PROTON_DELIVERY_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./internal/object.hpp" -#include "./transfer.hpp" - -namespace proton { - -/// A received message. -/// -/// A delivery attempt can fail. As a result, a particular message may -/// correspond to multiple deliveries. -class delivery : public transfer { - /// @cond INTERNAL - delivery(pn_delivery_t* d); - /// @endcond - - public: - delivery() {} - - /// Return the receiver for this delivery. - PN_CPP_EXTERN class receiver receiver() const; - - // XXX ATM the following don't reflect the differing behaviors we - // get from the different delivery modes. - Deferred - - /// Settle with ACCEPTED state. - PN_CPP_EXTERN void accept(); - - /// Settle with REJECTED state. - PN_CPP_EXTERN void reject(); - - /// Settle with RELEASED state. - PN_CPP_EXTERN void release(); - - /// Settle with MODIFIED state. - PN_CPP_EXTERN void modify(); - - /// @cond INTERNAL - friend class internal::factory<delivery>; - /// @endcond -}; - -} // proton - -#endif // PROTON_DELIVERY_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/delivery_mode.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/delivery_mode.hpp b/proton-c/bindings/cpp/include/proton/delivery_mode.hpp deleted file mode 100644 index 97b350f..0000000 --- a/proton-c/bindings/cpp/include/proton/delivery_mode.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef PROTON_DELIVERY_MODE_H -#define PROTON_DELIVERY_MODE_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. - * - */ - -namespace proton { - -/// The message delivery policy to establish when opening a link. -/// This structure imitates the newer C++11 "enum class" so that -/// The enumeration constants are in the delivery_mode namespace. -struct delivery_mode { - /// Delivery modes - enum modes { - /// No set policy. The application must settle messages - /// itself according to its own policy. - NONE = 0, - /// Outgoing messages are settled immediately by the link. - /// There are no duplicates. - AT_MOST_ONCE, - /// The receiver settles the delivery first with an - /// accept/reject/release disposition. The sender waits to - /// settle until after the disposition notification is - /// received. - AT_LEAST_ONCE - }; - - /// @cond INTERNAL - - delivery_mode() : modes_(NONE) {} - delivery_mode(modes m) : modes_(m) {} - operator modes() { return modes_; } - - /// @endcond - - private: - modes modes_; -}; - -} // proton - -#endif // PROTON_DELIVERY_MODE_H http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/duration.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/duration.hpp b/proton-c/bindings/cpp/include/proton/duration.hpp deleted file mode 100644 index a190cf9..0000000 --- a/proton-c/bindings/cpp/include/proton/duration.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef PROTON_DURATION_HPP -#define PROTON_DURATION_HPP - -/* - * - * 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 "./internal/export.hpp" -#include "./internal/comparable.hpp" -#include "./types_fwd.hpp" - -#include <proton/type_compat.h> - -#include <iosfwd> - -namespace proton { - -/// A span of time in milliseconds. -class duration : private internal::comparable<duration> { - public: - /// Numeric type used to store milliseconds - typedef int64_t numeric_type; - - /// Construct from milliseconds - explicit duration(numeric_type ms = 0) : ms_(ms) {} - - /// Assign - duration& operator=(numeric_type ms) { ms_ = ms; return *this; } - - /// Return milliseconds - numeric_type milliseconds() const { return ms_; } - - PN_CPP_EXTERN static const duration FOREVER; ///< Wait forever - PN_CPP_EXTERN static const duration IMMEDIATE; ///< Don't wait at all - PN_CPP_EXTERN static const duration SECOND; ///< One second - PN_CPP_EXTERN static const duration MINUTE; ///< One minute - - private: - numeric_type ms_; -}; - -/// Print duration -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, duration); - -/// @name Comparison and arithmetic operators -/// @{ -inline bool operator<(duration x, duration y) { return x.milliseconds() < y.milliseconds(); } -inline bool operator==(duration x, duration y) { return x.milliseconds() == y.milliseconds(); } - -inline duration operator+(duration x, duration y) { return duration(x.milliseconds() + y.milliseconds()); } -inline duration operator-(duration x, duration y) { return duration(x.milliseconds() - y.milliseconds()); } -inline duration operator*(duration d, uint64_t n) { return duration(d.milliseconds()*n); } -inline duration operator*(uint64_t n, duration d) { return d * n; } -/// @} - -} // proton - -#endif // PROTON_DURATION_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/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 deleted file mode 100644 index b041906..0000000 --- a/proton-c/bindings/cpp/include/proton/endpoint.hpp +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef PROTON_ENDPOINT_HPP -#define PROTON_ENDPOINT_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/config.hpp" -#include "./internal/export.hpp" - -namespace proton { - -/// The base class for session, connection, and link. -class -PN_CPP_CLASS_EXTERN endpoint { - public: - PN_CPP_EXTERN virtual ~endpoint(); - - // XXX Add the container accessor here. - - /// True if the local end is uninitialized. - virtual bool uninitialized() const = 0; - - /// True if the local end is active. - virtual bool active() const = 0; - - /// True if the local and remote ends are closed. - virtual bool closed() const = 0; - - /// Get the error condition of the remote endpoint. - virtual class error_condition error() const = 0; - - // XXX Add virtual open() and open(endpoint_options) - - /// Close the endpoint. - /// - /// @see endpoint_lifecycle - virtual void close() = 0; - - /// Close the endpoint with an error condition. - /// - /// @see endpoint_lifecycle - virtual void close(const error_condition&) = 0; - -#if PN_CPP_HAS_DEFAULTED_FUNCTIONS - // Make everything explicit for C++11 compilers - - /// @cond INTERNAL - endpoint() = default; - endpoint& operator=(const endpoint&) = default; - endpoint& operator=(endpoint&&) = default; - endpoint(const endpoint&) = default; - endpoint(endpoint&&) = default; - /// @endcond -#endif -}; - -namespace internal { - -template <class T, class D> class iter_base { - public: - typedef T value_type; - - T operator*() const { return obj_; } - T* operator->() const { return const_cast<T*>(&obj_); } - D operator++(int) { D x(*this); ++(*this); return x; } - bool operator==(const iter_base<T, D>& x) const { return obj_ == x.obj_; } - bool operator!=(const iter_base<T, D>& x) const { return obj_ != x.obj_; } - - protected: - explicit iter_base(T p = 0) : obj_(p) {} - T obj_; -}; - -template<class I> class iter_range { - public: - typedef I iterator; - - explicit iter_range(I begin = I(), I end = I()) : begin_(begin), end_(end) {} - I begin() const { return begin_; } - I end() const { return end_; } - bool empty() const { return begin_ == end_; } - - private: - I begin_, end_; -}; - -} // internal -} // proton - -#endif // PROTON_ENDPOINT_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/error.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/error.hpp b/proton-c/bindings/cpp/include/proton/error.hpp deleted file mode 100644 index 6896620..0000000 --- a/proton-c/bindings/cpp/include/proton/error.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef PROTON_ERROR_HPP -#define PROTON_ERROR_HPP - -/* - * - * 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 "./internal/config.hpp" -#include "./internal/export.hpp" - -#include <stdexcept> -#include <string> - -namespace proton { - -/// The base Proton error. -/// -/// All exceptions thrown from functions in the proton namespace are -/// subclasses of proton::error. -struct -PN_CPP_CLASS_EXTERN error : public std::runtime_error { - /// Construct the error with a message. - PN_CPP_EXTERN explicit error(const std::string&); -}; - -/// An operation timed out. -struct -PN_CPP_CLASS_EXTERN timeout_error : public error { - /// Construct the error with a message. - PN_CPP_EXTERN explicit timeout_error(const std::string&); -}; - -/// An error converting between AMQP and C++ data. -struct -PN_CPP_CLASS_EXTERN conversion_error : public error { - /// Construct the error with a message. - PN_CPP_EXTERN explicit conversion_error(const std::string&); -}; - -} // proton - -#endif // PROTON_ERROR_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/error_condition.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/error_condition.hpp b/proton-c/bindings/cpp/include/proton/error_condition.hpp deleted file mode 100644 index fb0d461..0000000 --- a/proton-c/bindings/cpp/include/proton/error_condition.hpp +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef PROTON_ERROR_CONDITION_H -#define PROTON_ERROR_CONDITION_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 "./internal/export.hpp" -#include "./internal/config.hpp" -#include "./value.hpp" - -#include <string> -#include <iosfwd> - -struct pn_condition_t; - -namespace proton { - -/// Describes an endpoint error state. -class error_condition { - /// @cond INTERNAL - error_condition(pn_condition_t* c); - /// @endcond - - public: - /// Create an empty error condition. - error_condition() {} - - /// Create an error condition with only a description. A default - /// name will be used ("proton:io:error"). - PN_CPP_EXTERN error_condition(std::string description); - - /// Create an error condition with a name and description. - PN_CPP_EXTERN error_condition(std::string name, std::string description); - - /// **Experimental** - Create an error condition with name, - /// description, and informational properties. - PN_CPP_EXTERN error_condition(std::string name, std::string description, proton::value properties); - -#if PN_CPP_HAS_DEFAULTED_FUNCTIONS - /// @cond INTERNAL - error_condition(const error_condition&) = default; - error_condition(error_condition&&) = default; - error_condition& operator=(const error_condition&) = default; - error_condition& operator=(error_condition&&) = default; - /// @endcond -#endif - -#if PN_CPP_HAS_EXPLICIT_CONVERSIONS - /// If you are using a C++11 compiler, you may use an - /// error_condition in boolean contexts. The expression will be - /// true if the error_condition is set. - PN_CPP_EXTERN explicit operator bool() const; -#endif - - /// No condition set. - PN_CPP_EXTERN bool operator!() const; - - /// No condition has been set. - PN_CPP_EXTERN bool empty() const; - - /// Condition name. - PN_CPP_EXTERN std::string name() const; - - /// Descriptive string for condition. - PN_CPP_EXTERN std::string description() const; - - /// Extra information for condition. - PN_CPP_EXTERN value properties() const; - - /// Simple printable string for condition. - PN_CPP_EXTERN std::string what() const; - - private: - std::string name_; - std::string description_; - proton::value properties_; - - /// @cond INTERNAL - friend class internal::factory<error_condition>; - /// @endcond -}; - -/// @cond INTERNAL -// XXX Document these -PN_CPP_EXTERN bool operator==(const error_condition& x, const error_condition& y); -PN_CPP_EXTERN std::ostream& operator<<(std::ostream& o, const error_condition& err); -/// @endcond - -} // proton - -#endif // PROTON_ERROR_CONDITION_H http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/event_loop.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/event_loop.hpp b/proton-c/bindings/cpp/include/proton/event_loop.hpp deleted file mode 100644 index f49d211..0000000 --- a/proton-c/bindings/cpp/include/proton/event_loop.hpp +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef PROTON_EVENT_LOOP_HPP -#define PROTON_EVENT_LOOP_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/config.hpp" -#include "./internal/export.hpp" -#include "./internal/pn_unique_ptr.hpp" - -#include <functional> - -struct pn_connection_t; -struct pn_session_t; -struct pn_link_t; - -namespace proton { - -/// **Experimental** - A serial execution context. -/// -/// Event handler functions associated with a single proton::connection are called in sequence. -/// The connection's @ref event_loop allows you to "inject" extra work from any thread, -/// and have it executed in the same sequence. -/// -class PN_CPP_CLASS_EXTERN event_loop { - /// @cond internal - class impl; - event_loop& operator=(impl* i); - /// @endcond - - public: - /// Create event_loop - PN_CPP_EXTERN event_loop(); - - PN_CPP_EXTERN ~event_loop(); - -#if PN_CPP_HAS_EXPLICIT_CONVERSIONS - /// When using C++11 (or later) you can use event_loop in a bool context - /// to indicate if there is an event loop set. - PN_CPP_EXTERN explicit operator bool() const { return bool(impl_); } -#endif - - /// No event loop set. - PN_CPP_EXTERN bool operator !() const { return !impl_; } - - /// Arrange to have f() called in the event_loop's sequence: possibly - /// deferred, possibly in another thread. - /// - /// @return true if f() has or will be called, false if the event_loop is ended - /// and f() cannot be injected. - PN_CPP_EXTERN bool inject(void_function0& f); - -#if PN_CPP_HAS_STD_FUNCTION - /// @copydoc inject(void_function0&) - PN_CPP_EXTERN bool inject(std::function<void()> f); -#endif - - private: - PN_CPP_EXTERN static event_loop& get(pn_connection_t*); - PN_CPP_EXTERN static event_loop& get(pn_session_t*); - PN_CPP_EXTERN static event_loop& get(pn_link_t*); - - internal::pn_unique_ptr<impl> impl_; - - /// @cond INTERNAL - friend class container; - friend class io::connection_driver; - template <class T> friend class thread_safe; - /// @endcond -}; - -} // proton - -#endif // PROTON_EVENT_LOOP_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/function.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/function.hpp b/proton-c/bindings/cpp/include/proton/function.hpp deleted file mode 100644 index ac756c7..0000000 --- a/proton-c/bindings/cpp/include/proton/function.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef PROTON_FUNCTION_HPP -#define PROTON_FUNCTION_HPP - -/* - * 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. - */ - -namespace proton { - -/// A C++03 compatible void no-argument callback function object. -/// -/// Used by container::schedule() and event_loop::inject(). In C++11 -/// you can use std::bind, std::function or a void-no-argument lambda -/// instead. -/// -/// void_function0 is passed by reference, so instances of sub-classes -/// do not have to be heap allocated. Once passed, the instance must -/// not be deleted until its operator() is called or the container has -/// stopped. -class void_function0 { - public: - virtual ~void_function0() {} - /// Override the call operator with your code. - virtual void operator()() = 0; -}; - -} - -#endif // PROTON_FUNCTION_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/fwd.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/fwd.hpp b/proton-c/bindings/cpp/include/proton/fwd.hpp deleted file mode 100644 index 3ed9283..0000000 --- a/proton-c/bindings/cpp/include/proton/fwd.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef PROTON_FWD_HPP -#define PROTON_FWD_HPP - -/* - * - * 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. - * - */ - -namespace proton { - -class annotation_key; -class connection; -class connection_options; -class container; -class delivery; -class error_condition; -class event; -class message; -class message_id; -class messaging_handler; -class listen_handler; -class listener; -class receiver; -class receiver_iterator; -class receiver_options; -class reconnect_timer; -class sasl; -class sender; -class sender_iterator; -class sender_options; -class session; -class session_options; -class source_options; -class ssl; -class target_options; -class tracker; -class transport; -class url; -class void_function0; - - -namespace io { - -class connection_driver; - -} - -template <class T> class returned; -template <class T> class thread_safe; - -} - -#endif // PROTON_FWD_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/internal/cached_map.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/internal/cached_map.hpp b/proton-c/bindings/cpp/include/proton/internal/cached_map.hpp deleted file mode 100644 index 4f388a1..0000000 --- a/proton-c/bindings/cpp/include/proton/internal/cached_map.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef PROTON_CPP_CACHED_MAP_H -#define PROTON_CPP_CACHED_MAP_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 "./config.hpp" -#include "./export.hpp" -#include "./pn_unique_ptr.hpp" - -#include <cstddef> - -namespace proton { - -namespace codec { -class decoder; -class encoder; -} - -namespace internal { - -template <class key_type, class value_type> -class map_type_impl; - -/// A convenience class to view and manage AMQP map data contained in -/// a proton::value. An internal cache of the map data is created as -/// needed. -template <class K, class V> -class cached_map; - -template <class K, class V> -PN_CPP_EXTERN proton::codec::decoder& operator>>(proton::codec::decoder& d, cached_map<K,V>& m); -template <class K, class V> -PN_CPP_EXTERN proton::codec::encoder& operator<<(proton::codec::encoder& e, const cached_map<K,V>& m); - -template <class key_type, class value_type> -class PN_CPP_CLASS_EXTERN cached_map { - typedef map_type_impl<key_type, value_type> map_type; - - public: - PN_CPP_EXTERN cached_map(); - PN_CPP_EXTERN cached_map(const cached_map& cm); - PN_CPP_EXTERN cached_map& operator=(const cached_map& cm); -#if PN_CPP_HAS_RVALUE_REFERENCES - PN_CPP_EXTERN cached_map(cached_map&&); - PN_CPP_EXTERN cached_map& operator=(cached_map&&); -#endif - PN_CPP_EXTERN ~cached_map(); - - PN_CPP_EXTERN value_type get(const key_type& k) const; - PN_CPP_EXTERN void put(const key_type& k, const value_type& v); - PN_CPP_EXTERN size_t erase(const key_type& k); - PN_CPP_EXTERN bool exists(const key_type& k) const; - PN_CPP_EXTERN size_t size(); - PN_CPP_EXTERN void clear(); - PN_CPP_EXTERN bool empty(); - - /// @cond INTERNAL - private: - pn_unique_ptr<map_type> map_; - - void make_cached_map(); - - friend PN_CPP_EXTERN proton::codec::decoder& operator>> <>(proton::codec::decoder& d, cached_map<key_type, value_type>& m); - friend PN_CPP_EXTERN proton::codec::encoder& operator<< <>(proton::codec::encoder& e, const cached_map<key_type, value_type>& m); - /// @endcond -}; - - -} -} - -#endif // PROTON_CPP_CACHED_MAP_H http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/internal/comparable.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/internal/comparable.hpp b/proton-c/bindings/cpp/include/proton/internal/comparable.hpp deleted file mode 100644 index b93ec4b..0000000 --- a/proton-c/bindings/cpp/include/proton/internal/comparable.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef PROTON_INTERNAL_COMPARABLE_HPP -#define PROTON_INTERNAL_COMPARABLE_HPP - -/* - * - * 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. - * - */ - -namespace proton { -namespace internal { - -/// Base class for comparable types with operator< and -/// operator==. Provides remaining operators. -template <class T> class comparable { - friend bool operator>(const T &a, const T &b) { return b < a; } - friend bool operator<=(const T &a, const T &b) { return !(a > b); } - friend bool operator>=(const T &a, const T &b) { return !(a < b); } - friend bool operator!=(const T &a, const T &b) { return !(a == b); } -}; - -} // internal -} // proton - -#endif // PROTON_INTERNAL_COMPARABLE_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/internal/config.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/internal/config.hpp b/proton-c/bindings/cpp/include/proton/internal/config.hpp deleted file mode 100644 index 563a304..0000000 --- a/proton-c/bindings/cpp/include/proton/internal/config.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef PROTON_INTERNAL_CONFIG_HPP -#define PROTON_INTERNAL_CONFIG_HPP - -/* - * - * 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. - * - */ - -/// @cond INTERNAL - -/// @file -/// -/// Configuration macros. They can be set via -D compiler options or -/// in code. -/// -/// On a C++11 compliant compiler, all C++11 features are enabled by -/// default. Otherwise they can be enabled or disabled separately -/// with -D on the compile line. - -#ifndef PN_CPP_HAS_CPP11 -#if defined(__cplusplus) && __cplusplus >= 201100 -#define PN_CPP_HAS_CPP11 1 -#else -#define PN_CPP_HAS_CPP11 0 -#endif -#endif - -#ifndef PN_CPP_HAS_SHARED_PTR -#define PN_CPP_HAS_SHARED_PTR PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_UNIQUE_PTR -#define PN_CPP_HAS_UNIQUE_PTR PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_LONG_LONG -#define PN_CPP_HAS_LONG_LONG PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_NULLPTR -#define PN_CPP_HAS_NULLPTR PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_RVALUE_REFERENCES -#define PN_CPP_HAS_RVALUE_REFERENCES PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_OVERRIDE -#define PN_CPP_HAS_OVERRIDE PN_CPP_HAS_CPP11 -#endif - -#if PN_CPP_HAS_OVERRIDE -#define PN_CPP_OVERRIDE override -#else -#define PN_CPP_OVERRIDE -#endif - -#ifndef PN_CPP_HAS_EXPLICIT_CONVERSIONS -#define PN_CPP_HAS_EXPLICIT_CONVERSIONS PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_DEFAULTED_FUNCTIONS -#define PN_CPP_HAS_DEFAULTED_FUNCTIONS PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_DELETED_FUNCTIONS -#define PN_CPP_HAS_DELETED_FUNCTIONS PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_STD_FUNCTION -#define PN_CPP_HAS_STD_FUNCTION PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_STD_BIND -#define PN_CPP_HAS_STD_BIND PN_CPP_HAS_CPP11 -#endif - -#ifndef PN_CPP_HAS_CHRONO -#define PN_CPP_HAS_CHRONO PN_CPP_HAS_CPP11 -#endif - -#endif // PROTON_INTERNAL_CONFIG_HPP - -/// @endcond http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/internal/data.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/internal/data.hpp b/proton-c/bindings/cpp/include/proton/internal/data.hpp deleted file mode 100644 index bfc0e33..0000000 --- a/proton-c/bindings/cpp/include/proton/internal/data.hpp +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef PROTON_INTERNAL_DATA_HPP -#define PROTON_INTERNAL_DATA_HPP - -/* - * - * 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 "../internal/object.hpp" -#include "../types_fwd.hpp" - -struct pn_data_t; - -namespace proton { - -class value; - -namespace internal { - -/// @cond INTERNAL -/// Wrapper for a proton data object. -class data : public object<pn_data_t> { - /// Wrap an existing proton-C data object. - data(pn_data_t* d) : internal::object<pn_data_t>(d) {} - - public: - /// Create an empty data. - data() : internal::object<pn_data_t>(0) {} - - /// Create a new data object. - PN_CPP_EXTERN static data create(); - - /// Copy the contents of another data object. - PN_CPP_EXTERN void copy(const data&); - - /// Clear the data. - PN_CPP_EXTERN void clear(); - - /// Rewind current position to the start. - PN_CPP_EXTERN void rewind(); - - /// True if there are no values. - PN_CPP_EXTERN bool empty() const; - - /// Append the contents of another data object. - PN_CPP_EXTERN int append(data src); - - /// Append up to limit items from data object. - PN_CPP_EXTERN int appendn(data src, int limit); - - PN_CPP_EXTERN bool next(); - PN_CPP_EXTERN void* point() const; - PN_CPP_EXTERN void restore(void* h); - - protected: - void narrow(); - void widen(); - - friend class internal::factory<data>; - friend struct state_guard; - friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const data&); -}; -/// @endcond - -/// **Experimental** - Save and restore codec state -/// -/// A state_guard saves the state and restores it in the destructor -/// unless cancel() is called. -struct state_guard { - /// @cond INTERNAL - data& data_; - void* point_; - bool cancel_; - /// @endcond - - /// @cond INTERNAL - state_guard(data& d) : data_(d), point_(data_.point()), cancel_(false) {} - /// @endcond - - ~state_guard() { if (!cancel_) data_.restore(point_); } - - /// Discard the saved state. - void cancel() { cancel_ = true; } -}; - -} // internal -} // proton - -#endif // PROTON_INTERNAL_DATA_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/internal/export.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/internal/export.hpp b/proton-c/bindings/cpp/include/proton/internal/export.hpp deleted file mode 100644 index 4c95956..0000000 --- a/proton-c/bindings/cpp/include/proton/internal/export.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef PROTON_INTERNAL_EXPORT_HPP -#define PROTON_INTERNAL_EXPORT_HPP - -/* - * - * 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. - * - */ - -/// @cond INTERNAL - -/// import/export macros -#if defined(WIN32) && !defined(PN_CPP_DECLARE_STATIC) - // - // Import and Export definitions for Windows: - // -# define PN_CPP_EXPORT __declspec(dllexport) -# define PN_CPP_IMPORT __declspec(dllimport) -# define PN_CPP_CLASS_EXPORT -# define PN_CPP_CLASS_IMPORT -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# define PN_CPP_EXPORT __global -# define PN_CPP_IMPORT -# define PN_CPP_CLASS_EXPORT __global -# define PN_CPP_CLASS_IMPORT -#else - // - // Non-Windows (Linux, etc.) definitions: - // -# define PN_CPP_EXPORT __attribute ((visibility ("default"))) -# define PN_CPP_IMPORT -# define PN_CPP_CLASS_EXPORT __attribute ((visibility ("default"))) -# define PN_CPP_CLASS_IMPORT -#endif - -// For qpid-proton-cpp library symbols -#ifdef qpid_proton_cpp_EXPORTS -# define PN_CPP_EXTERN PN_CPP_EXPORT -# define PN_CPP_CLASS_EXTERN PN_CPP_CLASS_EXPORT -#else -# define PN_CPP_EXTERN PN_CPP_IMPORT -# define PN_CPP_CLASS_EXTERN PN_CPP_CLASS_IMPORT -#endif - -/// @endcond - -#endif // PROTON_INTERNAL_EXPORT_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/internal/object.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/internal/object.hpp b/proton-c/bindings/cpp/include/proton/internal/object.hpp deleted file mode 100644 index d492b80..0000000 --- a/proton-c/bindings/cpp/include/proton/internal/object.hpp +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef PROTON_INTERNAL_OBJECT_HPP -#define PROTON_INTERNAL_OBJECT_HPP - -/* - * - * 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 "./config.hpp" -#include "./export.hpp" -#include "./comparable.hpp" - -#include <memory> -#include <string> - -namespace proton { - -template <class T> class thread_safe; - -namespace internal { - -class pn_ptr_base { - protected: - PN_CPP_EXTERN static void incref(void* p); - PN_CPP_EXTERN static void decref(void* p); - PN_CPP_EXTERN static std::string inspect(void* p); -}; - -template <class T> class pn_ptr : private pn_ptr_base, private comparable<pn_ptr<T> > { - public: - pn_ptr() : ptr_(0) {} - pn_ptr(T* p) : ptr_(p) { incref(ptr_); } - pn_ptr(const pn_ptr& o) : ptr_(o.ptr_) { incref(ptr_); } - -#if PN_CPP_HAS_RVALUE_REFERENCES - pn_ptr(pn_ptr&& o) : ptr_(0) { std::swap(ptr_, o.ptr_); } -#endif - - ~pn_ptr() { decref(ptr_); } - - pn_ptr& operator=(pn_ptr o) { std::swap(ptr_, o.ptr_); return *this; } - - T* get() const { return ptr_; } - T* release() { T *p = ptr_; ptr_ = 0; return p; } - - bool operator!() const { return !ptr_; } - -#if PN_CPP_HAS_EXPLICIT_CONVERSIONS - explicit operator bool() const { return !!ptr_; } -#endif - - std::string inspect() const { return pn_ptr_base::inspect(ptr_); } - - static pn_ptr take_ownership(T* p) { return pn_ptr<T>(p, true); } - - private: - T *ptr_; - - // Note that it is the presence of the bool in the constructor signature that matters - // to get the "transfer ownership" constructor: The value of the bool isn't checked. - pn_ptr(T* p, bool) : ptr_(p) {} - - friend bool operator==(const pn_ptr& a, const pn_ptr& b) { return a.ptr_ == b.ptr_; } - friend bool operator<(const pn_ptr& a, const pn_ptr& b) { return a.ptr_ < b.ptr_; } -}; - -template <class T> pn_ptr<T> take_ownership(T* p) { return pn_ptr<T>::take_ownership(p); } - -/// Base class for proton object types. -template <class T> class object : private comparable<object<T> > { - public: - bool operator!() const { return !object_; } -#if PN_CPP_HAS_EXPLICIT_CONVERSIONS - explicit operator bool() const { return object_; } -#endif - - protected: - typedef T pn_type; - object(pn_ptr<T> o) : object_(o) {} - T* pn_object() const { return object_.get(); } - - private: - pn_ptr<T> object_; - - friend bool operator==(const object& a, const object& b) { return a.object_ == b.object_; } - friend bool operator<(const object& a, const object& b) { return a.object_ < b.object_; } - friend std::ostream& operator<<(std::ostream& o, const object& a) { o << a.object_.inspect(); return o; } - template <class U> friend class proton::thread_safe; -}; - -/// Factory class used internally to make wrappers and extract proton objects -template <class T> class factory; - -} // internal -} // proton - -#endif // PROTON_INTERNAL_OBJECT_HPP --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
