http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h deleted file mode 100644 index 07b0dde..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h +++ /dev/null @@ -1,97 +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/cpp/ProtonHandler.h" -#include "proton/cpp/Acking.h" -#include "proton/event.h" - -namespace proton { -namespace reactor { - -class Event; -class MessagingAdapter; - -class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking -{ - public: - PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true, - bool peerCloseIsError=false); - virtual ~MessagingHandler(); - - virtual void onAbort(Event &e); - virtual void onAccepted(Event &e); - virtual void onCommit(Event &e); - virtual void onConnectionClosed(Event &e); - virtual void onConnectionClosing(Event &e); - virtual void onConnectionError(Event &e); - virtual void onConnectionOpening(Event &e); - virtual void onConnectionOpened(Event &e); - virtual void onDisconnected(Event &e); - virtual void onFetch(Event &e); - virtual void onIdLoaded(Event &e); - virtual void onLinkClosed(Event &e); - virtual void onLinkClosing(Event &e); - virtual void onLinkError(Event &e); - virtual void onLinkOpened(Event &e); - virtual void onLinkOpening(Event &e); - virtual void onMessage(Event &e); - virtual void onQuit(Event &e); - virtual void onRecordInserted(Event &e); - virtual void onRecordsLoaded(Event &e); - virtual void onRejected(Event &e); - virtual void onReleased(Event &e); - virtual void onRequest(Event &e); - virtual void onResponse(Event &e); - virtual void onSendable(Event &e); - virtual void onSessionClosed(Event &e); - virtual void onSessionClosing(Event &e); - virtual void onSessionError(Event &e); - virtual void onSessionOpened(Event &e); - virtual void onSessionOpening(Event &e); - virtual void onSettled(Event &e); - virtual void onStart(Event &e); - virtual void onTimer(Event &e); - virtual void onTransactionAborted(Event &e); - virtual void onTransactionCommitted(Event &e); - virtual void onTransactionDeclared(Event &e); - 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; - void createHelpers(); -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_MESSAGING_HANDLER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h deleted file mode 100644 index be26d83..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h +++ /dev/null @@ -1,57 +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/cpp/Event.h" -#include "proton/cpp/Link.h" - -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; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_PROTONEVENT_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h deleted file mode 100644 index 8fe6f4c..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h +++ /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/cpp/ImportExport.h" - -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. */ - 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; } - - 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; - PROTON_CPP_INLINE_EXTERN ProtonHandle() :impl() {} - - Impl* impl; - - friend class ProtonImplRef<T>; -}; - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_PROTONHANDLE_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h deleted file mode 100644 index 4142a2d..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h +++ /dev/null @@ -1,83 +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/cpp/Handler.h" - -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/cpp/Receiver.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h deleted file mode 100644 index a0f45e7..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h +++ /dev/null @@ -1,48 +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/cpp/ImportExport.h" -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Link.h" -#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/cpp/Sender.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Sender.h b/proton-c/bindings/cpp/include/proton/cpp/Sender.h deleted file mode 100644 index 1205f7f..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Sender.h +++ /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/cpp/ImportExport.h" -#include "proton/cpp/Delivery.h" -#include "proton/cpp/Link.h" -#include "proton/cpp/Message.h" - -#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/cpp/Session.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Session.h b/proton-c/bindings/cpp/include/proton/cpp/Session.h deleted file mode 100644 index 8d2f02a..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Session.h +++ /dev/null @@ -1,63 +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/cpp/ImportExport.h" -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Link.h" - -#include "proton/types.h" -#include "proton/link.h" -#include "ProtonImplRef.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(); - 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/cpp/Terminus.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h deleted file mode 100644 index 6f93cf4..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h +++ /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/cpp/ImportExport.h" -#include "proton/cpp/Link.h" - -#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/cpp/Transport.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Transport.h b/proton-c/bindings/cpp/include/proton/cpp/Transport.h deleted file mode 100644 index cd8bf91..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Transport.h +++ /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/cpp/ImportExport.h" -#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/cpp/Value.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Value.h b/proton-c/bindings/cpp/include/proton/cpp/Value.h deleted file mode 100644 index 9555f29..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Value.h +++ /dev/null @@ -1,98 +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/cpp/Values.h" - -/**@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/cpp/Values.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/Values.h b/proton-c/bindings/cpp/include/proton/cpp/Values.h deleted file mode 100644 index 5f62dd9..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/Values.h +++ /dev/null @@ -1,56 +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/cpp/Encoder.h> -#include <proton/cpp/Decoder.h> - -/**@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/cpp/WaitCondition.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h deleted file mode 100644 index f973fa7..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h +++ /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/cpp/ImportExport.h" - -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/exceptions.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/exceptions.h b/proton-c/bindings/cpp/include/proton/cpp/exceptions.h deleted file mode 100644 index 9fdef94..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/exceptions.h +++ /dev/null @@ -1,49 +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> - -namespace proton { -namespace reactor { - -class ProtonException : public std::runtime_error -{ - public: - explicit ProtonException(const std::string& msg) throw() : std::runtime_error(msg) {} -}; - -class MessageReject : public ProtonException -{ - public: - explicit MessageReject(const std::string& msg) throw() : ProtonException(msg) {} -}; - -class MessageRelease : public ProtonException -{ - public: - explicit MessageRelease(const std::string& msg) throw() : ProtonException(msg) {} -}; - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_EXCEPTIONS_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/types.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/cpp/types.h b/proton-c/bindings/cpp/include/proton/cpp/types.h deleted file mode 100644 index edd95b9..0000000 --- a/proton-c/bindings/cpp/include/proton/cpp/types.h +++ /dev/null @@ -1,250 +0,0 @@ -#ifndef TYPES_H -#define TYPES_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/codec.h> -#include "proton/cpp/ImportExport.h" -#include <algorithm> -#include <bitset> -#include <string> -#include <stdint.h> -#include <memory.h> - -/**@file - * C++ types representing AMQP types. - * @ingroup cpp - */ - -namespace proton { -namespace reactor { - -/** TypeId identifies an AMQP type */ -enum TypeId { - NULL_=PN_NULL, ///< The null type, contains no data. - BOOL=PN_BOOL, ///< Boolean true or false. - UBYTE=PN_UBYTE, ///< Unsigned 8 bit integer. - BYTE=PN_BYTE, ///< Signed 8 bit integer. - USHORT=PN_USHORT, ///< Unsigned 16 bit integer. - SHORT=PN_SHORT, ///< Signed 16 bit integer. - UINT=PN_UINT, ///< Unsigned 32 bit integer. - INT=PN_INT, ///< Signed 32 bit integer. - CHAR=PN_CHAR, ///< 32 bit unicode character. - ULONG=PN_ULONG, ///< Unsigned 64 bit integer. - LONG=PN_LONG, ///< Signed 64 bit integer. - TIMESTAMP=PN_TIMESTAMP, ///< Signed 64 bit milliseconds since the epoch. - FLOAT=PN_FLOAT, ///< 32 bit binary floating point. - DOUBLE=PN_DOUBLE, ///< 64 bit binary floating point. - DECIMAL32=PN_DECIMAL32, ///< 32 bit decimal floating point. - DECIMAL64=PN_DECIMAL64, ///< 64 bit decimal floating point. - DECIMAL128=PN_DECIMAL128, ///< 128 bit decimal floating point. - UUID=PN_UUID, ///< 16 byte UUID. - BINARY=PN_BINARY, ///< Variable length sequence of bytes. - STRING=PN_STRING, ///< Variable length utf8-encoded string. - SYMBOL=PN_SYMBOL, ///< Variable length encoded string. - DESCRIBED=PN_DESCRIBED, ///< A descriptor and a value. - ARRAY=PN_ARRAY, ///< A sequence of values of the same type. - LIST=PN_LIST, ///< A sequence of values, may be of mixed types. - MAP=PN_MAP ///< A sequence of key:value pairs, may be of mixed types. -}; - -///@internal -template <class T> struct Comparable {}; -template<class T> bool operator<(const Comparable<T>& a, const Comparable<T>& b) { - return static_cast<const T&>(a) < static_cast<const T&>(b); // operator < provided by type T -} -template<class T> bool operator>(const Comparable<T>& a, const Comparable<T>& b) { return b < a; } -template<class T> bool operator<=(const Comparable<T>& a, const Comparable<T>& b) { return !(a > b); } -template<class T> bool operator>=(const Comparable<T>& a, const Comparable<T>& b) { return !(a < b); } -template<class T> bool operator==(const Comparable<T>& a, const Comparable<T>& b) { return a <= b && b <= a; } -template<class T> bool operator!=(const Comparable<T>& a, const Comparable<T>& b) { return !(a == b); } - -/** - * @name C++ types representing AMQP types. - * @{ - * @ingroup cpp - * These types are all distinct for overloading purposes and will insert as the - * corresponding AMQP type with Encoder operator<<. - */ -struct Null {}; -typedef bool Bool; -typedef uint8_t Ubyte; -typedef int8_t Byte; -typedef uint16_t Ushort; -typedef int16_t Short; -typedef uint32_t Uint; -typedef int32_t Int; -typedef wchar_t Char; -typedef uint64_t Ulong; -typedef int64_t Long; -typedef float Float; -typedef double Double; - -///@internal -pn_bytes_t pn_bytes(const std::string&); - -///@internal -#define STRING_LIKE(NAME) \ - PN_CPP_EXTERN struct NAME : public std::string{ \ - NAME(const std::string& s=std::string()) : std::string(s) {} \ - NAME(const pn_bytes_t& b) : std::string(b.start, b.size) {} \ - operator pn_bytes_t() const { return pn_bytes(*this); } \ - } - -/** UTF-8 encoded string */ -STRING_LIKE(String); -/** ASCII encoded symbolic name */ -STRING_LIKE(Symbol); -/** Binary data */ -STRING_LIKE(Binary); - -///@internal -pn_uuid_t pn_uuid(const std::string&); - -/** UUID is represented as a string but treated as if it always has 16 bytes. */ -PN_CPP_EXTERN struct Uuid : public std::string{ - Uuid(const std::string& s=std::string()) : std::string(s) {} - Uuid(const pn_uuid_t& u) : std::string(&u.bytes[0], sizeof(pn_uuid_t::bytes)) {} - operator pn_uuid_t() const { return pn_uuid(*this); } -}; - -// TODO aconway 2015-06-11: alternative representation of variable-length data -// as pointer to existing buffers. - -// TODO aconway 2015-06-16: usable representation of decimal types. -template <class T> struct Decimal : public Comparable<Decimal<T> > { - char value[sizeof(T)]; - Decimal() { ::memset(value, 0, sizeof(T)); } - Decimal(const T& v) { ::memcpy(value, &v, sizeof(T)); } - operator T() const { return *reinterpret_cast<const T*>(value); } - bool operator<(const Decimal<T>& x) { - return std::lexicographical_compare(value, value+sizeof(T), x.value, x.value+sizeof(T)); - } -}; -typedef Decimal<pn_decimal32_t> Decimal32; -typedef Decimal<pn_decimal64_t> Decimal64; -typedef Decimal<pn_decimal128_t> Decimal128; - -PN_CPP_EXTERN struct Timestamp { - pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970. - Timestamp(int64_t ms=0) : milliseconds(ms) {} - operator pn_timestamp_t() const { return milliseconds; } - bool operator<(const Timestamp& x) { return milliseconds < x.milliseconds; } -}; - -///@} - -template <class T> struct TypeIdOf {}; -template<> struct TypeIdOf<Null> { static const TypeId value=NULL_; }; -template<> struct TypeIdOf<Bool> { static const TypeId value=BOOL; }; -template<> struct TypeIdOf<Ubyte> { static const TypeId value=UBYTE; }; -template<> struct TypeIdOf<Byte> { static const TypeId value=BYTE; }; -template<> struct TypeIdOf<Ushort> { static const TypeId value=USHORT; }; -template<> struct TypeIdOf<Short> { static const TypeId value=SHORT; }; -template<> struct TypeIdOf<Uint> { static const TypeId value=UINT; }; -template<> struct TypeIdOf<Int> { static const TypeId value=INT; }; -template<> struct TypeIdOf<Char> { static const TypeId value=CHAR; }; -template<> struct TypeIdOf<Ulong> { static const TypeId value=ULONG; }; -template<> struct TypeIdOf<Long> { static const TypeId value=LONG; }; -template<> struct TypeIdOf<Timestamp> { static const TypeId value=TIMESTAMP; }; -template<> struct TypeIdOf<Float> { static const TypeId value=FLOAT; }; -template<> struct TypeIdOf<Double> { static const TypeId value=DOUBLE; }; -template<> struct TypeIdOf<Decimal32> { static const TypeId value=DECIMAL32; }; -template<> struct TypeIdOf<Decimal64> { static const TypeId value=DECIMAL64; }; -template<> struct TypeIdOf<Decimal128> { static const TypeId value=DECIMAL128; }; -template<> struct TypeIdOf<Uuid> { static const TypeId value=UUID; }; -template<> struct TypeIdOf<Binary> { static const TypeId value=BINARY; }; -template<> struct TypeIdOf<String> { static const TypeId value=STRING; }; -template<> struct TypeIdOf<Symbol> { static const TypeId value=SYMBOL; }; - -template<class T, TypeId A> struct TypePair { - typedef T CppType; - TypeId type; -}; - -template<class T, TypeId A> struct Ref : public TypePair<T, A> { - Ref(T& v) : value(v) {} - T& value; -}; - -template<class T, TypeId A> struct CRef : public TypePair<T, A> { - CRef(const T& v) : value(v) {} - CRef(const Ref<T,A>& ref) : value(ref.value) {} - const T& value; -}; - -/** Create a reference to value as AMQP type A for decoding. For example to decode an array of Int: - * - * std::vector<Int> v; - * decoder >> as<ARRAY>(v); - */ -template <TypeId A, class T> Ref<T, A> as(T& value) { return Ref<T, A>(value); } - -/** Create a const reference to value as AMQP type A for encoding. */ -template <TypeId A, class T> CRef<T, A> as(const T& value) { return CRef<T, A>(value); } - -///@} - -// TODO aconway 2015-06-16: described types. - -/** Return the name of a type. */ -PN_CPP_EXTERN std::string typeName(TypeId); - -/** Print the name of a type */ -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, TypeId); - -/** Return the name of a type from a class. */ -PN_CPP_EXTERN template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); } - -/** Information needed to start extracting or inserting a container type. - * - * With a decoder you can use `Start s = decoder.start()` or `Start s; decoder > s` - * to get the Start for the current container. - * - * With an encoder use one of the member functions startArray, startList, startMap or startDescribed - * to create an appropriate Start value, e.g. `encoder << startList() << ...` - */ -PN_CPP_EXTERN struct Start { - Start(TypeId type=NULL_, TypeId element=NULL_, bool described=false, size_t size=0); - TypeId type; ///< The container type: ARRAY, LIST, MAP or DESCRIBED. - TypeId element; ///< the element type for array only. - bool isDescribed; ///< true if first value is a descriptor. - size_t size; ///< the element count excluding the descriptor (if any) - - /** Return a Start for an array */ - static Start array(TypeId element, bool described=false); - /** Return a Start for a list */ - static Start list(); - /** Return a Start for a map */ - static Start map(); - /** Return a Start for a described type */ - static Start described(); -}; - -/** Finish insterting or extracting a container value. */ -PN_CPP_EXTERN struct Finish {}; -inline Finish finish() { return Finish(); } - -/** Skip a value */ -PN_CPP_EXTERN struct Skip{}; -inline Skip skip() { return Skip(); } - -}} - -#endif // TYPES_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/exceptions.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/exceptions.hpp b/proton-c/bindings/cpp/include/proton/exceptions.hpp new file mode 100644 index 0000000..9fdef94 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/exceptions.hpp @@ -0,0 +1,49 @@ +#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> + +namespace proton { +namespace reactor { + +class ProtonException : public std::runtime_error +{ + public: + explicit ProtonException(const std::string& msg) throw() : std::runtime_error(msg) {} +}; + +class MessageReject : public ProtonException +{ + public: + explicit MessageReject(const std::string& msg) throw() : ProtonException(msg) {} +}; + +class MessageRelease : public ProtonException +{ + public: + explicit MessageRelease(const std::string& msg) throw() : ProtonException(msg) {} +}; + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_EXCEPTIONS_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/types.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp new file mode 100644 index 0000000..819abb1 --- /dev/null +++ b/proton-c/bindings/cpp/include/proton/types.hpp @@ -0,0 +1,250 @@ +#ifndef TYPES_H +#define TYPES_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/codec.h> +#include "proton/ImportExport.hpp" +#include <algorithm> +#include <bitset> +#include <string> +#include <stdint.h> +#include <memory.h> + +/**@file + * C++ types representing AMQP types. + * @ingroup cpp + */ + +namespace proton { +namespace reactor { + +/** TypeId identifies an AMQP type */ +enum TypeId { + NULL_=PN_NULL, ///< The null type, contains no data. + BOOL=PN_BOOL, ///< Boolean true or false. + UBYTE=PN_UBYTE, ///< Unsigned 8 bit integer. + BYTE=PN_BYTE, ///< Signed 8 bit integer. + USHORT=PN_USHORT, ///< Unsigned 16 bit integer. + SHORT=PN_SHORT, ///< Signed 16 bit integer. + UINT=PN_UINT, ///< Unsigned 32 bit integer. + INT=PN_INT, ///< Signed 32 bit integer. + CHAR=PN_CHAR, ///< 32 bit unicode character. + ULONG=PN_ULONG, ///< Unsigned 64 bit integer. + LONG=PN_LONG, ///< Signed 64 bit integer. + TIMESTAMP=PN_TIMESTAMP, ///< Signed 64 bit milliseconds since the epoch. + FLOAT=PN_FLOAT, ///< 32 bit binary floating point. + DOUBLE=PN_DOUBLE, ///< 64 bit binary floating point. + DECIMAL32=PN_DECIMAL32, ///< 32 bit decimal floating point. + DECIMAL64=PN_DECIMAL64, ///< 64 bit decimal floating point. + DECIMAL128=PN_DECIMAL128, ///< 128 bit decimal floating point. + UUID=PN_UUID, ///< 16 byte UUID. + BINARY=PN_BINARY, ///< Variable length sequence of bytes. + STRING=PN_STRING, ///< Variable length utf8-encoded string. + SYMBOL=PN_SYMBOL, ///< Variable length encoded string. + DESCRIBED=PN_DESCRIBED, ///< A descriptor and a value. + ARRAY=PN_ARRAY, ///< A sequence of values of the same type. + LIST=PN_LIST, ///< A sequence of values, may be of mixed types. + MAP=PN_MAP ///< A sequence of key:value pairs, may be of mixed types. +}; + +///@internal +template <class T> struct Comparable {}; +template<class T> bool operator<(const Comparable<T>& a, const Comparable<T>& b) { + return static_cast<const T&>(a) < static_cast<const T&>(b); // operator < provided by type T +} +template<class T> bool operator>(const Comparable<T>& a, const Comparable<T>& b) { return b < a; } +template<class T> bool operator<=(const Comparable<T>& a, const Comparable<T>& b) { return !(a > b); } +template<class T> bool operator>=(const Comparable<T>& a, const Comparable<T>& b) { return !(a < b); } +template<class T> bool operator==(const Comparable<T>& a, const Comparable<T>& b) { return a <= b && b <= a; } +template<class T> bool operator!=(const Comparable<T>& a, const Comparable<T>& b) { return !(a == b); } + +/** + * @name C++ types representing AMQP types. + * @{ + * @ingroup cpp + * These types are all distinct for overloading purposes and will insert as the + * corresponding AMQP type with Encoder operator<<. + */ +struct Null {}; +typedef bool Bool; +typedef uint8_t Ubyte; +typedef int8_t Byte; +typedef uint16_t Ushort; +typedef int16_t Short; +typedef uint32_t Uint; +typedef int32_t Int; +typedef wchar_t Char; +typedef uint64_t Ulong; +typedef int64_t Long; +typedef float Float; +typedef double Double; + +///@internal +pn_bytes_t pn_bytes(const std::string&); + +///@internal +#define STRING_LIKE(NAME) \ + PN_CPP_EXTERN struct NAME : public std::string{ \ + NAME(const std::string& s=std::string()) : std::string(s) {} \ + NAME(const pn_bytes_t& b) : std::string(b.start, b.size) {} \ + operator pn_bytes_t() const { return pn_bytes(*this); } \ + } + +/** UTF-8 encoded string */ +STRING_LIKE(String); +/** ASCII encoded symbolic name */ +STRING_LIKE(Symbol); +/** Binary data */ +STRING_LIKE(Binary); + +///@internal +pn_uuid_t pn_uuid(const std::string&); + +/** UUID is represented as a string but treated as if it always has 16 bytes. */ +PN_CPP_EXTERN struct Uuid : public std::string{ + Uuid(const std::string& s=std::string()) : std::string(s) {} + Uuid(const pn_uuid_t& u) : std::string(&u.bytes[0], sizeof(pn_uuid_t::bytes)) {} + operator pn_uuid_t() const { return pn_uuid(*this); } +}; + +// TODO aconway 2015-06-11: alternative representation of variable-length data +// as pointer to existing buffers. + +// TODO aconway 2015-06-16: usable representation of decimal types. +template <class T> struct Decimal : public Comparable<Decimal<T> > { + char value[sizeof(T)]; + Decimal() { ::memset(value, 0, sizeof(T)); } + Decimal(const T& v) { ::memcpy(value, &v, sizeof(T)); } + operator T() const { return *reinterpret_cast<const T*>(value); } + bool operator<(const Decimal<T>& x) { + return std::lexicographical_compare(value, value+sizeof(T), x.value, x.value+sizeof(T)); + } +}; +typedef Decimal<pn_decimal32_t> Decimal32; +typedef Decimal<pn_decimal64_t> Decimal64; +typedef Decimal<pn_decimal128_t> Decimal128; + +PN_CPP_EXTERN struct Timestamp { + pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970. + Timestamp(int64_t ms=0) : milliseconds(ms) {} + operator pn_timestamp_t() const { return milliseconds; } + bool operator<(const Timestamp& x) { return milliseconds < x.milliseconds; } +}; + +///@} + +template <class T> struct TypeIdOf {}; +template<> struct TypeIdOf<Null> { static const TypeId value=NULL_; }; +template<> struct TypeIdOf<Bool> { static const TypeId value=BOOL; }; +template<> struct TypeIdOf<Ubyte> { static const TypeId value=UBYTE; }; +template<> struct TypeIdOf<Byte> { static const TypeId value=BYTE; }; +template<> struct TypeIdOf<Ushort> { static const TypeId value=USHORT; }; +template<> struct TypeIdOf<Short> { static const TypeId value=SHORT; }; +template<> struct TypeIdOf<Uint> { static const TypeId value=UINT; }; +template<> struct TypeIdOf<Int> { static const TypeId value=INT; }; +template<> struct TypeIdOf<Char> { static const TypeId value=CHAR; }; +template<> struct TypeIdOf<Ulong> { static const TypeId value=ULONG; }; +template<> struct TypeIdOf<Long> { static const TypeId value=LONG; }; +template<> struct TypeIdOf<Timestamp> { static const TypeId value=TIMESTAMP; }; +template<> struct TypeIdOf<Float> { static const TypeId value=FLOAT; }; +template<> struct TypeIdOf<Double> { static const TypeId value=DOUBLE; }; +template<> struct TypeIdOf<Decimal32> { static const TypeId value=DECIMAL32; }; +template<> struct TypeIdOf<Decimal64> { static const TypeId value=DECIMAL64; }; +template<> struct TypeIdOf<Decimal128> { static const TypeId value=DECIMAL128; }; +template<> struct TypeIdOf<Uuid> { static const TypeId value=UUID; }; +template<> struct TypeIdOf<Binary> { static const TypeId value=BINARY; }; +template<> struct TypeIdOf<String> { static const TypeId value=STRING; }; +template<> struct TypeIdOf<Symbol> { static const TypeId value=SYMBOL; }; + +template<class T, TypeId A> struct TypePair { + typedef T CppType; + TypeId type; +}; + +template<class T, TypeId A> struct Ref : public TypePair<T, A> { + Ref(T& v) : value(v) {} + T& value; +}; + +template<class T, TypeId A> struct CRef : public TypePair<T, A> { + CRef(const T& v) : value(v) {} + CRef(const Ref<T,A>& ref) : value(ref.value) {} + const T& value; +}; + +/** Create a reference to value as AMQP type A for decoding. For example to decode an array of Int: + * + * std::vector<Int> v; + * decoder >> as<ARRAY>(v); + */ +template <TypeId A, class T> Ref<T, A> as(T& value) { return Ref<T, A>(value); } + +/** Create a const reference to value as AMQP type A for encoding. */ +template <TypeId A, class T> CRef<T, A> as(const T& value) { return CRef<T, A>(value); } + +///@} + +// TODO aconway 2015-06-16: described types. + +/** Return the name of a type. */ +PN_CPP_EXTERN std::string typeName(TypeId); + +/** Print the name of a type */ +PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, TypeId); + +/** Return the name of a type from a class. */ +PN_CPP_EXTERN template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); } + +/** Information needed to start extracting or inserting a container type. + * + * With a decoder you can use `Start s = decoder.start()` or `Start s; decoder > s` + * to get the Start for the current container. + * + * With an encoder use one of the member functions startArray, startList, startMap or startDescribed + * to create an appropriate Start value, e.g. `encoder << startList() << ...` + */ +PN_CPP_EXTERN struct Start { + Start(TypeId type=NULL_, TypeId element=NULL_, bool described=false, size_t size=0); + TypeId type; ///< The container type: ARRAY, LIST, MAP or DESCRIBED. + TypeId element; ///< the element type for array only. + bool isDescribed; ///< true if first value is a descriptor. + size_t size; ///< the element count excluding the descriptor (if any) + + /** Return a Start for an array */ + static Start array(TypeId element, bool described=false); + /** Return a Start for a list */ + static Start list(); + /** Return a Start for a map */ + static Start map(); + /** Return a Start for a described type */ + static Start described(); +}; + +/** Finish insterting or extracting a container value. */ +PN_CPP_EXTERN struct Finish {}; +inline Finish finish() { return Finish(); } + +/** Skip a value */ +PN_CPP_EXTERN struct Skip{}; +inline Skip skip() { return Skip(); } + +}} + +#endif // TYPES_H http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Acceptor.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Acceptor.cpp b/proton-c/bindings/cpp/src/Acceptor.cpp index aa73ebf..6d3d1af 100644 --- a/proton-c/bindings/cpp/src/Acceptor.cpp +++ b/proton-c/bindings/cpp/src/Acceptor.cpp @@ -19,10 +19,10 @@ * */ -#include "proton/cpp/Acceptor.h" -#include "proton/cpp/exceptions.h" -#include "ProtonImplRef.h" -#include "Msg.h" +#include "proton/Acceptor.hpp" +#include "proton/exceptions.hpp" +#include "ProtonImplRef.hpp" +#include "Msg.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Acking.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Acking.cpp b/proton-c/bindings/cpp/src/Acking.cpp index 62eca98..832b9f2 100644 --- a/proton-c/bindings/cpp/src/Acking.cpp +++ b/proton-c/bindings/cpp/src/Acking.cpp @@ -19,7 +19,7 @@ * */ -#include "proton/cpp/Acking.h" +#include "proton/Acking.hpp" #include "proton/delivery.h" namespace proton { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Connection.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Connection.cpp b/proton-c/bindings/cpp/src/Connection.cpp index 67e7d0c..006b567 100644 --- a/proton-c/bindings/cpp/src/Connection.cpp +++ b/proton-c/bindings/cpp/src/Connection.cpp @@ -18,14 +18,14 @@ * under the License. * */ -#include "proton/cpp/Container.h" -#include "proton/cpp/Connection.h" -#include "proton/cpp/Handler.h" -#include "proton/cpp/exceptions.h" -#include "Msg.h" -#include "contexts.h" -#include "ConnectionImpl.h" -#include "PrivateImplRef.h" +#include "proton/Container.hpp" +#include "proton/Connection.hpp" +#include "proton/Handler.hpp" +#include "proton/exceptions.hpp" +#include "Msg.hpp" +#include "contexts.hpp" +#include "ConnectionImpl.hpp" +#include "PrivateImplRef.hpp" #include "proton/connection.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ConnectionImpl.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.cpp b/proton-c/bindings/cpp/src/ConnectionImpl.cpp index f7cc5f9..450d504 100644 --- a/proton-c/bindings/cpp/src/ConnectionImpl.cpp +++ b/proton-c/bindings/cpp/src/ConnectionImpl.cpp @@ -18,15 +18,15 @@ * under the License. * */ -#include "proton/cpp/Container.h" -#include "proton/cpp/Handler.h" -#include "proton/cpp/exceptions.h" -#include "ConnectionImpl.h" -#include "proton/cpp/Transport.h" -#include "Msg.h" -#include "contexts.h" -#include "PrivateImplRef.h" -#include "ContainerImpl.h" +#include "proton/Container.hpp" +#include "proton/Handler.hpp" +#include "proton/exceptions.hpp" +#include "ConnectionImpl.hpp" +#include "proton/Transport.hpp" +#include "Msg.hpp" +#include "contexts.hpp" +#include "PrivateImplRef.hpp" +#include "ContainerImpl.hpp" #include "proton/connection.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ConnectionImpl.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h deleted file mode 100644 index f16c862..0000000 --- a/proton-c/bindings/cpp/src/ConnectionImpl.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef PROTON_CPP_CONNECTIONIMPL_H -#define PROTON_CPP_CONNECTIONIMPL_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/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 : public Endpoint -{ - public: - PN_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn); - PN_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0); - PN_CPP_EXTERN virtual ~ConnectionImpl(); - 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(); - PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask); - virtual PN_CPP_EXTERN Connection &getConnection(); - static Connection &getReactorReference(pn_connection_t *); - static ConnectionImpl *getImpl(const Connection &c) { return c.impl; } - void reactorDetach(); - static void incref(ConnectionImpl *); - static void decref(ConnectionImpl *); - private: - friend class Connector; - friend class ContainerImpl; - Container container; - int refCount; - Handler *override; - Transport *transport; - pn_session_t *defaultSession; // Temporary, for SessionPerConnection style policy. - pn_connection_t *pnConnection; - Connection reactorReference; // Keep-alive reference, until PN_CONNECTION_FINAL. -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_CONNECTIONIMPL_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ConnectionImpl.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.hpp b/proton-c/bindings/cpp/src/ConnectionImpl.hpp new file mode 100644 index 0000000..e20d614 --- /dev/null +++ b/proton-c/bindings/cpp/src/ConnectionImpl.hpp @@ -0,0 +1,75 @@ +#ifndef PROTON_CPP_CONNECTIONIMPL_H +#define PROTON_CPP_CONNECTIONIMPL_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/Container.hpp" +#include "proton/types.h" +#include <string> + +struct pn_connection_t; + +namespace proton { +namespace reactor { + +class Handler; +class Transport; +class Container; + +class ConnectionImpl : public Endpoint +{ + public: + PN_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn); + PN_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0); + PN_CPP_EXTERN virtual ~ConnectionImpl(); + 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(); + PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask); + virtual PN_CPP_EXTERN Connection &getConnection(); + static Connection &getReactorReference(pn_connection_t *); + static ConnectionImpl *getImpl(const Connection &c) { return c.impl; } + void reactorDetach(); + static void incref(ConnectionImpl *); + static void decref(ConnectionImpl *); + private: + friend class Connector; + friend class ContainerImpl; + Container container; + int refCount; + Handler *override; + Transport *transport; + pn_session_t *defaultSession; // Temporary, for SessionPerConnection style policy. + pn_connection_t *pnConnection; + Connection reactorReference; // Keep-alive reference, until PN_CONNECTION_FINAL. +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_CONNECTIONIMPL_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Connector.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Connector.cpp b/proton-c/bindings/cpp/src/Connector.cpp index fc6eed3..13c197f 100644 --- a/proton-c/bindings/cpp/src/Connector.cpp +++ b/proton-c/bindings/cpp/src/Connector.cpp @@ -19,14 +19,14 @@ * */ -#include "proton/cpp/Connection.h" -#include "proton/cpp/Transport.h" -#include "proton/cpp/Container.h" -#include "proton/cpp/Event.h" +#include "proton/Connection.hpp" +#include "proton/Transport.hpp" +#include "proton/Container.hpp" +#include "proton/Event.hpp" #include "proton/connection.h" -#include "Connector.h" -#include "ConnectionImpl.h" -#include "Url.h" +#include "Connector.hpp" +#include "ConnectionImpl.hpp" +#include "Url.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Connector.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Connector.h b/proton-c/bindings/cpp/src/Connector.h deleted file mode 100644 index d829699..0000000 --- a/proton-c/bindings/cpp/src/Connector.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef PROTON_CPP_CONNECTOR_HANDLER_H -#define PROTON_CPP_CONNECTOR_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/ProtonHandler.h" -#include "proton/event.h" -#include "proton/reactor.h" -#include <string> - - -namespace proton { -namespace reactor { - -class Event; -class Connection; -class Transport; - -class Connector : public ProtonHandler -{ - public: - Connector(Connection &c); - ~Connector(); - void setAddress(const std::string &host); - void connect(); - virtual void onConnectionLocalOpen(Event &e); - virtual void onConnectionRemoteOpen(Event &e); - virtual void onConnectionInit(Event &e); - virtual void onTransportClosed(Event &e); - - private: - Connection connection; - std::string address; - Transport *transport; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_CONNECTOR_HANDLER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Connector.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Connector.hpp b/proton-c/bindings/cpp/src/Connector.hpp new file mode 100644 index 0000000..3c080ad --- /dev/null +++ b/proton-c/bindings/cpp/src/Connector.hpp @@ -0,0 +1,59 @@ +#ifndef PROTON_CPP_CONNECTOR_HANDLER_H +#define PROTON_CPP_CONNECTOR_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/event.h" +#include "proton/reactor.h" +#include <string> + + +namespace proton { +namespace reactor { + +class Event; +class Connection; +class Transport; + +class Connector : public ProtonHandler +{ + public: + Connector(Connection &c); + ~Connector(); + void setAddress(const std::string &host); + void connect(); + virtual void onConnectionLocalOpen(Event &e); + virtual void onConnectionRemoteOpen(Event &e); + virtual void onConnectionInit(Event &e); + virtual void onTransportClosed(Event &e); + + private: + Connection connection; + std::string address; + Transport *transport; +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_CONNECTOR_HANDLER_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Container.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp index 3ae1963..4fa6c6a 100644 --- a/proton-c/bindings/cpp/src/Container.cpp +++ b/proton-c/bindings/cpp/src/Container.cpp @@ -18,19 +18,19 @@ * under the License. * */ -#include "proton/cpp/Container.h" -#include "proton/cpp/MessagingEvent.h" -#include "proton/cpp/Connection.h" -#include "proton/cpp/Session.h" -#include "proton/cpp/MessagingAdapter.h" -#include "proton/cpp/Acceptor.h" -#include "proton/cpp/exceptions.h" -#include "ContainerImpl.h" -#include "PrivateImplRef.h" - -#include "Connector.h" -#include "contexts.h" -#include "Url.h" +#include "proton/Container.hpp" +#include "proton/MessagingEvent.hpp" +#include "proton/Connection.hpp" +#include "proton/Session.hpp" +#include "proton/MessagingAdapter.hpp" +#include "proton/Acceptor.hpp" +#include "proton/exceptions.hpp" +#include "ContainerImpl.hpp" +#include "PrivateImplRef.hpp" + +#include "Connector.hpp" +#include "contexts.hpp" +#include "Url.hpp" #include "proton/connection.h" #include "proton/session.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ContainerImpl.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp index 989bd00..80137b5 100644 --- a/proton-c/bindings/cpp/src/ContainerImpl.cpp +++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp @@ -18,21 +18,21 @@ * under the License. * */ -#include "proton/cpp/Container.h" -#include "proton/cpp/MessagingEvent.h" -#include "proton/cpp/Connection.h" -#include "proton/cpp/Session.h" -#include "proton/cpp/MessagingAdapter.h" -#include "proton/cpp/Acceptor.h" -#include "proton/cpp/exceptions.h" - -#include "Msg.h" -#include "ContainerImpl.h" -#include "ConnectionImpl.h" -#include "Connector.h" -#include "contexts.h" -#include "Url.h" -#include "PrivateImplRef.h" +#include "proton/Container.hpp" +#include "proton/MessagingEvent.hpp" +#include "proton/Connection.hpp" +#include "proton/Session.hpp" +#include "proton/MessagingAdapter.hpp" +#include "proton/Acceptor.hpp" +#include "proton/exceptions.hpp" + +#include "Msg.hpp" +#include "ContainerImpl.hpp" +#include "ConnectionImpl.hpp" +#include "Connector.hpp" +#include "contexts.hpp" +#include "Url.hpp" +#include "PrivateImplRef.hpp" #include "proton/connection.h" #include "proton/session.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ContainerImpl.h ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ContainerImpl.h b/proton-c/bindings/cpp/src/ContainerImpl.h deleted file mode 100644 index c0d2d12..0000000 --- a/proton-c/bindings/cpp/src/ContainerImpl.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef PROTON_CPP_CONTAINERIMPL_H -#define PROTON_CPP_CONTAINERIMPL_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/MessagingHandler.h" -#include "proton/cpp/Connection.h" -#include "proton/cpp/Link.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 -{ - public: - PN_CPP_EXTERN ContainerImpl(Handler &h); - PN_CPP_EXTERN ContainerImpl(); - PN_CPP_EXTERN ~ContainerImpl(); - PN_CPP_EXTERN Connection connect(std::string &host, Handler *h); - PN_CPP_EXTERN void run(); - PN_CPP_EXTERN pn_reactor_t *getReactor(); - PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h); - 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); - void start(); - bool process(); - void stop(); - void wakeup(); - bool isQuiesced(); - pn_handler_t *wrapHandler(Handler *h); - static void incref(ContainerImpl *); - static void decref(ContainerImpl *); - private: - void dispatch(pn_event_t *event, pn_event_type_t type); - Acceptor acceptor(const std::string &host, const std::string &port); - void initializeReactor(); - pn_reactor_t *reactor; - Handler *handler; - MessagingAdapter *messagingAdapter; - Handler *overrideHandler; - Handler *flowController; - std::string containerId; - int refCount; -}; - - -}} // namespace proton::reactor - -#endif /*!PROTON_CPP_CONTAINERIMPL_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ContainerImpl.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/ContainerImpl.hpp b/proton-c/bindings/cpp/src/ContainerImpl.hpp new file mode 100644 index 0000000..80df83a --- /dev/null +++ b/proton-c/bindings/cpp/src/ContainerImpl.hpp @@ -0,0 +1,82 @@ +#ifndef PROTON_CPP_CONTAINERIMPL_H +#define PROTON_CPP_CONTAINERIMPL_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/MessagingHandler.hpp" +#include "proton/Connection.hpp" +#include "proton/Link.hpp" +#include "proton/Duration.hpp" + +#include "proton/reactor.h" + +#include <string> +namespace proton { +namespace reactor { + +class DispatchHelper; +class Connection; +class Connector; +class Acceptor; + +class ContainerImpl +{ + public: + PN_CPP_EXTERN ContainerImpl(Handler &h); + PN_CPP_EXTERN ContainerImpl(); + PN_CPP_EXTERN ~ContainerImpl(); + PN_CPP_EXTERN Connection connect(std::string &host, Handler *h); + PN_CPP_EXTERN void run(); + PN_CPP_EXTERN pn_reactor_t *getReactor(); + PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h); + 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); + void start(); + bool process(); + void stop(); + void wakeup(); + bool isQuiesced(); + pn_handler_t *wrapHandler(Handler *h); + static void incref(ContainerImpl *); + static void decref(ContainerImpl *); + private: + void dispatch(pn_event_t *event, pn_event_type_t type); + Acceptor acceptor(const std::string &host, const std::string &port); + void initializeReactor(); + pn_reactor_t *reactor; + Handler *handler; + MessagingAdapter *messagingAdapter; + Handler *overrideHandler; + Handler *flowController; + std::string containerId; + int refCount; +}; + + +}} // namespace proton::reactor + +#endif /*!PROTON_CPP_CONTAINERIMPL_H*/ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Data.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Data.cpp b/proton-c/bindings/cpp/src/Data.cpp index 790cecb..3cfa715 100644 --- a/proton-c/bindings/cpp/src/Data.cpp +++ b/proton-c/bindings/cpp/src/Data.cpp @@ -17,9 +17,9 @@ * under the License. */ -#include "proton/cpp/Data.h" +#include "proton/Data.hpp" #include <proton/codec.h> -#include "proton_bits.h" +#include "proton_bits.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Decoder.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Decoder.cpp b/proton-c/bindings/cpp/src/Decoder.cpp index 503db81..6f5b73b 100644 --- a/proton-c/bindings/cpp/src/Decoder.cpp +++ b/proton-c/bindings/cpp/src/Decoder.cpp @@ -17,11 +17,11 @@ * under the License. */ -#include "proton/cpp/Decoder.h" -#include "proton/cpp/Value.h" +#include "proton/Decoder.hpp" +#include "proton/Value.hpp" #include <proton/codec.h> -#include "proton_bits.h" -#include "Msg.h" +#include "proton_bits.hpp" +#include "Msg.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Delivery.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Delivery.cpp b/proton-c/bindings/cpp/src/Delivery.cpp index d0b2f3c..60cd0d3 100644 --- a/proton-c/bindings/cpp/src/Delivery.cpp +++ b/proton-c/bindings/cpp/src/Delivery.cpp @@ -19,9 +19,9 @@ * */ -#include "proton/cpp/Delivery.h" +#include "proton/Delivery.hpp" #include "proton/delivery.h" -#include "ProtonImplRef.h" +#include "ProtonImplRef.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Duration.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Duration.cpp b/proton-c/bindings/cpp/src/Duration.cpp index f4155d9..1c5c5ea 100644 --- a/proton-c/bindings/cpp/src/Duration.cpp +++ b/proton-c/bindings/cpp/src/Duration.cpp @@ -18,7 +18,7 @@ * under the License. * */ -#include "proton/cpp/Duration.h" +#include "proton/Duration.hpp" #include <limits> namespace proton { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Encoder.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Encoder.cpp b/proton-c/bindings/cpp/src/Encoder.cpp index 9182400..0bd6943 100644 --- a/proton-c/bindings/cpp/src/Encoder.cpp +++ b/proton-c/bindings/cpp/src/Encoder.cpp @@ -17,11 +17,11 @@ * under the License. */ -#include "proton/cpp/Encoder.h" -#include "proton/cpp/Value.h" +#include "proton/Encoder.hpp" +#include "proton/Value.hpp" #include <proton/codec.h> -#include "proton_bits.h" -#include "Msg.h" +#include "proton_bits.hpp" +#include "Msg.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Endpoint.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Endpoint.cpp b/proton-c/bindings/cpp/src/Endpoint.cpp index 868f361..ad96e0a 100644 --- a/proton-c/bindings/cpp/src/Endpoint.cpp +++ b/proton-c/bindings/cpp/src/Endpoint.cpp @@ -19,9 +19,9 @@ * */ -#include "proton/cpp/Endpoint.h" -#include "proton/cpp/Connection.h" -#include "proton/cpp/Transport.h" +#include "proton/Endpoint.hpp" +#include "proton/Connection.hpp" +#include "proton/Transport.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Event.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Event.cpp b/proton-c/bindings/cpp/src/Event.cpp index 531c764..937e3ed 100644 --- a/proton-c/bindings/cpp/src/Event.cpp +++ b/proton-c/bindings/cpp/src/Event.cpp @@ -22,12 +22,12 @@ #include "proton/reactor.h" #include "proton/event.h" -#include "proton/cpp/Event.h" -#include "proton/cpp/Handler.h" -#include "proton/cpp/exceptions.h" +#include "proton/Event.hpp" +#include "proton/Handler.hpp" +#include "proton/exceptions.hpp" -#include "Msg.h" -#include "contexts.h" +#include "Msg.hpp" +#include "contexts.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Handler.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Handler.cpp b/proton-c/bindings/cpp/src/Handler.cpp index 5c37c8d..235bff7 100644 --- a/proton-c/bindings/cpp/src/Handler.cpp +++ b/proton-c/bindings/cpp/src/Handler.cpp @@ -18,8 +18,8 @@ * under the License. * */ -#include "proton/cpp/Handler.h" -#include "proton/cpp/Event.h" +#include "proton/Handler.hpp" +#include "proton/Event.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Link.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Link.cpp b/proton-c/bindings/cpp/src/Link.cpp index 59cf039..9065524 100644 --- a/proton-c/bindings/cpp/src/Link.cpp +++ b/proton-c/bindings/cpp/src/Link.cpp @@ -18,13 +18,13 @@ * under the License. * */ -#include "proton/cpp/Link.h" -#include "proton/cpp/exceptions.h" -#include "proton/cpp/Connection.h" -#include "ConnectionImpl.h" -#include "Msg.h" -#include "contexts.h" -#include "ProtonImplRef.h" +#include "proton/Link.hpp" +#include "proton/exceptions.hpp" +#include "proton/Connection.hpp" +#include "ConnectionImpl.hpp" +#include "Msg.hpp" +#include "contexts.hpp" +#include "ProtonImplRef.hpp" #include "proton/connection.h" #include "proton/session.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Message.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/Message.cpp b/proton-c/bindings/cpp/src/Message.cpp index bdc8c0c..f422202 100644 --- a/proton-c/bindings/cpp/src/Message.cpp +++ b/proton-c/bindings/cpp/src/Message.cpp @@ -19,10 +19,10 @@ * */ -#include "proton/cpp/Message.h" -#include "proton/cpp/exceptions.h" -#include "Msg.h" -#include "ProtonImplRef.h" +#include "proton/Message.hpp" +#include "proton/exceptions.hpp" +#include "Msg.hpp" +#include "ProtonImplRef.hpp" #include <cstring> http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/MessagingAdapter.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp index f137397..7c3ba6c 100644 --- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp +++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp @@ -18,11 +18,11 @@ * under the License. * */ -#include "proton/cpp/MessagingAdapter.h" -#include "proton/cpp/MessagingEvent.h" -#include "proton/cpp/Sender.h" -#include "proton/cpp/exceptions.h" -#include "Msg.h" +#include "proton/MessagingAdapter.hpp" +#include "proton/MessagingEvent.hpp" +#include "proton/Sender.hpp" +#include "proton/exceptions.hpp" +#include "Msg.hpp" #include "proton/link.h" #include "proton/handlers.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/MessagingEvent.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/MessagingEvent.cpp b/proton-c/bindings/cpp/src/MessagingEvent.cpp index b8a2f8a..fc20e2b 100644 --- a/proton-c/bindings/cpp/src/MessagingEvent.cpp +++ b/proton-c/bindings/cpp/src/MessagingEvent.cpp @@ -23,13 +23,13 @@ #include "proton/event.h" #include "proton/link.h" -#include "proton/cpp/MessagingEvent.h" -#include "proton/cpp/Message.h" -#include "proton/cpp/ProtonHandler.h" -#include "proton/cpp/MessagingHandler.h" -#include "proton/cpp/exceptions.h" -#include "Msg.h" -#include "contexts.h" +#include "proton/MessagingEvent.hpp" +#include "proton/Message.hpp" +#include "proton/ProtonHandler.hpp" +#include "proton/MessagingHandler.hpp" +#include "proton/exceptions.hpp" +#include "Msg.hpp" +#include "contexts.hpp" namespace proton { namespace reactor { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/MessagingHandler.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/MessagingHandler.cpp b/proton-c/bindings/cpp/src/MessagingHandler.cpp index 6e3d2bd..9076014 100644 --- a/proton-c/bindings/cpp/src/MessagingHandler.cpp +++ b/proton-c/bindings/cpp/src/MessagingHandler.cpp @@ -18,9 +18,9 @@ * under the License. * */ -#include "proton/cpp/MessagingHandler.h" -#include "proton/cpp/ProtonEvent.h" -#include "proton/cpp/MessagingAdapter.h" +#include "proton/MessagingHandler.hpp" +#include "proton/ProtonEvent.hpp" +#include "proton/MessagingAdapter.hpp" #include "proton/handlers.h" namespace proton { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
