From 513c796c9662d94066aa604b9c386fe1945c769f Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 30 Mar 2023 17:22:59 -0700 Subject: [PATCH] clang-format fixes --- .../inc/azure/core/amqp/message_sender.hpp | 5 +- .../azure/core/amqp/network/tls_transport.hpp | 1 - .../inc/azure/core/amqp/session.hpp | 316 +++++++++--------- .../src/network/tls_transport.cpp | 4 +- 4 files changed, 164 insertions(+), 162 deletions(-) diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp index 05e66a38f7b..05b65718297 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp @@ -118,7 +118,10 @@ namespace Azure { namespace Core { namespace Amqp { Connection const& connectionToPoll, MessageSenderOptions const& options, MessageSenderEvents* events); - MessageSender(std::shared_ptr sender) : m_impl{sender} {} + MessageSender(std::shared_ptr sender) + : m_impl{sender} + { + } virtual ~MessageSender() noexcept; MessageSender() = default; diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/network/tls_transport.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/network/tls_transport.hpp index fbdcf5c5ea9..32848dab02e 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/network/tls_transport.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/network/tls_transport.hpp @@ -18,5 +18,4 @@ namespace Azure { namespace Core { namespace Amqp { namespace Network { namespac TransportEvents* eventHandler = nullptr); ~TlsTransport() = default; }; - }}}}} // namespace Azure::Core::Amqp::Network::_internal diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp index c49675bc7fb..f6593c4aef8 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp @@ -20,166 +20,166 @@ extern "C" } namespace Azure { namespace Core { namespace Amqp { - namespace _detail { - class SessionImpl; - } // namespace _detail - namespace _internal { - - class Connection; - class Cbs; - - // Dummy operations for operations that should never be used. - class Flow; - class Attach; - class Disposition; - class Detach; - class Transfer; - enum class SessionRole; - - struct SessionOptions + namespace _detail { + class SessionImpl; + } // namespace _detail + namespace _internal { + + class Connection; + class Cbs; + + // Dummy operations for operations that should never be used. + class Flow; + class Attach; + class Disposition; + class Detach; + class Transfer; + enum class SessionRole; + + struct SessionOptions + { + uint32_t IncomingWindow; + uint32_t OutgoingWindow; + uint32_t MaxLinks; + }; + + enum class ExpiryPolicy + { + LinkDetach, + SessionEnd, + ConnectionClose, + Never + }; + + // An "Endpoint" is an intermediate type used to create sessions in an OnNewSession callback. + struct Endpoint + { + ENDPOINT_INSTANCE_TAG* m_endpoint; + Endpoint(ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {}; + ~Endpoint(); + Endpoint(Endpoint const&) = delete; + Endpoint& operator=(Endpoint const&) = delete; + + Endpoint(Endpoint&& other) noexcept : m_endpoint{other.m_endpoint} { - uint32_t IncomingWindow; - uint32_t OutgoingWindow; - uint32_t MaxLinks; - }; - - enum class ExpiryPolicy - { - LinkDetach, - SessionEnd, - ConnectionClose, - Never - }; - - // An "Endpoint" is an intermediate type used to create sessions in an OnNewSession callback. - struct Endpoint - { - ENDPOINT_INSTANCE_TAG* m_endpoint; - Endpoint(ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {}; - ~Endpoint(); - Endpoint(Endpoint const&) = delete; - Endpoint& operator=(Endpoint const&) = delete; - - Endpoint(Endpoint&& other) noexcept : m_endpoint{other.m_endpoint} - { - other.m_endpoint = nullptr; - } - Endpoint& operator=(Endpoint&& other); - ENDPOINT_INSTANCE_TAG* Release() - { - ENDPOINT_INSTANCE_TAG* rv = m_endpoint; - m_endpoint = nullptr; - return rv; - } - }; - - // A "Link Endpoint" is an intermediate type used to create new Links in an OnLinkAttached - // callback. Note that LinkEndpoints do not support copy semantics, and the only way to - // retrieve the underlying LINK_ENDPOINT_INSTANCE_TAG is to call Release(). That is because - // the primary use scenario for a LinkEndpoint is to call link_create_from_endpoint, and - // link_create_from_endpoint takes ownership of the underlying LINK_ENDPOINT object. - struct LinkEndpoint + other.m_endpoint = nullptr; + } + Endpoint& operator=(Endpoint&& other); + ENDPOINT_INSTANCE_TAG* Release() { - LINK_ENDPOINT_INSTANCE_TAG* m_endpoint; - LinkEndpoint(LINK_ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {}; - /* NOTE: We do *NOT* own a LinkEndpoint object, it is completely controlled by uAMQP-c. As - * such, we are not allowed to free it.*/ - ~LinkEndpoint(){}; - LinkEndpoint(Endpoint const&) = delete; - LinkEndpoint& operator=(LinkEndpoint const&) = delete; - - LinkEndpoint(LinkEndpoint&& other) noexcept : m_endpoint{other.m_endpoint} - { - other.m_endpoint = nullptr; - } - LinkEndpoint& operator=(Endpoint&& other); - LINK_ENDPOINT_INSTANCE_TAG* Release() - { - LINK_ENDPOINT_INSTANCE_TAG* rv = m_endpoint; - m_endpoint = nullptr; - return rv; - } - }; - - enum class SessionState + ENDPOINT_INSTANCE_TAG* rv = m_endpoint; + m_endpoint = nullptr; + return rv; + } + }; + + // A "Link Endpoint" is an intermediate type used to create new Links in an OnLinkAttached + // callback. Note that LinkEndpoints do not support copy semantics, and the only way to + // retrieve the underlying LINK_ENDPOINT_INSTANCE_TAG is to call Release(). That is because + // the primary use scenario for a LinkEndpoint is to call link_create_from_endpoint, and + // link_create_from_endpoint takes ownership of the underlying LINK_ENDPOINT object. + struct LinkEndpoint + { + LINK_ENDPOINT_INSTANCE_TAG* m_endpoint; + LinkEndpoint(LINK_ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {}; + /* NOTE: We do *NOT* own a LinkEndpoint object, it is completely controlled by uAMQP-c. As + * such, we are not allowed to free it.*/ + ~LinkEndpoint(){}; + LinkEndpoint(Endpoint const&) = delete; + LinkEndpoint& operator=(LinkEndpoint const&) = delete; + + LinkEndpoint(LinkEndpoint&& other) noexcept : m_endpoint{other.m_endpoint} { - Unmapped, - BeginSent, - BeginReceived, - Mapped, - EndSent, - EndReceived, - Discarding, - Error, - }; - - enum class SessionSendTransferResult - { - Ok, - Error, - Busy, - }; - - class Session; - struct SessionEvents + other.m_endpoint = nullptr; + } + LinkEndpoint& operator=(Endpoint&& other); + LINK_ENDPOINT_INSTANCE_TAG* Release() { - virtual bool OnLinkAttached( - Session const& session, - LinkEndpoint& newLink, - std::string const& name, - SessionRole role, - Azure::Core::Amqp::Models::Value source, - Azure::Core::Amqp::Models::Value target, - Azure::Core::Amqp::Models::Value properties) - = 0; - }; - - class Session final { - public: - using OnEndpointFrameReceivedCallback = std::function< - void(AMQP_VALUE_DATA_TAG* performative, uint32_t framePayloadSize, uint8_t* payload)>; - - Session( - Connection const& parentConnection, - Endpoint& newEndpoint, - SessionEvents* eventHandler); - Session(Connection const& parentConnection, SessionEvents* eventHandler); - Session(std::shared_ptr impl) : m_impl{impl} {} - ~Session() noexcept; - - Session(Session const&) = delete; - Session& operator=(Session const&) = delete; - Session(Session&&) noexcept = delete; - Session& operator=(Session&&) noexcept = delete; - // operator SESSION_INSTANCE_TAG*() const { return m_session; } - std::shared_ptr GetImpl() const { return m_impl; } - void SetIncomingWindow(uint32_t incomingWindow); - uint32_t GetIncomingWindow() const; - void SetOutgoingWindow(uint32_t outgoingWindow); - uint32_t GetOutgoingWindow() const; - void SetHandleMax(uint32_t handleMax); - uint32_t GetHandleMax() const; - - void Begin(); - void End(std::string const& condition_value, std::string const& description); - Endpoint CreateLinkEndpoint(std::string const& name); - void DestroyLinkEndpoint(Endpoint& endpoint); - void SetLinkEndpointCallback(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback); - void StartLinkEndpoint(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback); - void SendFlow(Endpoint& endpoint, Flow& flow); - void SendAttach(Endpoint& endpoint, Attach& attach); - void SendDisposition(Endpoint& endpoint, Disposition& disposition); - void SendDetach(Endpoint& endpoint, Detach& detach); - // SessionSendTransferResult SendTransfer( - // Endpoint& endpoint, - // Transfer& transfer, - // std::vector payloads, - // uint32_t* deliveryNumber, - // Azure::Core::Amqp::_internal::Network::Transport::TransportSendCompleteFn - // sendComplete); - - private: - std::shared_ptr m_impl; - }; - } // namespace _internal + LINK_ENDPOINT_INSTANCE_TAG* rv = m_endpoint; + m_endpoint = nullptr; + return rv; + } + }; + + enum class SessionState + { + Unmapped, + BeginSent, + BeginReceived, + Mapped, + EndSent, + EndReceived, + Discarding, + Error, + }; + + enum class SessionSendTransferResult + { + Ok, + Error, + Busy, + }; + + class Session; + struct SessionEvents + { + virtual bool OnLinkAttached( + Session const& session, + LinkEndpoint& newLink, + std::string const& name, + SessionRole role, + Azure::Core::Amqp::Models::Value source, + Azure::Core::Amqp::Models::Value target, + Azure::Core::Amqp::Models::Value properties) + = 0; + }; + + class Session final { + public: + using OnEndpointFrameReceivedCallback = std::function< + void(AMQP_VALUE_DATA_TAG* performative, uint32_t framePayloadSize, uint8_t* payload)>; + + Session( + Connection const& parentConnection, + Endpoint& newEndpoint, + SessionEvents* eventHandler); + Session(Connection const& parentConnection, SessionEvents* eventHandler); + Session(std::shared_ptr impl) : m_impl{impl} {} + ~Session() noexcept; + + Session(Session const&) = delete; + Session& operator=(Session const&) = delete; + Session(Session&&) noexcept = delete; + Session& operator=(Session&&) noexcept = delete; + // operator SESSION_INSTANCE_TAG*() const { return m_session; } + std::shared_ptr GetImpl() const { return m_impl; } + void SetIncomingWindow(uint32_t incomingWindow); + uint32_t GetIncomingWindow() const; + void SetOutgoingWindow(uint32_t outgoingWindow); + uint32_t GetOutgoingWindow() const; + void SetHandleMax(uint32_t handleMax); + uint32_t GetHandleMax() const; + + void Begin(); + void End(std::string const& condition_value, std::string const& description); + Endpoint CreateLinkEndpoint(std::string const& name); + void DestroyLinkEndpoint(Endpoint& endpoint); + void SetLinkEndpointCallback(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback); + void StartLinkEndpoint(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback); + void SendFlow(Endpoint& endpoint, Flow& flow); + void SendAttach(Endpoint& endpoint, Attach& attach); + void SendDisposition(Endpoint& endpoint, Disposition& disposition); + void SendDetach(Endpoint& endpoint, Detach& detach); + // SessionSendTransferResult SendTransfer( + // Endpoint& endpoint, + // Transfer& transfer, + // std::vector payloads, + // uint32_t* deliveryNumber, + // Azure::Core::Amqp::_internal::Network::Transport::TransportSendCompleteFn + // sendComplete); + + private: + std::shared_ptr m_impl; + }; + } // namespace _internal }}} // namespace Azure::Core::Amqp diff --git a/sdk/core/azure-core-amqp/src/network/tls_transport.cpp b/sdk/core/azure-core-amqp/src/network/tls_transport.cpp index 46de8b7c772..ef0cedbb919 100644 --- a/sdk/core/azure-core-amqp/src/network/tls_transport.cpp +++ b/sdk/core/azure-core-amqp/src/network/tls_transport.cpp @@ -7,7 +7,7 @@ #include #include -namespace Azure { namespace Core { namespace Amqp { namespace Network { namespace _internal { +namespace Azure { namespace Core { namespace Amqp { namespace Network { namespace _internal { TlsTransport::TlsTransport(std::string const& host, uint16_t port, TransportEvents* eventHandler) : Transport(eventHandler) @@ -23,4 +23,4 @@ namespace Azure { namespace Core { namespace Amqp { namespace Network { namespac TlsTransport::TlsTransport(TransportEvents* eventHandler) : Transport(eventHandler) {} -}}}}} // namespace Azure::Core::Amqp::_internal::Network +}}}}} // namespace Azure::Core::Amqp::Network::_internal