http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Decoder.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Decoder.hpp b/proton-c/bindings/cpp/include/proton/Decoder.hpp deleted file mode 100644 index 11cd5fb..0000000 --- a/proton-c/bindings/cpp/include/proton/Decoder.hpp +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef DECODER_H -#define DECODER_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/Data.hpp" -#include "proton/Error.hpp" -#include "proton/type_traits.hpp" -#include "proton/types.hpp" -#include <iosfwd> - -namespace proton { - -class Value; - -/** Raised by Decoder operations on error */ -struct DecodeError : public Error { PN_CPP_EXTERN explicit DecodeError(const std::string&) throw(); }; - -/**@file - * Stream-like decoder from AMQP bytes to C++ values. - * @ingroup cpp - */ - -/** -@ingroup cpp - -Stream-like decoder from AMQP bytes to a stream of C++ values. - -types.h defines C++ types corresponding to AMQP types. - -Decoder operator>> will extract AMQP types into corresponding C++ types, and do -simple conversions, e.g. from AMQP integer types to corresponding or larger C++ -integer types. - -You can require an exact AMQP type using the `as<type>(value)` helper. E.g. - - Int i; - decoder >> as<INT>(i): // Will throw if decoder does not contain an INT - -You can also use the `as` helper to extract an AMQP list, array or map into C++ containers. - - std::vector<Int> v; - decoder >> as<LIST>(v); // Extract a list of INT. - -AMQP maps can be inserted/extracted to any container with pair<X,Y> as -value_type, which includes std::map and std::unordered_map but also for -example std::vector<std::pair<X,Y> >. This allows you to perserve order when -extracting AMQP maps. - -You can also extract container values element-by-element, see the Start class. -*/ -class Decoder : public virtual Data { - public: - - PN_CPP_EXTERN Decoder(); - PN_CPP_EXTERN ~Decoder(); - - /** Copy AMQP data from a byte buffer into the Decoder. */ - PN_CPP_EXTERN Decoder(const char* buffer, size_t size); - - /** Copy AMQP data from a std::string into the Decoder. */ - PN_CPP_EXTERN Decoder(const std::string&); - - /** Decode AMQP data from a byte buffer onto the end of the value stream. */ - PN_CPP_EXTERN void decode(const char* buffer, size_t size); - - /** Decode AMQP data from bytes in std::string onto the end of the value stream. */ - PN_CPP_EXTERN void decode(const std::string&); - - /** Return true if there are more values to read at the current level. */ - PN_CPP_EXTERN bool more() const; - - /** Type of the next value that will be read by operator>> - *@throw Error if empty(). - */ - PN_CPP_EXTERN TypeId type() const; - - /** @name Extract simple types - * Overloads to extract simple types. - * @throw Error if the Decoder is empty or the current value has an incompatible type. - * @{ - */ - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Null); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Bool&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ubyte&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Byte&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ushort&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Short&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uint&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Int&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Char&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ulong&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Long&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Timestamp&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Float&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Double&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal32&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal64&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal128&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uuid&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, std::string&); - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&); - ///@} - - /** Extract and return a value of type T. */ - template <class T> T get() { T value; *this >> value; return value; } - - /** Extract and return a value of type T, as AMQP type. */ - template <class T, TypeId A> T getAs() { T value; *this >> as<A>(value); return value; } - - /** Call Decoder::start() in constructor, Decoder::finish in destructor() */ - struct Scope : public Start { - Decoder& decoder; - Scope(Decoder& d) : decoder(d) { d >> *this; } - ~Scope() { decoder >> finish(); } - }; - - template <TypeId A, class T> friend Decoder& operator>>(Decoder& d, Ref<T, A> ref) { - d.checkType(A); - d >> ref.value; - return d; - } - - /** start extracting a container value, one of array, list, map, described. - * The basic pattern is: - * - * Start s; - * decoder >> s; - * // check s.type() to see if this is an ARRAY, LIST, MAP or DESCRIBED type. - * if (s.described) extract the descriptor... - * for (size_t i = 0; i < s.size(); ++i) Extract each element... - * decoder >> finish(); - * - * The first value of an ARRAY is a descriptor if Start::descriptor is true, - * followed by Start::size elemets of type Start::element. - * - * A LIST has Start::size elements which may be of mixed type. - * - * A MAP has Start::size elements which alternate key, value, key, value... - * and may be of mixed type. - * - * A DESCRIBED contains a descriptor and a single element, so it always has - * Start::described=true and Start::size=1. - * - * Note Scope automatically calls finish() in its destructor. - * - *@throw decoder::error if the curent value is not a container type. - */ - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Start&); - - /** Finish extracting a container value. */ - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Finish); - - /** Skip a value */ - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Skip); - - private: - template <class T> Decoder& extract(T& value); - PN_CPP_EXTERN void checkType(TypeId); - - friend class Value; - friend class Encoder; -}; - -// operator >> for integer types that are not covered by the standard overrides. -template <class T> -typename std::enable_if<IsUnknownInteger<T>::value, Decoder&>::type operator>>(Decoder& d, T& i) { - typename IntegerType<sizeof(T), std::is_signed<T>::value>::type v; - d >> v; // Extract as a known integer type - i = v; - return d; -} - -template <class T> Decoder& operator>>(Decoder& d, Ref<T, ARRAY> ref) { - Decoder::Scope s(d); - if (s.isDescribed) d >> skip(); - ref.value.clear(); - ref.value.resize(s.size); - for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i) { - d >> *i; - } - return d; -} - -template <class T> Decoder& operator>>(Decoder& d, Ref<T, LIST> ref) { - Decoder::Scope s(d); - ref.value.clear(); - ref.value.resize(s.size); - for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i) - d >> *i; - return d; -} - -template <class T> Decoder& operator>>(Decoder& d, Ref<T, MAP> ref) { - Decoder::Scope m(d); - ref.value.clear(); - for (size_t i = 0; i < m.size/2; ++i) { - typename T::key_type k; - typename T::mapped_type v; - d >> k >> v; - ref.value[k] = v; - } - return d; -} - -} -#endif // DECODER_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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 110b1ce..0000000 --- a/proton-c/bindings/cpp/include/proton/Delivery.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef PROTON_CPP_DELIVERY_H -#define PROTON_CPP_DELIVERY_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/ProtonHandle.hpp" - -#include "proton/delivery.h" -#include "proton/disposition.h" - -namespace proton { -namespace reactor { - -class Delivery : public ProtonHandle<pn_delivery_t> -{ - public: - - enum state { - NONE = 0, - RECEIVED = PN_RECEIVED, - ACCEPTED = PN_ACCEPTED, - REJECTED = PN_REJECTED, - RELEASED = PN_RELEASED, - MODIFIED = PN_MODIFIED - }; // AMQP spec 3.4 Delivery State - - PN_CPP_EXTERN Delivery(pn_delivery_t *d); - PN_CPP_EXTERN Delivery(); - PN_CPP_EXTERN ~Delivery(); - PN_CPP_EXTERN Delivery(const Delivery&); - PN_CPP_EXTERN Delivery& operator=(const Delivery&); - PN_CPP_EXTERN bool settled(); - PN_CPP_EXTERN void settle(); - PN_CPP_EXTERN pn_delivery_t *getPnDelivery(); - private: - friend class ProtonImplRef<Delivery>; -}; - -}} - -#endif /*!PROTON_CPP_DELIVERY_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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 596b4d0..0000000 --- a/proton-c/bindings/cpp/include/proton/Duration.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef PROTON_CPP_DURATION_H -#define PROTON_CPP_DURATION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "proton/export.hpp" -#include "proton/types.hpp" - -namespace proton { - -/** @ingroup cpp - * A duration is a time in milliseconds. - */ -class Duration : public Comparable<Duration> -{ - public: - std::uint64_t milliseconds; - explicit Duration(std::uint64_t ms) : milliseconds(ms) {} - - bool operator<(Duration d) { return milliseconds < d.milliseconds; } - bool operator==(Duration d) { return milliseconds == d.milliseconds; } - - PN_CPP_EXTERN static const Duration FOREVER; - PN_CPP_EXTERN static const Duration IMMEDIATE; - PN_CPP_EXTERN static const Duration SECOND; - PN_CPP_EXTERN static const Duration MINUTE; -}; - -inline Duration operator*(Duration d, std::uint64_t n) { return Duration(d.milliseconds*n); } -inline Duration operator*(std::uint64_t n, Duration d) { return d * n; } - -inline Timestamp operator+(Timestamp ts, Duration d) { return Timestamp(ts.milliseconds+d.milliseconds); } -inline Timestamp operator+(Duration d, Timestamp ts) { return ts + d; } -} - -#endif /*!PROTON_CPP_DURATION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Encoder.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Encoder.hpp b/proton-c/bindings/cpp/include/proton/Encoder.hpp deleted file mode 100644 index 8b2f77c..0000000 --- a/proton-c/bindings/cpp/include/proton/Encoder.hpp +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef ENCODER_H -#define ENCODER_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/Data.hpp" -#include "proton/Error.hpp" -#include "proton/types.hpp" -#include "proton/type_traits.hpp" -#include <iosfwd> - -#include <iostream> // FIXME aconway 2015-06-18: - -struct pn_data_t; - -namespace proton { - -class Value; - -/**@file - * Stream-like encoder from C++ values to AMQP bytes. - * @ingroup cpp -*/ - -/** Raised by Encoder operations on error */ -struct EncodeError : public Error { PN_CPP_EXTERN explicit EncodeError(const std::string&) throw(); }; - -/** -@ingroup cpp - -types.h defines C++ typedefs and types for AMQP each type. These types -insert as the corresponding AMQP type. Normal C++ conversion rules apply if you -insert any other type. - -C++ containers can be inserted as AMQP containers with the as() helper functions. E.g. - - std::vector<Symbol> v; encoder << as<List>(v); - -AMQP maps can be inserted/extracted to any container with pair<X,Y> as -value_type, which includes std::map and std::unordered_map but also for -example std::vector<std::pair<X,Y> >. This allows you to perserve order when -extracting AMQP maps. - -You can also insert containers element-by-element, see the Start class. -*/ -class Encoder : public virtual Data { - public: - PN_CPP_EXTERN Encoder(); - PN_CPP_EXTERN ~Encoder(); - - /** - * 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, 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 simple types. - *@{ - */ - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Null); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Bool); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Ubyte); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Byte); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Ushort); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Short); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Uint); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Int); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Char); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Ulong); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Long); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Timestamp); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Float); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Double); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Decimal32); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Decimal64); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Decimal128); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Uuid); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, String); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Symbol); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Binary); - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, const Value&); - ///@} - - /** Start a container type. See the Start class. */ - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, const Start&); - - /** Finish a container type. */ - friend PN_CPP_EXTERN Encoder& operator<<(Encoder& e, Finish); - - - /**@name Insert values returned by the as<TypeId> helper. - *@{ - */ - template <class T, TypeId A> friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, CRef<T, A>); - template <class T> friend Encoder& operator<<(Encoder&, CRef<T, ARRAY>); - template <class T> friend Encoder& operator<<(Encoder&, CRef<T, LIST>); - template <class T> friend Encoder& operator<<(Encoder&, CRef<T, MAP>); - // TODO aconway 2015-06-16: DESCRIBED. - ///@} - - /** Copy data from a raw pn_data_t */ - friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, pn_data_t*); - - private: - PN_CPP_EXTERN Encoder(pn_data_t* pd); - - friend class Value; -}; - -// Need to disambiguate char* conversion to bool and std::string as String. -inline Encoder& operator<<(Encoder& e, char* s) { return e << String(s); } -inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); } -inline Encoder& operator<<(Encoder& e, const std::string& s) { return e << String(s); } - -// operator << for integer types that are not covered by the standard overrides. -template <class T> -typename std::enable_if<IsUnknownInteger<T>::value, Encoder&>::type operator<<(Encoder& e, T i) { - typename IntegerType<sizeof(T), std::is_signed<T>::value>::type v = i; - return e << v; // Insert as a known integer type -} - -// TODO aconway 2015-06-16: described array insertion. - -template <class T> Encoder& operator<<(Encoder& e, CRef<T, ARRAY> a) { - e << Start::array(TypeIdOf<typename T::value_type>::value); - for (typename T::const_iterator i = a.value.begin(); i != a.value.end(); ++i) - e << *i; - e << finish(); - return e; -} - -template <class T> Encoder& operator<<(Encoder& e, CRef<T, LIST> l) { - e << Start::list(); - for (typename T::const_iterator i = l.value.begin(); i != l.value.end(); ++i) - e << *i; - e << finish(); - return e; -} - -template <class T> Encoder& operator<<(Encoder& e, CRef<T, MAP> m){ - e << Start::map(); - for (typename T::const_iterator i = m.value.begin(); i != m.value.end(); ++i) { - e << i->first; - e << i->second; - } - e << finish(); - return e; -} -//@internal Convert a Ref to a CRef. -template <class T, TypeId A> Encoder& operator<<(Encoder& e, Ref<T, A> ref) { - return e << CRef<T,A>(ref); -} - - -} -#endif // ENCODER_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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 645ca0f..0000000 --- a/proton-c/bindings/cpp/include/proton/Endpoint.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef PROTON_CPP_ENDPOINT_H -#define PROTON_CPP_ENDPOINT_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/connection.h" - -namespace proton { -namespace reactor { - -class Handler; -class Connection; -class Transport; - -class Endpoint -{ - public: - enum { - LOCAL_UNINIT = PN_LOCAL_UNINIT, - REMOTE_UNINIT = PN_REMOTE_UNINIT, - LOCAL_ACTIVE = PN_LOCAL_ACTIVE, - REMOTE_ACTIVE = PN_REMOTE_ACTIVE, - LOCAL_CLOSED = PN_LOCAL_CLOSED, - REMOTE_CLOSED = PN_REMOTE_CLOSED - }; - typedef int State; - - // TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler - virtual PN_CPP_EXTERN Connection &getConnection() = 0; - Transport PN_CPP_EXTERN &getTransport(); - protected: - PN_CPP_EXTERN Endpoint(); - PN_CPP_EXTERN ~Endpoint(); -}; - - -}} - -#endif /*!PROTON_CPP_ENDPOINT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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 578c3d6..0000000 --- a/proton-c/bindings/cpp/include/proton/Error.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef PROTON_CPP_EXCEPTIONS_H -#define PROTON_CPP_EXCEPTIONS_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 <stdexcept> -#include <string> -#include "proton/export.hpp" - -namespace proton { - -/** @ingroup cpp - * Functions in the proton namespace throw a subclass of proton::Error on error. - */ -struct Error : public std::runtime_error { PN_CPP_EXTERN explicit Error(const std::string&) throw(); }; - -/** Raised if a message is rejected */ -struct MessageReject : public Error { PN_CPP_EXTERN explicit MessageReject(const std::string&) throw(); }; - -/** Raised if a message is released */ -struct MessageRelease : public Error { PN_CPP_EXTERN explicit MessageRelease(const std::string&) throw(); }; - - -} - -#endif /*!PROTON_CPP_EXCEPTIONS_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Event.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Event.hpp b/proton-c/bindings/cpp/include/proton/Event.hpp deleted file mode 100644 index 3fbb6a7..0000000 --- a/proton-c/bindings/cpp/include/proton/Event.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef PROTON_CPP_EVENT_H -#define PROTON_CPP_EVENT_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/Link.hpp" -#include "proton/Connection.hpp" -#include "proton/Message.hpp" -#include <vector> - - -namespace proton { -namespace reactor { - -class Handler; -class Container; -class Connection; - -class Event -{ - public: - virtual PN_CPP_EXTERN void dispatch(Handler &h) = 0; - virtual PN_CPP_EXTERN Container &getContainer(); - virtual PN_CPP_EXTERN Connection &getConnection(); - virtual PN_CPP_EXTERN Sender getSender(); - virtual PN_CPP_EXTERN Receiver getReceiver(); - virtual PN_CPP_EXTERN Link getLink(); - virtual PN_CPP_EXTERN Message getMessage(); - virtual PN_CPP_EXTERN void setMessage(Message &); - virtual PN_CPP_EXTERN ~Event(); - protected: - PN_CPP_EXTERN Event(); - private: - Event(const Event&); - Event& operator=(const Event&); -}; - -}} - -#endif /*!PROTON_CPP_EVENT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Handle.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Handle.hpp b/proton-c/bindings/cpp/include/proton/Handle.hpp deleted file mode 100644 index 916fd80..0000000 --- a/proton-c/bindings/cpp/include/proton/Handle.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef PROTON_CPP_HANDLE_H -#define PROTON_CPP_HANDLE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "proton/export.hpp" - -namespace proton { -namespace reactor { - -template <class> class PrivateImplRef; -template <class> class ProtonImplRef; - -// FIXME aconway 2015-06-09: don't need handle, get rid of it. - -/** - * A handle is like a pointer: refers to an underlying implementation object. - * Copying the handle does not copy the object. - * - * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the - * conversion to bool to test for a null handle. - */ -template <class T> class Handle { - public: - - /**@return true if handle is valid, i.e. not null. */ - bool isValid() const { return impl; } - - /**@return true if handle is null. It is an error to call any function on a null handle. */ - bool isNull() const { return !impl; } - - /** Conversion to bool supports idiom if (handle) { handle->... } */ - operator bool() const { return impl; } - - /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ - bool operator !() const { return !impl; } - - /** Operator == equal if they point to same non-null object*/ - bool operator ==(const Handle<T>& other) const { return impl == other.impl; } - bool operator !=(const Handle<T>& other) const { return impl != other.impl; } - - void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; } - - private: - // Not implemented, subclasses must implement. - Handle(const Handle&); - Handle& operator=(const Handle&); - - protected: - typedef T Impl; - Handle() : impl() {} - - mutable Impl* impl; - - friend class PrivateImplRef<T>; -}; - -}} - -#endif /*!PROTON_CPP_HANDLE_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Handler.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Handler.hpp b/proton-c/bindings/cpp/include/proton/Handler.hpp deleted file mode 100644 index f7bb23b..0000000 --- a/proton-c/bindings/cpp/include/proton/Handler.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef PROTON_CPP_HANDLER_H -#define PROTON_CPP_HANDLER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/Event.hpp" -#include "proton/event.h" -#include <vector> - -namespace proton { -namespace reactor { - -class Handler -{ - public: - PN_CPP_EXTERN Handler(); - PN_CPP_EXTERN virtual ~Handler(); - - PN_CPP_EXTERN virtual void onUnhandled(Event &e); - - PN_CPP_EXTERN virtual void addChildHandler(Handler &e); - PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin(); - PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd(); - protected: - std::vector<Handler *>childHandlers; -}; - -}} - -#endif /*!PROTON_CPP_HANDLER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Link.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Link.hpp b/proton-c/bindings/cpp/include/proton/Link.hpp deleted file mode 100644 index ac0e471..0000000 --- a/proton-c/bindings/cpp/include/proton/Link.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef PROTON_CPP_LINK_H -#define PROTON_CPP_LINK_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/ProtonHandle.hpp" -#include "proton/Endpoint.hpp" -#include "proton/Terminus.hpp" -#include "proton/types.h" -#include <string> - -struct pn_connection_t; - -namespace proton { -namespace reactor { - -class Link : public Endpoint, public ProtonHandle<pn_link_t> -{ - public: - PN_CPP_EXTERN Link(pn_link_t *); - PN_CPP_EXTERN Link(); - PN_CPP_EXTERN ~Link(); - PN_CPP_EXTERN Link(const Link&); - PN_CPP_EXTERN Link& operator=(const Link&); - PN_CPP_EXTERN void open(); - PN_CPP_EXTERN void close(); - PN_CPP_EXTERN bool isSender(); - PN_CPP_EXTERN bool isReceiver(); - PN_CPP_EXTERN int getCredit(); - PN_CPP_EXTERN Terminus getSource(); - PN_CPP_EXTERN Terminus getTarget(); - PN_CPP_EXTERN Terminus getRemoteSource(); - PN_CPP_EXTERN Terminus getRemoteTarget(); - PN_CPP_EXTERN std::string getName(); - PN_CPP_EXTERN pn_link_t *getPnLink() const; - virtual PN_CPP_EXTERN Connection &getConnection(); - PN_CPP_EXTERN Link getNext(Endpoint::State mask); - protected: - PN_CPP_EXTERN virtual void verifyType(pn_link_t *l); - private: - friend class ProtonImplRef<Link>; - bool senderLink; -}; - -}} - -#include "proton/Sender.hpp" -#include "proton/Receiver.hpp" - -#endif /*!PROTON_CPP_LINK_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Message.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Message.hpp b/proton-c/bindings/cpp/include/proton/Message.hpp deleted file mode 100644 index c98dc31..0000000 --- a/proton-c/bindings/cpp/include/proton/Message.hpp +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef PROTON_CPP_MESSAGE_H -#define PROTON_CPP_MESSAGE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/ProtonHandle.hpp" -#include "proton/Value.hpp" -#include "proton/Message.hpp" -#include <string> - -struct pn_message_t; -struct pn_data_t; - -namespace proton { - -// FIXME aconway 2015-06-17: documentation of properties. -class Message : public reactor::ProtonHandle<pn_message_t> -{ - public: - PN_CPP_EXTERN Message(); - PN_CPP_EXTERN Message(pn_message_t *); - PN_CPP_EXTERN Message(const Message&); - PN_CPP_EXTERN Message& operator=(const Message&); - PN_CPP_EXTERN ~Message(); - - PN_CPP_EXTERN pn_message_t *pnMessage() const; - - PN_CPP_EXTERN void id(const Value& id); - PN_CPP_EXTERN Value id() const; - - PN_CPP_EXTERN void user(const std::string &user); - PN_CPP_EXTERN std::string user() const; - - PN_CPP_EXTERN void address(const std::string &addr); - PN_CPP_EXTERN std::string address() const; - - PN_CPP_EXTERN void subject(const std::string &s); - PN_CPP_EXTERN std::string subject() const; - - PN_CPP_EXTERN void replyTo(const std::string &s); - PN_CPP_EXTERN std::string replyTo() const; - - PN_CPP_EXTERN void correlationId(const Value&); - PN_CPP_EXTERN Value correlationId() const; - - PN_CPP_EXTERN void contentType(const std::string &s); - PN_CPP_EXTERN std::string contentType() const; - - PN_CPP_EXTERN void contentEncoding(const std::string &s); - PN_CPP_EXTERN std::string contentEncoding() const; - - PN_CPP_EXTERN void expiry(Timestamp t); - PN_CPP_EXTERN Timestamp expiry() const; - - PN_CPP_EXTERN void creationTime(Timestamp t); - PN_CPP_EXTERN Timestamp creationTime() const; - - PN_CPP_EXTERN void groupId(const std::string &s); - PN_CPP_EXTERN std::string groupId() const; - - PN_CPP_EXTERN void replyToGroupId(const std::string &s); - PN_CPP_EXTERN std::string replyToGroupId() const; - - /** Set the body to an AMQP value. */ - PN_CPP_EXTERN void body(const Value&); - - /** Template to convert any type to a Value and set as the body */ - template <class T> void body(const T& v) { body(Value(v)); } - - /** Set the body to a sequence of sections containing AMQP values. */ - PN_CPP_EXTERN void body(const Values&); - - PN_CPP_EXTERN const Values& body() const; - - PN_CPP_EXTERN Values& body(); ///< Allows in-place modification of body sections. - - // FIXME aconway 2015-06-17: consistent and flexible treatment of buffers. - // Allow convenient std::string encoding/decoding (with re-use of existing - // string capacity) but also need to allow encoding/decoding of non-string - // buffers. Introduce a buffer type with begin/end pointers? - - PN_CPP_EXTERN void encode(std::string &data); - PN_CPP_EXTERN std::string encode(); - PN_CPP_EXTERN void decode(const std::string &data); - - private: - mutable Values body_; - friend class reactor::ProtonImplRef<Message>; -}; - -} - -#endif /*!PROTON_CPP_MESSAGE_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp b/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp deleted file mode 100644 index 243e049..0000000 --- a/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef PROTON_CPP_MESSAGING_ADAPTER_H -#define PROTON_CPP_MESSAGING_ADAPTER_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/ProtonHandler.hpp" -#include "proton/MessagingHandler.hpp" - -#include "proton/MessagingEvent.hpp" -#include "proton/event.h" -#include "proton/reactor.h" - -namespace proton { -namespace reactor { - -// Combine's Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler - -class MessagingAdapter : public MessagingHandler -{ - public: - PN_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate); - PN_CPP_EXTERN virtual ~MessagingAdapter(); - PN_CPP_EXTERN virtual void onReactorInit(Event &e); - PN_CPP_EXTERN virtual void onLinkFlow(Event &e); - PN_CPP_EXTERN virtual void onDelivery(Event &e); - PN_CPP_EXTERN virtual void onUnhandled(Event &e); - PN_CPP_EXTERN virtual void onConnectionClosed(Event &e); - PN_CPP_EXTERN virtual void onConnectionClosing(Event &e); - PN_CPP_EXTERN virtual void onConnectionError(Event &e); - PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e); - PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e); - PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e); - PN_CPP_EXTERN virtual void onConnectionOpened(Event &e); - PN_CPP_EXTERN virtual void onConnectionOpening(Event &e); - PN_CPP_EXTERN virtual void onSessionClosed(Event &e); - PN_CPP_EXTERN virtual void onSessionClosing(Event &e); - PN_CPP_EXTERN virtual void onSessionError(Event &e); - PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e); - PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e); - PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e); - PN_CPP_EXTERN virtual void onSessionOpened(Event &e); - PN_CPP_EXTERN virtual void onSessionOpening(Event &e); - PN_CPP_EXTERN virtual void onLinkClosed(Event &e); - PN_CPP_EXTERN virtual void onLinkClosing(Event &e); - PN_CPP_EXTERN virtual void onLinkError(Event &e); - PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e); - PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e); - PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e); - PN_CPP_EXTERN virtual void onLinkOpened(Event &e); - PN_CPP_EXTERN virtual void onLinkOpening(Event &e); - PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e); - private: - MessagingHandler &delegate; // The handler for generated MessagingEvent's -}; - -}} - -#endif /*!PROTON_CPP_MESSAGING_ADAPTER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp b/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp deleted file mode 100644 index e80f44b..0000000 --- a/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef PROTON_CPP_MESSAGINGEVENT_H -#define PROTON_CPP_MESSAGINGEVENT_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/ProtonEvent.hpp" -#include "proton/Link.hpp" - -namespace proton { -namespace reactor { - -class Handler; -class Container; -class Connection; - -typedef enum { - PN_MESSAGING_PROTON = 0, // Wrapped pn_event_t - // Covenience events for C++ MessagingHandlers - PN_MESSAGING_ABORT, - PN_MESSAGING_ACCEPTED, - PN_MESSAGING_COMMIT, - PN_MESSAGING_CONNECTION_CLOSED, - PN_MESSAGING_CONNECTION_CLOSING, - PN_MESSAGING_CONNECTION_ERROR, - PN_MESSAGING_CONNECTION_OPENED, - PN_MESSAGING_CONNECTION_OPENING, - PN_MESSAGING_DISCONNECTED, - PN_MESSAGING_FETCH, - PN_MESSAGING_ID_LOADED, - PN_MESSAGING_LINK_CLOSED, - PN_MESSAGING_LINK_CLOSING, - PN_MESSAGING_LINK_OPENED, - PN_MESSAGING_LINK_OPENING, - PN_MESSAGING_LINK_ERROR, - PN_MESSAGING_MESSAGE, - PN_MESSAGING_QUIT, - PN_MESSAGING_RECORD_INSERTED, - PN_MESSAGING_RECORDS_LOADED, - PN_MESSAGING_REJECTED, - PN_MESSAGING_RELEASED, - PN_MESSAGING_REQUEST, - PN_MESSAGING_RESPONSE, - PN_MESSAGING_SENDABLE, - PN_MESSAGING_SESSION_CLOSED, - PN_MESSAGING_SESSION_CLOSING, - PN_MESSAGING_SESSION_OPENED, - PN_MESSAGING_SESSION_OPENING, - PN_MESSAGING_SESSION_ERROR, - PN_MESSAGING_SETTLED, - PN_MESSAGING_START, - PN_MESSAGING_TIMER, - PN_MESSAGING_TRANSACTION_ABORTED, - PN_MESSAGING_TRANSACTION_COMMITTED, - PN_MESSAGING_TRANSACTION_DECLARED, - PN_MESSAGING_TRANSPORT_CLOSED -} MessagingEventType_t; - -class MessagingEvent : public ProtonEvent -{ - public: - MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c); - MessagingEvent(MessagingEventType_t t, ProtonEvent &parent); - ~MessagingEvent(); - virtual PN_CPP_EXTERN void dispatch(Handler &h); - virtual PN_CPP_EXTERN Connection &getConnection(); - virtual PN_CPP_EXTERN Sender getSender(); - virtual PN_CPP_EXTERN Receiver getReceiver(); - virtual PN_CPP_EXTERN Link getLink(); - virtual PN_CPP_EXTERN Message getMessage(); - virtual PN_CPP_EXTERN void setMessage(Message &); - private: - MessagingEventType_t messagingType; - ProtonEvent *parentEvent; - Message *message; - MessagingEvent operator=(const MessagingEvent&); - MessagingEvent(const MessagingEvent&); -}; - -}} - -#endif /*!PROTON_CPP_MESSAGINGEVENT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp deleted file mode 100644 index ddc8165..0000000 --- a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef PROTON_CPP_MESSAGING_HANDLER_H -#define PROTON_CPP_MESSAGING_HANDLER_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/ProtonHandler.hpp" -#include "proton/Acking.hpp" -#include "proton/event.h" - -namespace proton { -namespace reactor { - -class Event; -class MessagingAdapter; - -class MessagingHandler : public ProtonHandler , public Acking -{ - public: - PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true, - bool peerCloseIsError=false); - PN_CPP_EXTERN virtual ~MessagingHandler(); - - PN_CPP_EXTERN virtual void onAbort(Event &e); - PN_CPP_EXTERN virtual void onAccepted(Event &e); - PN_CPP_EXTERN virtual void onCommit(Event &e); - PN_CPP_EXTERN virtual void onConnectionClosed(Event &e); - PN_CPP_EXTERN virtual void onConnectionClosing(Event &e); - PN_CPP_EXTERN virtual void onConnectionError(Event &e); - PN_CPP_EXTERN virtual void onConnectionOpening(Event &e); - PN_CPP_EXTERN virtual void onConnectionOpened(Event &e); - PN_CPP_EXTERN virtual void onDisconnected(Event &e); - PN_CPP_EXTERN virtual void onFetch(Event &e); - PN_CPP_EXTERN virtual void onIdLoaded(Event &e); - PN_CPP_EXTERN virtual void onLinkClosed(Event &e); - PN_CPP_EXTERN virtual void onLinkClosing(Event &e); - PN_CPP_EXTERN virtual void onLinkError(Event &e); - PN_CPP_EXTERN virtual void onLinkOpened(Event &e); - PN_CPP_EXTERN virtual void onLinkOpening(Event &e); - PN_CPP_EXTERN virtual void onMessage(Event &e); - PN_CPP_EXTERN virtual void onQuit(Event &e); - PN_CPP_EXTERN virtual void onRecordInserted(Event &e); - PN_CPP_EXTERN virtual void onRecordsLoaded(Event &e); - PN_CPP_EXTERN virtual void onRejected(Event &e); - PN_CPP_EXTERN virtual void onReleased(Event &e); - PN_CPP_EXTERN virtual void onRequest(Event &e); - PN_CPP_EXTERN virtual void onResponse(Event &e); - PN_CPP_EXTERN virtual void onSendable(Event &e); - PN_CPP_EXTERN virtual void onSessionClosed(Event &e); - PN_CPP_EXTERN virtual void onSessionClosing(Event &e); - PN_CPP_EXTERN virtual void onSessionError(Event &e); - PN_CPP_EXTERN virtual void onSessionOpened(Event &e); - PN_CPP_EXTERN virtual void onSessionOpening(Event &e); - PN_CPP_EXTERN virtual void onSettled(Event &e); - PN_CPP_EXTERN virtual void onStart(Event &e); - PN_CPP_EXTERN virtual void onTimer(Event &e); - PN_CPP_EXTERN virtual void onTransactionAborted(Event &e); - PN_CPP_EXTERN virtual void onTransactionCommitted(Event &e); - PN_CPP_EXTERN virtual void onTransactionDeclared(Event &e); - PN_CPP_EXTERN virtual void onTransportClosed(Event &e); - - protected: - int prefetch; - bool autoAccept; - bool autoSettle; - bool peerCloseIsError; - MessagingAdapter *messagingAdapter; - Handler *flowController; - PN_CPP_EXTERN MessagingHandler( - bool rawHandler, int prefetch=10, bool autoAccept=true, - bool autoSettle=true, bool peerCloseIsError=false); - private: - friend class ContainerImpl; - friend class MessagingAdapter; - PN_CPP_EXTERN void createHelpers(); -}; - -}} - -#endif /*!PROTON_CPP_MESSAGING_HANDLER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp b/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp deleted file mode 100644 index 0d1d534..0000000 --- a/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef PROTON_CPP_PROTONEVENT_H -#define PROTON_CPP_PROTONEVENT_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/Event.hpp" -#include "proton/Link.hpp" - -namespace proton { -namespace reactor { - -class Handler; -class Container; -class Connection; -class Container; - -class ProtonEvent : public Event -{ - public: - virtual PN_CPP_EXTERN void dispatch(Handler &h); - virtual PN_CPP_EXTERN Container &getContainer(); - virtual PN_CPP_EXTERN Connection &getConnection(); - virtual PN_CPP_EXTERN Sender getSender(); - virtual PN_CPP_EXTERN Receiver getReceiver(); - virtual PN_CPP_EXTERN Link getLink(); - PN_CPP_EXTERN int getType(); - PN_CPP_EXTERN pn_event_t* getPnEvent(); - protected: - PN_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c); - private: - pn_event_t *pnEvent; - int type; - Container &container; -}; - -}} - -#endif /*!PROTON_CPP_PROTONEVENT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp deleted file mode 100644 index da12c09..0000000 --- a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef PROTON_CPP_PROTONHANDLE_H -#define PROTON_CPP_PROTONHANDLE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "proton/export.hpp" - -namespace proton { -namespace reactor { - -template <class> class ProtonImplRef; - -/** - * See Handle.h. Similar but for lightly wrapped Proton pn_object_t targets. - */ -template <class T> class ProtonHandle { - public: - - /**@return true if handle is valid, i.e. not null. */ - bool isValid() const { return impl; } - - /**@return true if handle is null. It is an error to call any function on a null handle. */ - bool isNull() const { return !impl; } - - /** Conversion to bool supports idiom if (handle) { handle->... } */ - operator bool() const { return impl; } - - /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ - bool operator !() const { return !impl; } - - void swap(ProtonHandle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; } - - private: - // Not implemented, subclasses must implement. - ProtonHandle(const ProtonHandle&); - ProtonHandle& operator=(const ProtonHandle&); - - protected: - typedef T Impl; - ProtonHandle() :impl() {} - - mutable Impl* impl; - - friend class ProtonImplRef<T>; -}; - -}} - -#endif /*!PROTON_CPP_PROTONHANDLE_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp deleted file mode 100644 index 3768f78..0000000 --- a/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef PROTON_CPP_PROTONHANDLER_H -#define PROTON_CPP_PROTONHANDLER_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/Handler.hpp" - -namespace proton { -namespace reactor { - -class Event; -class ProtonEvent; - -class ProtonHandler : public Handler -{ - public: - PN_CPP_EXTERN ProtonHandler(); - PN_CPP_EXTERN virtual void onReactorInit(Event &e); - PN_CPP_EXTERN virtual void onReactorQuiesced(Event &e); - PN_CPP_EXTERN virtual void onReactorFinal(Event &e); - PN_CPP_EXTERN virtual void onTimerTask(Event &e); - PN_CPP_EXTERN virtual void onConnectionInit(Event &e); - PN_CPP_EXTERN virtual void onConnectionBound(Event &e); - PN_CPP_EXTERN virtual void onConnectionUnbound(Event &e); - PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e); - PN_CPP_EXTERN virtual void onConnectionLocalClose(Event &e); - PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e); - PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e); - PN_CPP_EXTERN virtual void onConnectionFinal(Event &e); - PN_CPP_EXTERN virtual void onSessionInit(Event &e); - PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e); - PN_CPP_EXTERN virtual void onSessionLocalClose(Event &e); - PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e); - PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e); - PN_CPP_EXTERN virtual void onSessionFinal(Event &e); - PN_CPP_EXTERN virtual void onLinkInit(Event &e); - PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e); - PN_CPP_EXTERN virtual void onLinkLocalClose(Event &e); - PN_CPP_EXTERN virtual void onLinkLocalDetach(Event &e); - PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e); - PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e); - PN_CPP_EXTERN virtual void onLinkRemoteDetach(Event &e); - PN_CPP_EXTERN virtual void onLinkFlow(Event &e); - PN_CPP_EXTERN virtual void onLinkFinal(Event &e); - PN_CPP_EXTERN virtual void onDelivery(Event &e); - PN_CPP_EXTERN virtual void onTransport(Event &e); - PN_CPP_EXTERN virtual void onTransportError(Event &e); - PN_CPP_EXTERN virtual void onTransportHeadClosed(Event &e); - PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e); - PN_CPP_EXTERN virtual void onTransportClosed(Event &e); - PN_CPP_EXTERN virtual void onSelectableInit(Event &e); - PN_CPP_EXTERN virtual void onSelectableUpdated(Event &e); - PN_CPP_EXTERN virtual void onSelectableReadable(Event &e); - PN_CPP_EXTERN virtual void onSelectableWritable(Event &e); - PN_CPP_EXTERN virtual void onSelectableExpired(Event &e); - PN_CPP_EXTERN virtual void onSelectableError(Event &e); - PN_CPP_EXTERN virtual void onSelectableFinal(Event &e); - - PN_CPP_EXTERN virtual void onUnhandled(Event &e); -}; - -}} - -#endif /*!PROTON_CPP_PROTONHANDLER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Receiver.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Receiver.hpp b/proton-c/bindings/cpp/include/proton/Receiver.hpp deleted file mode 100644 index 4f2333e..0000000 --- a/proton-c/bindings/cpp/include/proton/Receiver.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef PROTON_CPP_RECEIVER_H -#define PROTON_CPP_RECEIVER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/Endpoint.hpp" -#include "proton/Link.hpp" -#include "proton/types.h" -#include <string> - -struct pn_connection_t; - -namespace proton { -namespace reactor { - -class Receiver : public Link -{ - public: - PN_CPP_EXTERN Receiver(pn_link_t *lnk); - PN_CPP_EXTERN Receiver(); - PN_CPP_EXTERN Receiver(const Link& c); - protected: - PN_CPP_EXTERN virtual void verifyType(pn_link_t *l); -}; - -}} - -#endif /*!PROTON_CPP_RECEIVER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Sender.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Sender.hpp b/proton-c/bindings/cpp/include/proton/Sender.hpp deleted file mode 100644 index 33e02b7..0000000 --- a/proton-c/bindings/cpp/include/proton/Sender.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef PROTON_CPP_SENDER_H -#define PROTON_CPP_SENDER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/Delivery.hpp" -#include "proton/Link.hpp" -#include "proton/Message.hpp" - -#include "proton/types.h" -#include <string> - -struct pn_connection_t; - -namespace proton { -namespace reactor { - - -class Sender : public Link -{ - public: - PN_CPP_EXTERN Sender(pn_link_t *lnk=0); - PN_CPP_EXTERN Sender(const Link& c); - PN_CPP_EXTERN Delivery send(Message &m); - - protected: - PN_CPP_EXTERN virtual void verifyType(pn_link_t *l); -}; - - -}} - -#endif /*!PROTON_CPP_SENDER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Session.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Session.hpp b/proton-c/bindings/cpp/include/proton/Session.hpp deleted file mode 100644 index eaae4ce..0000000 --- a/proton-c/bindings/cpp/include/proton/Session.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef PROTON_CPP_SESSION_H -#define PROTON_CPP_SESSION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/Endpoint.hpp" -#include "proton/Link.hpp" - -#include "proton/types.h" -#include "proton/link.h" -#include <string> - -struct pn_connection_t; - -namespace proton { -namespace reactor { - -class Container; -class Handler; -class Transport; - - class Session : public Endpoint, public ProtonHandle<pn_session_t> -{ - public: - PN_CPP_EXTERN Session(pn_session_t *s); - PN_CPP_EXTERN Session(); - PN_CPP_EXTERN ~Session(); - PN_CPP_EXTERN void open(); - PN_CPP_EXTERN Session(const Session&); - PN_CPP_EXTERN Session& operator=(const Session&); - PN_CPP_EXTERN void close(); - PN_CPP_EXTERN pn_session_t *getPnSession(); - PN_CPP_EXTERN virtual Connection &getConnection(); - PN_CPP_EXTERN Receiver createReceiver(std::string name); - PN_CPP_EXTERN Sender createSender(std::string name); - private: - friend class ProtonImplRef<Session>; -}; - -}} - -#endif /*!PROTON_CPP_SESSION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Terminus.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Terminus.hpp b/proton-c/bindings/cpp/include/proton/Terminus.hpp deleted file mode 100644 index 91d4f6f..0000000 --- a/proton-c/bindings/cpp/include/proton/Terminus.hpp +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef PROTON_CPP_TERMINUS_H -#define PROTON_CPP_TERMINUS_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/Link.hpp" - -#include "proton/link.h" -#include <string> - -namespace proton { -namespace reactor { - -class Link; - -class Terminus : public ProtonHandle<pn_terminus_t> -{ - enum Type { - TYPE_UNSPECIFIED = PN_UNSPECIFIED, - SOURCE = PN_SOURCE, - TARGET = PN_TARGET, - COORDINATOR = PN_COORDINATOR - }; - enum ExpiryPolicy { - NONDURABLE = PN_NONDURABLE, - CONFIGURATION = PN_CONFIGURATION, - DELIVERIES = PN_DELIVERIES - }; - enum DistributionMode { - MODE_UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED, - COPY = PN_DIST_MODE_COPY, - MOVE = PN_DIST_MODE_MOVE - }; - - public: - PN_CPP_EXTERN Terminus(); - PN_CPP_EXTERN ~Terminus(); - PN_CPP_EXTERN Terminus(const Terminus&); - PN_CPP_EXTERN Terminus& operator=(const Terminus&); - PN_CPP_EXTERN pn_terminus_t *getPnTerminus(); - PN_CPP_EXTERN Type getType(); - PN_CPP_EXTERN void setType(Type); - PN_CPP_EXTERN ExpiryPolicy getExpiryPolicy(); - PN_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy); - PN_CPP_EXTERN DistributionMode getDistributionMode(); - PN_CPP_EXTERN void setDistributionMode(DistributionMode); - PN_CPP_EXTERN std::string getAddress(); - PN_CPP_EXTERN void setAddress(std::string &); - PN_CPP_EXTERN bool isDynamic(); - PN_CPP_EXTERN void setDynamic(bool); - - private: - Link *link; - PN_CPP_EXTERN Terminus(pn_terminus_t *, Link *); - friend class Link; - friend class ProtonImplRef<Terminus>; -}; - - -}} - -#endif /*!PROTON_CPP_TERMINUS_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Transport.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Transport.hpp b/proton-c/bindings/cpp/include/proton/Transport.hpp deleted file mode 100644 index 1a8d39c..0000000 --- a/proton-c/bindings/cpp/include/proton/Transport.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef PROTON_CPP_TRANSPORT_H -#define PROTON_CPP_TRANSPORT_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" -#include "proton/transport.h" -#include <string> - -struct pn_connection_t; - -namespace proton { -namespace reactor { - -class Connection; - -class Transport -{ - public: - PN_CPP_EXTERN Transport(); - PN_CPP_EXTERN ~Transport(); - PN_CPP_EXTERN void bind(Connection &c); - Connection *connection; - pn_transport_t *pnTransport; -}; - - -}} - -#endif /*!PROTON_CPP_TRANSPORT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Value.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Value.hpp b/proton-c/bindings/cpp/include/proton/Value.hpp deleted file mode 100644 index 43a5878..0000000 --- a/proton-c/bindings/cpp/include/proton/Value.hpp +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef VALUE_H -#define VALUE_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/Values.hpp" - -struct pn_data_t; - -/**@file - * Holder for an AMQP value. - * @ingroup cpp - */ -namespace proton { - -/** Holds a single AMQP value. */ -class Value { - public: - PN_CPP_EXTERN Value(); - PN_CPP_EXTERN Value(const Value&); - - /** Converting constructor from any settable value */ - template <class T> explicit Value(const T& v); - - PN_CPP_EXTERN ~Value(); - - PN_CPP_EXTERN Value& operator=(const Value&); - - /** Copy the first value from a raw pn_data_t. */ - PN_CPP_EXTERN Value& operator=(pn_data_t*); - - PN_CPP_EXTERN TypeId type() const; - - /** Set the value. */ - template<class T> void set(const T& value); - /** Get the value. */ - template<class T> void get(T& value) const; - /** Get the value */ - template<class T> T get() const; - - /** Assignment sets the value */ - template<class T> Value& operator=(const T& value); - - /** Conversion operator gets the value */ - template<class T> operator T() const; - - /** insert a value into an Encoder. */ - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&); - - /** Extract a value from a decoder. */ - PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&); - - /** Human readable format */ - PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const Value&); - - PN_CPP_EXTERN bool operator==(const Value&) const; - PN_CPP_EXTERN bool operator !=(const Value& v) const{ return !(*this == v); } - - /** operator < makes Value valid for use as a std::map key. */ - PN_CPP_EXTERN bool operator<(const Value&) const; - bool operator>(const Value& v) const { return v < *this; } - bool operator<=(const Value& v) const { return !(*this > v); } - bool operator>=(const Value& v) const { return !(*this < v); } - - private: - mutable Values values; -}; - -template<class T> void Value::set(const T& value) { - values.clear(); - values << value; -} - -template<class T> void Value::get(T& value) const { - Values& v = const_cast<Values&>(values); - v.rewind() >> value; -} - -template<class T> T Value::get() const { T value; get(value); return value; } - -template<class T> Value& Value::operator=(const T& value) { set(value); return *this; } - -template<class T> Value::operator T() const { return get<T>(); } - -template<class T> Value::Value(const T& value) { set(value); } -} - -#endif // VALUE_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/Values.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/Values.hpp b/proton-c/bindings/cpp/include/proton/Values.hpp deleted file mode 100644 index 275f905..0000000 --- a/proton-c/bindings/cpp/include/proton/Values.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef VALUES_H -#define VALUES_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/Encoder.hpp> -#include <proton/Decoder.hpp> - -/**@file - * Holder for a sequence of AMQP values. - * @ingroup cpp - */ - -namespace proton { - - -/** Holds a sequence of AMQP values, allows inserting and extracting. - * - * After inserting values, call rewind() to extract them. - */ -class Values : public Encoder, public Decoder { - public: - PN_CPP_EXTERN Values(); - PN_CPP_EXTERN Values(const Values&); - - /** Does not take ownership, just a view on the data */ - PN_CPP_EXTERN Values(pn_data_t*); - - PN_CPP_EXTERN ~Values(); - - /** Copy data from another Values */ - PN_CPP_EXTERN Values& operator=(const Values&); - - PN_CPP_EXTERN Values& rewind(); - - friend class Value; - friend class Message; -}; - -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Values&); - -} - -#endif // VALUES_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/WaitCondition.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/WaitCondition.hpp b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp deleted file mode 100644 index c175841..0000000 --- a/proton-c/bindings/cpp/include/proton/WaitCondition.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef PROTON_CPP_WAITCONDITION_H -#define PROTON_CPP_WAITCONDITION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/export.hpp" - -namespace proton { -namespace reactor { - -// Interface class to indicates that an expected contion has been -// achieved, i.e. for BlockingConnection.wait() - -class WaitCondition -{ - public: - PN_CPP_EXTERN virtual ~WaitCondition(); - - // Overide this member function to indicate whether an expected - // condition is achieved and requires no further waiting. - virtual bool achieved() = 0; -}; - - -}} - -#endif /*!PROTON_CPP_WAITCONDITION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/acceptor.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/acceptor.hpp b/proton-c/bindings/cpp/include/proton/acceptor.hpp new file mode 100644 index 0000000..0df9589 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/acceptor.hpp @@ -0,0 +1,49 @@ +#ifndef PROTON_CPP_ACCEPTOR_H +#define PROTON_CPP_ACCEPTOR_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/reactor.h" +#include "proton/export.hpp" +#include "proton/proton_handle.hpp" + +struct pn_connection_t; + +namespace proton { + +class acceptor : public proton_handle<pn_acceptor_t> +{ + public: + PN_CPP_EXTERN acceptor(); + PN_CPP_EXTERN acceptor(pn_acceptor_t *); + PN_CPP_EXTERN acceptor(const acceptor&); + PN_CPP_EXTERN acceptor& operator=(const acceptor&); + PN_CPP_EXTERN ~acceptor(); + + PN_CPP_EXTERN void close(); + private: + friend class proton_impl_ref<acceptor>; +}; + +} + +#endif /*!PROTON_CPP_ACCEPTOR_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/acking.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/acking.hpp b/proton-c/bindings/cpp/include/proton/acking.hpp new file mode 100644 index 0000000..edc2d81 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/acking.hpp @@ -0,0 +1,43 @@ +#ifndef PROTON_CPP_ACKING_H +#define PROTON_CPP_ACKING_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "proton/export.hpp" +#include "proton/delivery.hpp" + +namespace proton { + + +class acking +{ + public: + PN_CPP_EXTERN virtual void accept(delivery &d); + PN_CPP_EXTERN virtual void reject(delivery &d); + PN_CPP_EXTERN virtual void release(delivery &d, bool delivered=true); + PN_CPP_EXTERN virtual void settle(delivery &d, delivery::state s = delivery::REJECTED); +}; + + +} + +#endif /*!PROTON_CPP_ACKING_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/blocking_connection.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp new file mode 100644 index 0000000..27d7cdd --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp @@ -0,0 +1,65 @@ +#ifndef PROTON_CPP_BLOCKINGCONNECTION_H +#define PROTON_CPP_BLOCKINGCONNECTION_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "proton/export.hpp" +#include "proton/handle.hpp" +#include "proton/endpoint.hpp" +#include "proton/container.hpp" +#include "proton/duration.hpp" +#include "proton/messaging_handler.hpp" +#include "proton/types.h" +#include <string> + +struct pn_connection_t; + +namespace proton { + +class container; +class blocking_connection_impl; +class ssl_domain; +class blocking_sender; +class wait_condition; + +class blocking_connection : public handle<blocking_connection_impl> +{ + public: + PN_CPP_EXTERN blocking_connection(); + PN_CPP_EXTERN blocking_connection(const blocking_connection& c); + PN_CPP_EXTERN blocking_connection& operator=(const blocking_connection& c); + PN_CPP_EXTERN ~blocking_connection(); + + PN_CPP_EXTERN blocking_connection(std::string &url, duration = duration::FOREVER, + ssl_domain *ssld=0, container *c=0); + PN_CPP_EXTERN void close(); + + PN_CPP_EXTERN blocking_sender create_sender(std::string &address, handler *h=0); + PN_CPP_EXTERN void wait(wait_condition &condition); + PN_CPP_EXTERN void wait(wait_condition &condition, std::string &msg, duration timeout=duration::FOREVER); + PN_CPP_EXTERN duration timeout(); + private: + friend class private_impl_ref<blocking_connection>; +}; + +} + +#endif /*!PROTON_CPP_BLOCKINGCONNECTION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/blocking_link.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/blocking_link.hpp b/proton-c/bindings/cpp/include/proton/blocking_link.hpp new file mode 100644 index 0000000..c1872a4 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/blocking_link.hpp @@ -0,0 +1,57 @@ +#ifndef PROTON_CPP_BLOCKINGLINK_H +#define PROTON_CPP_BLOCKINGLINK_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "proton/export.hpp" +#include "proton/handle.hpp" +#include "proton/endpoint.hpp" +#include "proton/container.hpp" +#include "proton/duration.hpp" +#include "proton/messaging_handler.hpp" +#include "proton/blocking_connection.hpp" +#include "proton/types.h" +#include <string> + +namespace proton { + +class blocking_connection; + +class blocking_link +{ + public: + PN_CPP_EXTERN void close(); + PN_CPP_EXTERN ~blocking_link(); + protected: + PN_CPP_EXTERN blocking_link(blocking_connection *c, pn_link_t *l); + PN_CPP_EXTERN void wait_for_closed(duration timeout=duration::SECOND); + private: + blocking_connection connection_; + link link_; + PN_CPP_EXTERN void check_closed(); + friend class blocking_connection; + friend class blocking_sender; + friend class blocking_receiver; +}; + +} + +#endif /*!PROTON_CPP_BLOCKINGLINK_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/blocking_sender.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/blocking_sender.hpp b/proton-c/bindings/cpp/include/proton/blocking_sender.hpp new file mode 100644 index 0000000..0df5a9c --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/blocking_sender.hpp @@ -0,0 +1,52 @@ +#ifndef PROTON_CPP_BLOCKINGSENDER_H +#define PROTON_CPP_BLOCKINGSENDER_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "proton/export.hpp" +#include "proton/handle.hpp" +#include "proton/endpoint.hpp" +#include "proton/container.hpp" +#include "proton/duration.hpp" +#include "proton/messaging_handler.hpp" +#include "proton/blocking_link.hpp" +#include "proton/types.h" +#include "proton/delivery.h" +#include <string> + +namespace proton { + +class blocking_connection; +class blocking_link; + +class blocking_sender : public blocking_link +{ + public: + PN_CPP_EXTERN delivery send(message &msg); + PN_CPP_EXTERN delivery send(message &msg, duration timeout); + private: + PN_CPP_EXTERN blocking_sender(blocking_connection &c, sender &l); + friend class blocking_connection; +}; + +} + +#endif /*!PROTON_CPP_BLOCKINGSENDER_H*/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
