From e3b40c1eb43447bfcf31f20874d4c82707eba033 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 14 Apr 2018 13:13:32 +0100 Subject: [PATCH] Added capacity() to etl::queue Prefixed max_size() and capacity() with ETL_CONSTEXPR to all queue types --- include/etl/queue.h | 10 +++++++++- include/etl/queue_mpmc_mutex.h | 4 ++-- include/etl/queue_spsc_atomic.h | 4 ++-- include/etl/queue_spsc_isr.h | 4 ++-- include/etl/version.h | 4 ++-- support/Release notes.txt | 4 ++++ 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/include/etl/queue.h b/include/etl/queue.h index c8234791..52265d67 100644 --- a/include/etl/queue.h +++ b/include/etl/queue.h @@ -119,7 +119,15 @@ namespace etl //************************************************************************* /// Returns the maximum number of items that can be queued. //************************************************************************* - size_type max_size() const + ETL_CONSTEXPR size_type max_size() const + { + return CAPACITY; + } + + //************************************************************************* + /// Returns the maximum number of items that can be queued. + //************************************************************************* + ETL_CONSTEXPR size_type capacity() const { return CAPACITY; } diff --git a/include/etl/queue_mpmc_mutex.h b/include/etl/queue_mpmc_mutex.h index d6078b9f..d3426cb2 100644 --- a/include/etl/queue_mpmc_mutex.h +++ b/include/etl/queue_mpmc_mutex.h @@ -51,7 +51,7 @@ namespace etl //************************************************************************* /// How many items can the queue hold. //************************************************************************* - size_t capacity() const + ETL_CONSTEXPR size_t capacity() const { return MAX_SIZE; } @@ -59,7 +59,7 @@ namespace etl //************************************************************************* /// How many items can the queue hold. //************************************************************************* - size_t max_size() const + ETL_CONSTEXPR size_t max_size() const { return MAX_SIZE; } diff --git a/include/etl/queue_spsc_atomic.h b/include/etl/queue_spsc_atomic.h index b6be6452..a7f7e588 100644 --- a/include/etl/queue_spsc_atomic.h +++ b/include/etl/queue_spsc_atomic.h @@ -105,7 +105,7 @@ namespace etl //************************************************************************* /// How many items can the queue hold. //************************************************************************* - size_t capacity() const + ETL_CONSTEXPR size_t capacity() const { return RESERVED - 1; } @@ -113,7 +113,7 @@ namespace etl //************************************************************************* /// How many items can the queue hold. //************************************************************************* - size_t max_size() const + ETL_CONSTEXPR size_t max_size() const { return RESERVED - 1; } diff --git a/include/etl/queue_spsc_isr.h b/include/etl/queue_spsc_isr.h index b630461c..68dfb9ec 100644 --- a/include/etl/queue_spsc_isr.h +++ b/include/etl/queue_spsc_isr.h @@ -131,7 +131,7 @@ namespace etl //************************************************************************* /// How many items can the queue hold. //************************************************************************* - size_t capacity() const + ETL_CONSTEXPR size_t capacity() const { return MAX_SIZE; } @@ -139,7 +139,7 @@ namespace etl //************************************************************************* /// How many items can the queue hold. //************************************************************************* - size_t max_size() const + ETL_CONSTEXPR size_t max_size() const { return MAX_SIZE; } diff --git a/include/etl/version.h b/include/etl/version.h index e1d798f3..56981517 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -37,9 +37,9 @@ SOFTWARE. /// Definitions of the ETL version ///\ingroup utilities -#define ETL_VERSION "11.5.0" +#define ETL_VERSION "11.6.0" #define ETL_VERSION_MAJOR 11 -#define ETL_VERSION_MINOR 5 +#define ETL_VERSION_MINOR 6 #define ETL_VERSION_PATCH 0 #endif diff --git a/support/Release notes.txt b/support/Release notes.txt index 9dd37736..d86df051 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +11.6.0 +Added capacity() to etl::queue +Prefixed max_size() and capacity() with ETL_CONSTEXPR in all queue types. + =============================================================================== 11.5.0 Added etl::permutations and etl::combinations constant templates.