From 67ed9e8e4428a71320545e816c72b00366c6acd7 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 13 Nov 2024 11:15:01 +0000 Subject: [PATCH] Change internal constants from all-caps snake case to initial-caps snake case --- include/etl/bip_buffer_spsc_atomic.h | 42 ++++++++--------- include/etl/queue_spsc_atomic.h | 70 ++++++++++++++-------------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/include/etl/bip_buffer_spsc_atomic.h b/include/etl/bip_buffer_spsc_atomic.h index 5333dc68..f8c0eff1 100644 --- a/include/etl/bip_buffer_spsc_atomic.h +++ b/include/etl/bip_buffer_spsc_atomic.h @@ -86,13 +86,13 @@ namespace etl //*************************************************************************** /// The common base for a bip_buffer_spsc_atomic_base. //*************************************************************************** - template + template class bip_buffer_spsc_atomic_base { public: /// The type used for determining the size of buffer. - typedef typename etl::size_type_lookup::type size_type; + typedef typename etl::size_type_lookup::type size_type; //************************************************************************* /// Returns true if the buffer is empty. @@ -168,7 +168,7 @@ namespace etl //************************************************************************* size_type capacity() const { - return RESERVED; + return Reserved; } //************************************************************************* @@ -176,7 +176,7 @@ namespace etl //************************************************************************* size_type max_size() const { - return RESERVED; + return Reserved; } protected: @@ -188,7 +188,7 @@ namespace etl : read(0) , write(0) , last(0) - , RESERVED(reserved_) + , Reserved(reserved_) { } @@ -341,7 +341,7 @@ namespace etl etl::atomic read; etl::atomic write; etl::atomic last; - const size_type RESERVED; + const size_type Reserved; #if defined(ETL_POLYMORPHIC_SPSC_BIP_BUFFER_ATOMIC) || defined(ETL_POLYMORPHIC_CONTAINERS) public: @@ -361,12 +361,12 @@ namespace etl //*************************************************************************** /// A fixed capacity bipartite buffer. //*************************************************************************** - template - class ibip_buffer_spsc_atomic : public bip_buffer_spsc_atomic_base + template + class ibip_buffer_spsc_atomic : public bip_buffer_spsc_atomic_base { private: - typedef typename etl::bip_buffer_spsc_atomic_base base_t; + typedef typename etl::bip_buffer_spsc_atomic_base base_t; using base_t::reset; using base_t::get_read_reserve; using base_t::apply_read_reserve; @@ -486,15 +486,15 @@ namespace etl /// A fixed capacity bipartite buffer. /// This buffer supports concurrent access by one producer and one consumer. /// \tparam T The type this buffer should support. - /// \tparam SIZE The maximum capacity of the buffer. - /// \tparam MEMORY_MODEL The memory model for the buffer. Determines the type of the internal counter variables. + /// \tparam Size The maximum capacity of the buffer. + /// \tparam Memory_Model The memory model for the buffer. Determines the type of the internal counter variables. //*************************************************************************** - template - class bip_buffer_spsc_atomic : public ibip_buffer_spsc_atomic + template + class bip_buffer_spsc_atomic : public ibip_buffer_spsc_atomic { private: - typedef typename etl::ibip_buffer_spsc_atomic base_t; + typedef typename etl::ibip_buffer_spsc_atomic base_t; public: @@ -502,19 +502,19 @@ namespace etl private: - static ETL_CONSTANT size_type RESERVED_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type Reserved_Size = size_type(Size); public: - ETL_STATIC_ASSERT((SIZE <= (etl::integral_limits::max)), "Size too large for memory model"); + ETL_STATIC_ASSERT((Size <= (etl::integral_limits::max)), "Size too large for memory model"); - static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(Size); //************************************************************************* /// Default constructor. //************************************************************************* bip_buffer_spsc_atomic() - : base_t(reinterpret_cast(buffer.raw), RESERVED_SIZE) + : base_t(reinterpret_cast(buffer.raw), Reserved_Size) { } @@ -529,11 +529,11 @@ namespace etl private: /// The uninitialised buffer of T used in the bip_buffer_spsc. - etl::uninitialized_buffer_of buffer; + etl::uninitialized_buffer_of buffer; }; - template - ETL_CONSTANT typename bip_buffer_spsc_atomic::size_type bip_buffer_spsc_atomic::RESERVED_SIZE; + template + ETL_CONSTANT typename bip_buffer_spsc_atomic::size_type bip_buffer_spsc_atomic::Reserved_Size; } #endif /* ETL_HAS_ATOMIC && ETL_USING_CPP11 */ diff --git a/include/etl/queue_spsc_atomic.h b/include/etl/queue_spsc_atomic.h index d06dce2d..d7929919 100644 --- a/include/etl/queue_spsc_atomic.h +++ b/include/etl/queue_spsc_atomic.h @@ -47,13 +47,13 @@ SOFTWARE. namespace etl { - template + template class queue_spsc_atomic_base { public: /// The type used for determining the size of queue. - typedef typename etl::size_type_lookup::type size_type; + typedef typename etl::size_type_lookup::type size_type; //************************************************************************* /// Is the queue empty? @@ -72,7 +72,7 @@ namespace etl //************************************************************************* bool full() const { - size_type next_index = get_next_index(write.load(etl::memory_order_acquire), RESERVED); + size_type next_index = get_next_index(write.load(etl::memory_order_acquire), Reserved); return (next_index == read.load(etl::memory_order_acquire)); } @@ -94,7 +94,7 @@ namespace etl } else { - n = RESERVED - read_index + write_index; + n = Reserved - read_index + write_index; } return n; @@ -106,7 +106,7 @@ namespace etl //************************************************************************* size_type available() const { - return RESERVED - size() - 1; + return Reserved - size() - 1; } //************************************************************************* @@ -114,7 +114,7 @@ namespace etl //************************************************************************* size_type capacity() const { - return RESERVED - 1; + return Reserved - 1; } //************************************************************************* @@ -122,7 +122,7 @@ namespace etl //************************************************************************* size_type max_size() const { - return RESERVED - 1; + return Reserved - 1; } protected: @@ -130,7 +130,7 @@ namespace etl queue_spsc_atomic_base(size_type reserved_) : write(0), read(0), - RESERVED(reserved_) + Reserved(reserved_) { } @@ -151,7 +151,7 @@ namespace etl etl::atomic write; ///< Where to input new data. etl::atomic read; ///< Where to get the oldest data. - const size_type RESERVED; ///< The maximum number of items in the queue. + const size_type Reserved; ///< The maximum number of items in the queue. private: @@ -182,12 +182,12 @@ namespace etl /// This queue supports concurrent access by one producer and one consumer. /// \tparam T The type of value that the queue_spsc_atomic holds. //*************************************************************************** - template - class iqueue_spsc_atomic : public queue_spsc_atomic_base + template + class iqueue_spsc_atomic : public queue_spsc_atomic_base { private: - typedef typename etl::queue_spsc_atomic_base base_t; + typedef typename etl::queue_spsc_atomic_base base_t; public: @@ -201,7 +201,7 @@ namespace etl using base_t::write; using base_t::read; - using base_t::RESERVED; + using base_t::Reserved; using base_t::get_next_index; //************************************************************************* @@ -210,7 +210,7 @@ namespace etl bool push(const_reference value) { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -232,7 +232,7 @@ namespace etl bool push(rvalue_reference value) { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -257,7 +257,7 @@ namespace etl bool emplace(Args&&... args) { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -279,7 +279,7 @@ namespace etl bool emplace() { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -302,7 +302,7 @@ namespace etl bool emplace(const T1& value1) { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -325,7 +325,7 @@ namespace etl bool emplace(const T1& value1, const T2& value2) { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -348,7 +348,7 @@ namespace etl bool emplace(const T1& value1, const T2& value2, const T3& value3) { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -371,7 +371,7 @@ namespace etl bool emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4) { size_type write_index = write.load(etl::memory_order_relaxed); - size_type next_index = get_next_index(write_index, RESERVED); + size_type next_index = get_next_index(write_index, Reserved); if (next_index != read.load(etl::memory_order_acquire)) { @@ -418,7 +418,7 @@ namespace etl return false; } - size_type next_index = get_next_index(read_index, RESERVED); + size_type next_index = get_next_index(read_index, Reserved); #if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_QUEUE_LOCKABLE_FORCE_CPP03_IMPLEMENTATION) value = etl::move(p_buffer[read_index]); @@ -446,7 +446,7 @@ namespace etl return false; } - size_type next_index = get_next_index(read_index, RESERVED); + size_type next_index = get_next_index(read_index, Reserved); p_buffer[read_index].~T(); @@ -518,15 +518,15 @@ namespace etl /// A fixed capacity spsc queue. /// This queue supports concurrent access by one producer and one consumer. /// \tparam T The type this queue should support. - /// \tparam SIZE The maximum capacity of the queue. - /// \tparam MEMORY_MODEL The memory model for the queue. Determines the type of the internal counter variables. + /// \tparam Size The maximum capacity of the queue. + /// \tparam Memory_Model The memory model for the queue. Determines the type of the internal counter variables. //*************************************************************************** - template - class queue_spsc_atomic : public iqueue_spsc_atomic + template + class queue_spsc_atomic : public iqueue_spsc_atomic { private: - typedef typename etl::iqueue_spsc_atomic base_t; + typedef typename etl::iqueue_spsc_atomic base_t; public: @@ -534,19 +534,19 @@ namespace etl private: - static ETL_CONSTANT size_type RESERVED_SIZE = size_type(SIZE + 1); + static ETL_CONSTANT size_type Reserved_Size = size_type(Size + 1); public: - ETL_STATIC_ASSERT((SIZE <= (etl::integral_limits::max - 1)), "Size too large for memory model"); + ETL_STATIC_ASSERT((Size <= (etl::integral_limits::max - 1)), "Size too large for memory model"); - static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(Size); //************************************************************************* /// Default constructor. //************************************************************************* queue_spsc_atomic() - : base_t(reinterpret_cast(&buffer[0]), RESERVED_SIZE) + : base_t(reinterpret_cast(&buffer[0]), Reserved_Size) { } @@ -561,11 +561,11 @@ namespace etl private: /// The uninitialised buffer of T used in the queue_spsc. - typename etl::aligned_storage::value>::type buffer[RESERVED_SIZE]; + typename etl::aligned_storage::value>::type buffer[Reserved_Size]; }; - template - ETL_CONSTANT typename queue_spsc_atomic::size_type queue_spsc_atomic::MAX_SIZE; + template + ETL_CONSTANT typename queue_spsc_atomic::size_type queue_spsc_atomic::MAX_SIZE; } #endif