diff --git a/amqpcpp.h b/amqpcpp.h index 3b72514..dcf4d85 100644 --- a/amqpcpp.h +++ b/amqpcpp.h @@ -26,13 +26,11 @@ #include #include -// include compatibilities for apple -#include - // forward declarations #include // utility classes +#include #include #include #include diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index db219a8..ece0d75 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -7,7 +7,7 @@ callbacks.h channel.h channelimpl.h classes.h -compat_endian.h +endian.h connection.h connectionhandler.h connectionimpl.h diff --git a/include/apple.h b/include/endian.h similarity index 55% rename from include/apple.h rename to include/endian.h index 97c60fc..3eaac1d 100644 --- a/include/apple.h +++ b/include/endian.h @@ -1,31 +1,50 @@ -#ifndef __AMQP_CPP_COMPAT_ENDIAN_H__ -#define __AMQP_CPP_COMPAT_ENDIAN_H__ +/** + * Endian.h + * + * On Apple systems, there are no macro's to convert between little + * and big endian byte orders. This header file adds the missing macros + * + * @author madmongo1 + */ + +/** + * Include guard + */ +#pragma once +/** + * The contents of the file are only relevant for Apple + */ #if defined(__APPLE__) +// dependencies #include - #include +// define 16 bit macros #define htobe16(x) OSSwapHostToBigInt16(x) #define htole16(x) OSSwapHostToLittleInt16(x) #define be16toh(x) OSSwapBigToHostInt16(x) #define le16toh(x) OSSwapLittleToHostInt16(x) +// define 32 bit macros #define htobe32(x) OSSwapHostToBigInt32(x) #define htole32(x) OSSwapHostToLittleInt32(x) #define be32toh(x) OSSwapBigToHostInt32(x) #define le32toh(x) OSSwapLittleToHostInt32(x) +// define 64 but macros #define htobe64(x) OSSwapHostToBigInt64(x) #define htole64(x) OSSwapHostToLittleInt64(x) #define be64toh(x) OSSwapBigToHostInt64(x) #define le64toh(x) OSSwapLittleToHostInt64(x) +// not on apple #else +// non-apple systems have their own endian header file #include +// end of "#if defined(__APPLE__)" #endif -#endif diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index 724fb58..8eb2e0f 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -589,53 +589,6 @@ DeferredGet &ChannelImpl::get(const std::string &queue, int flags) return *deferred; } -/** - * Retrieve a single message from RabbitMQ - * - * When you call this method, you can get one single message from the queue (or none - * at all if the queue is empty). The deferred object that is returned, should be used - * to install a onEmpty() and onSuccess() callback function that will be called - * when the message is consumed and/or when the message could not be consumed. - * - * The following flags are supported: - * - * - noack if set, consumed messages do not have to be acked, this happens automatically - * - * @param queue name of the queue to consume from - * @param flags optional flags - * - * The object returns a deferred handler. Callbacks can be installed - * using onSuccess(), onEmpty(), onError() and onFinalize() methods. - * - * The onSuccess() callback has the following signature: - * - * void myCallback(const Message &message, uint64_t deliveryTag, bool redelivered); - * - * For example: channel.get("myqueue").onSuccess([](const Message &message, uint64_t deliveryTag, bool redelivered) { - * - * std::cout << "Message fetched" << std::endl; - * - * }).onEmpty([]() { - * - * std::cout << "Queue is empty" << std::endl; - * - * }); - */ -DeferredGet &ChannelImpl::get(const std::string &queue, int flags) -{ - // the get frame to send - BasicGetFrame frame(_id, queue, flags & noack); - - // send the frame, and create deferred object - auto *deferred = new DeferredGet(this, send(frame)); - - // push to list - push(deferred); - - // done - return *deferred; -} - /** * Acknowledge a message * @param deliveryTag the delivery tag