http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..91d8bd9 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp @@ -0,0 +1,83 @@ +#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(); + virtual void onReactorInit(Event &e); + virtual void onReactorQuiesced(Event &e); + virtual void onReactorFinal(Event &e); + virtual void onTimerTask(Event &e); + virtual void onConnectionInit(Event &e); + virtual void onConnectionBound(Event &e); + virtual void onConnectionUnbound(Event &e); + virtual void onConnectionLocalOpen(Event &e); + virtual void onConnectionLocalClose(Event &e); + virtual void onConnectionRemoteOpen(Event &e); + virtual void onConnectionRemoteClose(Event &e); + virtual void onConnectionFinal(Event &e); + virtual void onSessionInit(Event &e); + virtual void onSessionLocalOpen(Event &e); + virtual void onSessionLocalClose(Event &e); + virtual void onSessionRemoteOpen(Event &e); + virtual void onSessionRemoteClose(Event &e); + virtual void onSessionFinal(Event &e); + virtual void onLinkInit(Event &e); + virtual void onLinkLocalOpen(Event &e); + virtual void onLinkLocalClose(Event &e); + virtual void onLinkLocalDetach(Event &e); + virtual void onLinkRemoteOpen(Event &e); + virtual void onLinkRemoteClose(Event &e); + virtual void onLinkRemoteDetach(Event &e); + virtual void onLinkFlow(Event &e); + virtual void onLinkFinal(Event &e); + virtual void onDelivery(Event &e); + virtual void onTransport(Event &e); + virtual void onTransportError(Event &e); + virtual void onTransportHeadClosed(Event &e); + virtual void onTransportTailClosed(Event &e); + virtual void onTransportClosed(Event &e); + virtual void onSelectableInit(Event &e); + virtual void onSelectableUpdated(Event &e); + virtual void onSelectableReadable(Event &e); + virtual void onSelectableWritable(Event &e); + virtual void onSelectableExpired(Event &e); + virtual void onSelectableError(Event &e); + virtual void onSelectableFinal(Event &e); + + virtual void onUnhandled(Event &e); +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_PROTONHANDLER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..a913b7b --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/Receiver.hpp @@ -0,0 +1,48 @@ +#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/ImportExport.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: + virtual void verifyType(pn_link_t *l); +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_RECEIVER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..bb39b6d --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/Sender.hpp @@ -0,0 +1,52 @@ +#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/ImportExport.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); + PN_CPP_EXTERN Sender(); + PN_CPP_EXTERN Sender(const Link& c); + PN_CPP_EXTERN Delivery send(Message &m); + protected: + virtual void verifyType(pn_link_t *l); +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_SENDER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..4a3eccc --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/Session.hpp @@ -0,0 +1,63 @@ +#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/ImportExport.hpp" +#include "proton/Endpoint.hpp" +#include "proton/Link.hpp" + +#include "proton/types.h" +#include "proton/link.h" +#include "ProtonImplRef.hpp" +#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(); + virtual PN_CPP_EXTERN Connection &getConnection(); + Receiver createReceiver(std::string name); + Sender createSender(std::string name); + private: + friend class ProtonImplRef<Session>; +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_SESSION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..0b798b3 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/Terminus.hpp @@ -0,0 +1,81 @@ +#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/ImportExport.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>; +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_TERMINUS_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..ca93674 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/Transport.hpp @@ -0,0 +1,48 @@ +#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/ImportExport.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; +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_TRANSPORT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..9448dc5 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/Value.hpp @@ -0,0 +1,98 @@ +#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" + +/**@file + * Holder for an AMQP value. + * @ingroup cpp + */ +namespace proton { +namespace reactor { + +/** Holds a single AMQP value. */ +PN_CPP_EXTERN 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&); + + + 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&); + + bool operator==(const Value&) const; + bool operator !=(const Value& v) const{ return !(*this == v); } + + /** operator < makes Value valid for use as a std::map key. */ + 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/38f57e9d/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 new file mode 100644 index 0000000..0377c0c --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/Values.hpp @@ -0,0 +1,56 @@ +#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 { +namespace reactor { + +/** Holds a sequence of AMQP values, allows inserting and extracting. + * + * After inserting values, call rewind() to extract them. + */ +PN_CPP_EXTERN class Values : public Encoder, public Decoder { + public: + Values(); + Values(const Values&); + ~Values(); + + /** Copy data from another Values */ + Values& operator=(const Values&); + + PN_CPP_EXTERN Values& rewind(); + + private: + friend class Value; +}; + +PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Values&); + +}} + +#endif // VALUES_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 new file mode 100644 index 0000000..a960c42 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp @@ -0,0 +1,45 @@ +#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/ImportExport.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; +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_WAITCONDITION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h deleted file mode 100644 index e4b690c..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h +++ /dev/null @@ -1,50 +0,0 @@ -#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/cpp/ImportExport.h" -#include "proton/cpp/ProtonHandle.h" -#include "proton/reactor.h" - -struct pn_connection_t; - -namespace proton { -namespace reactor { - -class Acceptor : public ProtonHandle<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 ProtonImplRef<Acceptor>; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_ACCEPTOR_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Acking.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acking.h b/proton-c/bindings/cpp/include/proton/cpp/Acking.h deleted file mode 100644 index cfe168c..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Acking.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef PROTON_CPP_ACKING_H -#define PROTON_CPP_ACKING_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "proton/cpp/ImportExport.h" -#include "proton/cpp/Delivery.h" - -namespace proton { -namespace reactor { - - -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); -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_ACKING_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h deleted file mode 100644 index 6b30a20..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h +++ /dev/null @@ -1,67 +0,0 @@ -#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/cpp/ImportExport.h" -#include "proton/cpp/Handle.h" -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Container.h" -#include "proton/cpp/Duration.h" -#include "proton/cpp/MessagingHandler.h" -#include "proton/types.h" -#include <string> - -struct pn_connection_t; - -namespace proton { -namespace reactor { - -class Container; -class BlockingConnectionImpl; -class SslDomain; -class BlockingSender; -class WaitCondition; - -class BlockingConnection : public Handle<BlockingConnectionImpl> -{ - public: - PN_CPP_EXTERN BlockingConnection(); - PN_CPP_EXTERN BlockingConnection(const BlockingConnection& c); - PN_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c); - PN_CPP_EXTERN ~BlockingConnection(); - - PN_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER, - SslDomain *ssld=0, Container *c=0); - PN_CPP_EXTERN void close(); - - PN_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0); - PN_CPP_EXTERN void wait(WaitCondition &condition); - PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER); - PN_CPP_EXTERN Duration getTimeout(); - private: - friend class PrivateImplRef<BlockingConnection>; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_BLOCKINGCONNECTION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h deleted file mode 100644 index f3c86e1..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h +++ /dev/null @@ -1,59 +0,0 @@ -#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/cpp/ImportExport.h" -#include "proton/cpp/Handle.h" -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Container.h" -#include "proton/cpp/Duration.h" -#include "proton/cpp/MessagingHandler.h" -#include "proton/cpp/BlockingConnection.h" -#include "proton/types.h" -#include <string> - -namespace proton { -namespace reactor { - -class BlockingConnection; - -class BlockingLink -{ - public: - PN_CPP_EXTERN void close(); - ~BlockingLink(); - protected: - PN_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l); - PN_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND); - private: - BlockingConnection connection; - Link link; - void checkClosed(); - friend class BlockingConnection; - friend class BlockingSender; - friend class BlockingReceiver; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_BLOCKINGLINK_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h deleted file mode 100644 index a72dbb8..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h +++ /dev/null @@ -1,54 +0,0 @@ -#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/cpp/ImportExport.h" -#include "proton/cpp/Handle.h" -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Container.h" -#include "proton/cpp/Duration.h" -#include "proton/cpp/MessagingHandler.h" -#include "proton/cpp/BlockingLink.h" -#include "proton/types.h" -#include "proton/delivery.h" -#include <string> - -namespace proton { -namespace reactor { - -class BlockingConnection; -class BlockingLink; - -class BlockingSender : public BlockingLink -{ - public: - PN_CPP_EXTERN Delivery send(Message &msg); - PN_CPP_EXTERN Delivery send(Message &msg, Duration timeout); - private: - PN_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l); - friend class BlockingConnection; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_BLOCKINGSENDER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Connection.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Connection.h b/proton-c/bindings/cpp/include/proton/cpp/Connection.h deleted file mode 100644 index 5deea9b..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Connection.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef PROTON_CPP_CONNECTION_H -#define PROTON_CPP_CONNECTION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/cpp/ImportExport.h" -#include "proton/cpp/Handle.h" -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Container.h" -#include "proton/types.h" -#include <string> - -struct pn_connection_t; - -namespace proton { -namespace reactor { - -class Handler; -class Transport; -class Container; -class ConnectionImpl; - -class Connection : public Endpoint, public Handle<ConnectionImpl> -{ - public: - PN_CPP_EXTERN Connection(); - PN_CPP_EXTERN Connection(ConnectionImpl *); - PN_CPP_EXTERN Connection(const Connection& c); - PN_CPP_EXTERN Connection& operator=(const Connection& c); - PN_CPP_EXTERN ~Connection(); - - PN_CPP_EXTERN Connection(Container &c, Handler *h = 0); - PN_CPP_EXTERN Transport &getTransport(); - PN_CPP_EXTERN Handler *getOverride(); - PN_CPP_EXTERN void setOverride(Handler *h); - PN_CPP_EXTERN void open(); - PN_CPP_EXTERN void close(); - PN_CPP_EXTERN pn_connection_t *getPnConnection(); - PN_CPP_EXTERN Container &getContainer(); - PN_CPP_EXTERN std::string getHostname(); - virtual PN_CPP_EXTERN Connection &getConnection(); - PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask); - private: - friend class PrivateImplRef<Connection>; - friend class Connector; - friend class ConnectionImpl; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_CONNECTION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Container.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Container.h b/proton-c/bindings/cpp/include/proton/cpp/Container.h deleted file mode 100644 index f6fdf68..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Container.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef PROTON_CPP_CONTAINER_H -#define PROTON_CPP_CONTAINER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "proton/cpp/ImportExport.h" -#include "proton/cpp/Handle.h" -#include "proton/cpp/Acceptor.h" -#include "proton/cpp/Duration.h" -#include <proton/reactor.h> -#include <string> - -namespace proton { -namespace reactor { - -class DispatchHelper; -class Connection; -class Connector; -class Acceptor; -class ContainerImpl; -class MessagingHandler; -class Sender; -class Receiver; -class Link; - class Handler; - -class Container : public Handle<ContainerImpl> -{ - public: - PN_CPP_EXTERN Container(ContainerImpl *); - PN_CPP_EXTERN Container(const Container& c); - PN_CPP_EXTERN Container& operator=(const Container& c); - PN_CPP_EXTERN ~Container(); - - PN_CPP_EXTERN Container(); - PN_CPP_EXTERN Container(MessagingHandler &mhandler); - PN_CPP_EXTERN Connection connect(std::string &host, Handler *h=0); - PN_CPP_EXTERN void run(); - PN_CPP_EXTERN void start(); - PN_CPP_EXTERN bool process(); - PN_CPP_EXTERN void stop(); - PN_CPP_EXTERN void wakeup(); - PN_CPP_EXTERN bool isQuiesced(); - PN_CPP_EXTERN pn_reactor_t *getReactor(); - PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0); - PN_CPP_EXTERN Sender createSender(std::string &url); - PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr); - PN_CPP_EXTERN Receiver createReceiver(const std::string &url); - PN_CPP_EXTERN Acceptor listen(const std::string &url); - PN_CPP_EXTERN std::string getContainerId(); - PN_CPP_EXTERN Duration getTimeout(); - PN_CPP_EXTERN void setTimeout(Duration timeout); - private: - friend class PrivateImplRef<Container>; -}; - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_CONTAINER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Data.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Data.h b/proton-c/bindings/cpp/include/proton/cpp/Data.h deleted file mode 100644 index ef78a13..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Data.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef DATA_H -#define DATA_H -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include "proton/cpp/ImportExport.h" -#include <iosfwd> - -/**@file - * Base for classes that hold AMQP data. - * @internal - */ -struct pn_data_t; - -namespace proton { -namespace reactor { - -/** Base for classes that hold AMQP data. */ -class Data { - public: - virtual ~Data(); - - /** Copies the data */ - Data& operator=(const Data&); - - /** Clear the data. */ - PN_CPP_EXTERN void clear(); - - /** True if there are no values. */ - PN_CPP_EXTERN bool empty() const; - - /** Human readable representation of data. */ - friend std::ostream& operator<<(std::ostream&, const Data&); - - protected: - /** Takes ownership of pd */ - explicit Data(pn_data_t* pd=0); - mutable pn_data_t* data; -}; - - -}} -#endif // DATA_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Decoder.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h deleted file mode 100644 index 9b6df6e..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h +++ /dev/null @@ -1,219 +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/cpp/Data.h" -#include "proton/cpp/types.h" -#include "proton/cpp/exceptions.h" -#include <iosfwd> - -namespace proton { -namespace reactor { - -class Value; - -/**@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. -*/ -PN_CPP_EXTERN class Decoder : public virtual Data { - public: - /** Raised if a Decoder operation fails */ - struct Error : public ProtonException { - explicit Error(const std::string& msg) throw() : ProtonException(msg) {} - }; - - 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); - void checkType(TypeId); - - // Not implemented - Decoder(const Decoder&); - Decoder& operator=(const Decoder&); - - friend class Value; - friend class Encoder; -}; - -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; -} - -}} // namespace proton::reactor -#endif // DECODER_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Delivery.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h deleted file mode 100644 index 6df658f..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h +++ /dev/null @@ -1,61 +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/cpp/ImportExport.h" -#include "proton/cpp/ProtonHandle.h" - -#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>; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_DELIVERY_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Duration.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Duration.h b/proton-c/bindings/cpp/include/proton/cpp/Duration.h deleted file mode 100644 index bb2a063..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Duration.h +++ /dev/null @@ -1,56 +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/cpp/ImportExport.h" -#include "proton/types.h" - -namespace proton { -namespace reactor { - -/** @ingroup cpp - * A duration is a time in milliseconds. - */ -class Duration -{ - public: - PN_CPP_EXTERN explicit Duration(uint64_t milliseconds); - PN_CPP_EXTERN uint64_t getMilliseconds() const; - 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; - private: - uint64_t milliseconds; -}; - -PN_CPP_EXTERN Duration operator*(const Duration& duration, - uint64_t multiplier); -PN_CPP_EXTERN Duration operator*(uint64_t multiplier, - const Duration& duration); -PN_CPP_EXTERN bool operator==(const Duration& a, const Duration& b); -PN_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b); - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_DURATION_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Encoder.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h deleted file mode 100644 index 8e92881..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h +++ /dev/null @@ -1,184 +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/cpp/Data.h" -#include "proton/cpp/types.h" -#include "proton/cpp/exceptions.h" -#include <iosfwd> - -struct pn_data_t; - -namespace proton { -namespace reactor { - -class Value; - -/**@file - * Stream-like encoder from C++ values to AMQP bytes. - * @ingroup cpp -*/ - -/** -@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: - /** Raised if a Encoder operation fails */ - struct Error : public ProtonException { - explicit Error(const std::string& msg) throw() : ProtonException(msg) {} - }; - - 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. - *@{ - */ - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Null); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ushort); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Short); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uint); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Int); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Char); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ulong); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Long); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Timestamp); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Float); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Double); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal32); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal64); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal128); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uuid); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, String); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Symbol); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Binary); - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&); - ///@} - - /** Start a container type. See the Start class. */ - PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Start&); - - /** Finish a container type. */ - PN_CPP_EXTERN friend Encoder& operator<<(Encoder& e, Finish); - - - /**@name Insert values returned by the as<TypeId> helper. - *@{ - */ - template <class T, TypeId A> friend 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. - ///@} - - private: - PN_CPP_EXTERN Encoder(pn_data_t* pd); - - // Not implemented - Encoder(const Encoder&); - Encoder& operator=(const Encoder&); - - friend class Value; -}; - -/** Encode const char* as string */ -inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); } - -/** Encode char* as string */ -inline Encoder& operator<<(Encoder& e, char* s) { return e << String(s); } - -/** Encode std::string as string */ -inline Encoder& operator<<(Encoder& e, const std::string& s) { return e << String(s); } - -//@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); -} - -// 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; -} - - -}} -#endif // ENCODER_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h deleted file mode 100644 index c3edb59..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h +++ /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/cpp/ImportExport.h" -#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: - Endpoint(); - ~Endpoint(); -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_ENDPOINT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Event.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Event.h b/proton-c/bindings/cpp/include/proton/cpp/Event.h deleted file mode 100644 index c0a3388..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Event.h +++ /dev/null @@ -1,60 +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/cpp/ImportExport.h" -#include "proton/cpp/Link.h" -#include "proton/cpp/Connection.h" -#include "proton/cpp/Message.h" -#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 PN_CPP_EXTERN Event(); - private: - PN_CPP_EXTERN Event(const Event&); - PN_CPP_EXTERN Event& operator=(const Event&); -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_EVENT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Handle.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handle.h b/proton-c/bindings/cpp/include/proton/cpp/Handle.h deleted file mode 100644 index 48fe6b9..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Handle.h +++ /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/cpp/ImportExport.h" - -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. */ - PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; } - - /**@return true if handle is null. It is an error to call any function on a null handle. */ - PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; } - - /** Conversion to bool supports idiom if (handle) { handle->... } */ - PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; } - - /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ - PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; } - - /** Operator == equal if they point to same non-null object*/ - PROTON_CPP_INLINE_EXTERN bool operator ==(const Handle<T>& other) const { return impl == other.impl; } - PROTON_CPP_INLINE_EXTERN 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; - PROTON_CPP_INLINE_EXTERN Handle() :impl() {} - - Impl* impl; - - friend class PrivateImplRef<T>; -}; - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_HANDLE_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Handler.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handler.h b/proton-c/bindings/cpp/include/proton/cpp/Handler.h deleted file mode 100644 index 86b5bbf..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Handler.h +++ /dev/null @@ -1,50 +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/cpp/ImportExport.h" -#include "proton/cpp/Event.h" -#include "proton/event.h" -#include <vector> - -namespace proton { -namespace reactor { - -class PN_CPP_EXTERN 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; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_HANDLER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h deleted file mode 100644 index cbc0626..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef PROTON_CPP_IMPORTEXPORT_H -#define PROTON_CPP_IMPORTEXPORT_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. - * - */ -#if defined(WIN32) && !defined(PROTON_CPP_DECLARE_STATIC) - // - // Import and Export definitions for Windows: - // -# define PROTON_CPP_EXPORT __declspec(dllexport) -# define PROTON_CPP_IMPORT __declspec(dllimport) -#else - // - // Non-Windows (Linux, etc.) definitions: - // -# define PROTON_CPP_EXPORT -# define PROTON_CPP_IMPORT -#endif - - -// For c++ library symbols - -#ifdef protoncpp_EXPORTS -# define PN_CPP_EXTERN PROTON_CPP_EXPORT -#else -# define PN_CPP_EXTERN PROTON_CPP_IMPORT -#endif - -// TODO: -#define PROTON_CPP_INLINE_EXTERN - -#endif /*!PROTON_CPP_IMPORTEXPORT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Link.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Link.h b/proton-c/bindings/cpp/include/proton/cpp/Link.h deleted file mode 100644 index f4b9662..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Link.h +++ /dev/null @@ -1,70 +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/cpp/ImportExport.h" -#include "proton/cpp/ProtonHandle.h" -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Terminus.h" -#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: - virtual void verifyType(pn_link_t *l); - private: - friend class ProtonImplRef<Link>; - bool senderLink; -}; - - -}} // namespace proton::reactor - -#include "proton/cpp/Sender.h" -#include "proton/cpp/Receiver.h" - -#endif /*!PROTON_CPP_LINK_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Message.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Message.h b/proton-c/bindings/cpp/include/proton/cpp/Message.h deleted file mode 100644 index d24cc1b..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Message.h +++ /dev/null @@ -1,116 +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/cpp/ImportExport.h" -#include "proton/cpp/ProtonHandle.h" -#include "proton/message.h" -#include <string> - - -namespace proton { -namespace reactor { - -class Message : public 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 *getPnMessage() const; - - // FIXME aconway 2015-06-11: get rid of get/set prefixes - - // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types. - PN_CPP_EXTERN void setId(uint64_t id); - PN_CPP_EXTERN uint64_t getId(); - PN_CPP_EXTERN void setId(const std::string &id); - PN_CPP_EXTERN std::string getStringId(); - PN_CPP_EXTERN void setId(const char *p, size_t len); - PN_CPP_EXTERN size_t getId(const char **p); - PN_CPP_EXTERN pn_type_t getIdType(); - - PN_CPP_EXTERN void setUserId(const std::string &id); - PN_CPP_EXTERN std::string getUserId(); - - PN_CPP_EXTERN void setAddress(const std::string &addr); - PN_CPP_EXTERN std::string getAddress(); - - PN_CPP_EXTERN void setSubject(const std::string &s); - PN_CPP_EXTERN std::string getSubject(); - - PN_CPP_EXTERN void setReplyTo(const std::string &s); - PN_CPP_EXTERN std::string getReplyTo(); - - PN_CPP_EXTERN void setCorrelationId(uint64_t id); - PN_CPP_EXTERN uint64_t getCorrelationId(); - PN_CPP_EXTERN void setCorrelationId(const std::string &id); - PN_CPP_EXTERN std::string getStringCorrelationId(); - PN_CPP_EXTERN void setCorrelationId(const char *p, size_t len); - PN_CPP_EXTERN size_t getCorrelationId(const char **p); - - // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types. - PN_CPP_EXTERN pn_type_t getCorrelationIdType(); - - PN_CPP_EXTERN void setContentType(const std::string &s); - PN_CPP_EXTERN std::string getContentType(); - - PN_CPP_EXTERN void setContentEncoding(const std::string &s); - PN_CPP_EXTERN std::string getContentEncoding(); - - PN_CPP_EXTERN void setExpiry(pn_timestamp_t t); - PN_CPP_EXTERN pn_timestamp_t getExpiry(); - - PN_CPP_EXTERN void setCreationTime(pn_timestamp_t t); - PN_CPP_EXTERN pn_timestamp_t getCreationTime(); - - PN_CPP_EXTERN void setGroupId(const std::string &s); - PN_CPP_EXTERN std::string getGroupId(); - - PN_CPP_EXTERN void setReplyToGroupId(const std::string &s); - PN_CPP_EXTERN std::string getReplyToGroupId(); - - // FIXME aconway 2015-06-11: use Values for body. - PN_CPP_EXTERN void setBody(const std::string &data); - PN_CPP_EXTERN std::string getBody(); - - PN_CPP_EXTERN void getBody(std::string &str); - - PN_CPP_EXTERN void setBody(const char *, size_t len); - PN_CPP_EXTERN size_t getBody(char *, size_t len); - PN_CPP_EXTERN size_t getBinaryBodySize(); - - - PN_CPP_EXTERN void encode(std::string &data); - PN_CPP_EXTERN void decode(const std::string &data); - - private: - friend class ProtonImplRef<Message>; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_MESSAGE_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h deleted file mode 100644 index 9cf4347..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h +++ /dev/null @@ -1,79 +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/cpp/ProtonHandler.h" -#include "proton/cpp/MessagingHandler.h" - -#include "proton/cpp/MessagingEvent.h" -#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 -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_MESSAGING_ADAPTER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h deleted file mode 100644 index f71cace..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h +++ /dev/null @@ -1,100 +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/cpp/ProtonEvent.h" -#include "proton/cpp/Link.h" - -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&); -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_MESSAGINGEVENT_H*/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
