From bee78ab4c63bcc1eca1603e5a3dbb9fd06dfd41d Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Fri, 30 Sep 2016 14:38:40 +0100 Subject: [PATCH 01/93] Initial implementation of intrusive stack. Uncompiled & untested. --- src/intrusive_stack.h | 138 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 src/intrusive_stack.h diff --git a/src/intrusive_stack.h b/src/intrusive_stack.h new file mode 100644 index 00000000..025dac89 --- /dev/null +++ b/src/intrusive_stack.h @@ -0,0 +1,138 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_INTRUSIVE_STACK__ +#define __ETL_INTRUSIVE_STACK__ + +#include + +#include "type_traits.h" +#include "parameter_type.h" +#include "error_handler.h" + +namespace etl +{ + //*************************************************************************** + ///\ingroup stack + /// An intrusive stack. Stores elements derived from etl::forward_link + /// \warning This stack cannot be used for concurrent access from multiple threads. + /// \tparam TValue The type of value that the stack holds. + /// \tparam TLink The link type that the value is derived from. + //*************************************************************************** + template > + class intrusive_stack + { + public: + + // Node typedef. + typedef TLink link_type; + + // STL style typedefs. + typedef TValue value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + + public: + + //************************************************************************* + /// Constructor + //************************************************************************* + intrusive_stack() + : p_top(&base) + { + + } + + //************************************************************************* + /// Gets a reference to the value at the top of the stack. + /// Undefined behaviour if the stack is empty. + /// \return A reference to the value at the top of the stack. + //************************************************************************* + reference top() + { + return *p_top; + } + + //************************************************************************* + /// Adds a value to the stack. + ///\param value The value to push to the stack. + //************************************************************************* + void push(link_type& value) + { + etl::link(p_top, value); + p_top = &value; + } + + //************************************************************************* + /// Gets a const reference to the value at the top of the stack.
+ /// \return A const reference to the value at the top of the stack. + //************************************************************************* + const_reference top() const + { + return *p_top; + } + + //************************************************************************* + /// Clears the stack to the empty state. + //************************************************************************* + void clear() + { + unlink(base, *p_top); + } + + //************************************************************************* + /// Removes the oldest item from the top of the stack. + /// Does nothing if the stack is already empty. + //************************************************************************* + void pop() + { +#if defined(ETL_CHECK_PUSH_POP) + ETL_ASSERT(p_top != &base, ETL_ERROR(intrusive_stack_empty)); +#endif + link_type* p_previous = p_top->etl_previous; + unlink(p_top); + p_top = p_previous; + } + + private: + + // Disable copy construction and assignment. + intrusive_stack(const intrusive_stack&); + intrusive_stack& operator = (const intrusive_stack& rhs) + + link_type base; // The base of the stack. + link_type* p_top; // The current top of the stack. + }; +} + +#endif From 59ab675836f7d937cb8cb329f42f49adad1a2397 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 20 Aug 2016 21:22:07 +0100 Subject: [PATCH 02/93] Removed tabs --- src/ibasic_string.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ibasic_string.h b/src/ibasic_string.h index 275f0328..b788117a 100644 --- a/src/ibasic_string.h +++ b/src/ibasic_string.h @@ -148,7 +148,7 @@ namespace etl //********************************************************************* reverse_iterator rbegin() { - return reverse_iterator(end()); + return reverse_iterator(end()); } //********************************************************************* @@ -157,7 +157,7 @@ namespace etl //********************************************************************* const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); + return const_reverse_iterator(end()); } //********************************************************************* @@ -184,7 +184,7 @@ namespace etl //********************************************************************* const_reverse_iterator crbegin() const { - return const_reverse_iterator(cend()); + return const_reverse_iterator(cend()); } //********************************************************************* @@ -193,7 +193,7 @@ namespace etl //********************************************************************* const_reverse_iterator crend() const { - return const_reverse_iterator(cbegin()); + return const_reverse_iterator(cbegin()); } //********************************************************************* From 79bbf860f6c5fcb7c6b9342bfc9f1659d24c0372 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 29 Aug 2016 14:18:53 +0100 Subject: [PATCH 03/93] Tabs to spaces --- src/intrusive_list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intrusive_list.h b/src/intrusive_list.h index c4050db9..005c1511 100644 --- a/src/intrusive_list.h +++ b/src/intrusive_list.h @@ -341,7 +341,7 @@ namespace etl const value_type* p_value; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. From 14e387afdcd5e4ec97560cd756a6cdd7e1ff2cdf Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 29 Aug 2016 14:19:08 +0100 Subject: [PATCH 04/93] Tabs to spaces --- src/iforward_list.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/iforward_list.h b/src/iforward_list.h index b663ad8e..0f418209 100644 --- a/src/iforward_list.h +++ b/src/iforward_list.h @@ -256,7 +256,7 @@ namespace etl const Node* p_node; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Gets the beginning of the forward_list. @@ -348,7 +348,7 @@ namespace etl //************************************************************************* /// Assigns a range of values to the forward_list. - /// If asserts or exceptions are enabled throws etl::forward_list_full if the forward_list does not have enough free space. + /// If asserts or exceptions are enabled throws etl::forward_list_full if the forward_list does not have enough free space. /// If ETL_THROW_EXCEPTIONS & _DEBUG are defined throws forward_list_iterator if the iterators are reversed. //************************************************************************* template @@ -707,7 +707,7 @@ namespace etl if (is_trivial_list()) { - return; + return; } while (true) @@ -746,32 +746,32 @@ namespace etl // Decide whether the next node of merge comes from left or right. if (left_size == 0) { - // Left is empty. The node must come from right. - p_node = p_right; + // Left is empty. The node must come from right. + p_node = p_right; ++p_right; --right_size; - } + } else if (right_size == 0 || p_right == end()) { - // Right is empty. The node must come from left. - p_node = p_left; + // Right is empty. The node must come from left. + p_node = p_left; ++p_left; --left_size; - } + } else if (compare(*p_left, *p_right)) { - // First node of left is lower or same. The node must come from left. - p_node = p_left; + // First node of left is lower or same. The node must come from left. + p_node = p_left; ++p_left; --left_size; - } + } else { - // First node of right is lower. The node must come from right. - p_node = p_right; + // First node of right is lower. The node must come from right. + p_node = p_right; ++p_right; --right_size; - } + } // Add the next node to the merged head. if (p_head == before_begin()) From 1a9607c46e314d3c7b9c9c3b587a3181092d3ce8 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Tue, 8 Nov 2016 15:43:23 +0000 Subject: [PATCH 05/93] Changed default element size from uint8_t to uint_least8_t --- src/ibitset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ibitset.h b/src/ibitset.h index ee2747f8..b207c7a8 100644 --- a/src/ibitset.h +++ b/src/ibitset.h @@ -85,7 +85,7 @@ namespace etl // The type used for each element in the array. #if !defined(ETL_BITSET_ELEMENT_TYPE) - typedef uint8_t element_t; + typedef uint_least8_t element_t; #else typedef ETL_BITSET_ELEMENT_TYPE element_t; #endif From f4630351a222a739b27295b5bf97418769cb9e3e Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 8 Oct 2016 08:57:14 +0100 Subject: [PATCH 06/93] Tans to spaces --- src/intrusive_forward_list.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/intrusive_forward_list.h b/src/intrusive_forward_list.h index 21ea1ed2..7268216f 100644 --- a/src/intrusive_forward_list.h +++ b/src/intrusive_forward_list.h @@ -324,7 +324,7 @@ namespace etl const value_type* p_value; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -657,7 +657,7 @@ namespace etl if (is_trivial_list()) { - return; + return; } while (true) @@ -696,32 +696,32 @@ namespace etl // Decide whether the next link of merge comes from left or right. if (left_size == 0) { - // Left is empty. The link must come from right. - i_link = i_right; + // Left is empty. The link must come from right. + i_link = i_right; ++i_right; --right_size; - } + } else if (right_size == 0 || i_right == end()) { - // Right is empty. The link must come from left. - i_link = i_left; + // Right is empty. The link must come from left. + i_link = i_left; ++i_left; --left_size; - } + } else if (compare(*i_left, *i_right)) { - // First link of left is lower or same. The link must come from left. - i_link = i_left; + // First link of left is lower or same. The link must come from left. + i_link = i_left; ++i_left; --left_size; - } + } else { - // First link of right is lower. The link must come from right. - i_link = i_right; + // First link of right is lower. The link must come from right. + i_link = i_right; ++i_right; --right_size; - } + } // Add the next link to the merged head. if (i_head == before_begin()) From 6edd27698ffe5dfc9a2501d2d2d49683b1c62f24 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 8 Oct 2016 08:58:00 +0100 Subject: [PATCH 07/93] Added default constructors to automatically clear links. --- src/intrusive_links.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/intrusive_links.h b/src/intrusive_links.h index 00ebb14f..47e46a22 100644 --- a/src/intrusive_links.h +++ b/src/intrusive_links.h @@ -114,6 +114,11 @@ namespace etl OPTION = OPTION_ }; + forward_link_base() + { + clear(); + } + void clear() { etl_next = nullptr; @@ -329,6 +334,11 @@ namespace etl OPTION = OPTION_ }; + bidirectional_link_base() + { + clear(); + } + void clear() { etl_previous = nullptr; @@ -662,6 +672,11 @@ namespace etl OPTION = OPTION_ }; + tree_link_base() + { + clear(); + } + void clear() { etl_parent = nullptr; From 31d6defffe42d64729e532b6e94b510e7d8da82c Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 8 Oct 2016 09:31:37 +0100 Subject: [PATCH 08/93] Counter type for intrusive containers. Specializations for slow and fast count types. --- src/private/counter_type.h | 139 +++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 src/private/counter_type.h diff --git a/src/private/counter_type.h b/src/private/counter_type.h new file mode 100644 index 00000000..df94fbe8 --- /dev/null +++ b/src/private/counter_type.h @@ -0,0 +1,139 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_COUNTER_TYPE__ +#define __ETL_COUNTER_TYPE__ + +#include + +#include "../intrusive_links.h" + +namespace etl +{ + //************************************************************************* + /// Counter type based on intrusive link count option. + //************************************************************************* + template + class counter_type + { + }; + + //************************************************************************* + /// Slow type. + //************************************************************************* + template <> + class counter_type + { + public: + + counter_type& operator ++() + { + return *this; + } + + counter_type& operator --() + { + return *this; + } + + counter_type& operator =(size_t new_count) + { + return *this; + } + + counter_type& operator +=(size_t diff) + { + return *this; + } + + counter_type& operator -=(size_t diff) + { + return *this; + } + + size_t get_count() const + { + return 0; + } + }; + + //************************************************************************* + /// Fast type. + //************************************************************************* + template <> + class counter_type + { + public: + + counter_type() + : count(0) + { + } + + counter_type& operator ++() + { + ++count; + return *this; + } + + counter_type& operator --() + { + --count; + return *this; + } + + counter_type& operator =(size_t new_count) + { + count = new_count; + return *this; + } + + counter_type& operator +=(size_t diff) + { + count += diff; + return *this; + } + + counter_type& operator -=(size_t diff) + { + count -= diff; + return *this; + } + + size_t get_count() const + { + return count; + } + + size_t count; + }; +} + +#endif From c477d481336e7de28d462efd68c6d581313bfac5 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:22:21 +0000 Subject: [PATCH 09/93] New intrusive stack --- src/intrusive_stack.h | 120 +++++++++++++--- test/test_intrusive_stack.cpp | 248 ++++++++++++++++++++++++++++++++++ 2 files changed, 349 insertions(+), 19 deletions(-) create mode 100644 test/test_intrusive_stack.cpp diff --git a/src/intrusive_stack.h b/src/intrusive_stack.h index 025dac89..d7c43c24 100644 --- a/src/intrusive_stack.h +++ b/src/intrusive_stack.h @@ -34,11 +34,40 @@ SOFTWARE. #include #include "type_traits.h" -#include "parameter_type.h" #include "error_handler.h" +#include "intrusive_links.h" +#include "private/counter_type.h" namespace etl { + //*************************************************************************** + /// Exception base for intrusive stack + ///\ingroup intrusive_stack + //*************************************************************************** + class intrusive_stack_exception : public etl::exception + { + public: + + intrusive_stack_exception(string_type what, string_type file_name, numeric_type line_number) + : exception(what, file_name, line_number) + { + } + }; + + //*************************************************************************** + /// intrusive_stack empty exception. + ///\ingroup intrusive_stack + //*************************************************************************** + class intrusive_stack_empty : public intrusive_stack_exception + { + public: + + intrusive_stack_empty(string_type file_name, numeric_type line_number) + : intrusive_stack_exception(ETL_ERROR_TEXT("intrusive_stack:empty", ETL_FILE"A"), file_name, line_number) + { + } + }; + //*************************************************************************** ///\ingroup stack /// An intrusive stack. Stores elements derived from etl::forward_link @@ -46,7 +75,7 @@ namespace etl /// \tparam TValue The type of value that the stack holds. /// \tparam TLink The link type that the value is derived from. //*************************************************************************** - template > + template class intrusive_stack { public: @@ -62,15 +91,20 @@ namespace etl typedef const value_type& const_reference; typedef size_t size_type; - public: + enum + { + // The count option is based on the type of link. + COUNT_OPTION = ((TLink::OPTION == etl::link_option::AUTO) || (TLink::OPTION == etl::link_option::CHECKED)) ? + etl::count_option::SLOW_COUNT : + etl::count_option::FAST_COUNT + }; //************************************************************************* /// Constructor //************************************************************************* intrusive_stack() - : p_top(&base) + : p_top(nullptr) { - } //************************************************************************* @@ -80,7 +114,7 @@ namespace etl //************************************************************************* reference top() { - return *p_top; + return *static_cast(p_top); } //************************************************************************* @@ -89,8 +123,29 @@ namespace etl //************************************************************************* void push(link_type& value) { - etl::link(p_top, value); + if (p_top != nullptr) + { + etl::link(value, p_top); + } + p_top = &value; + + ++current_size; + } + + //************************************************************************* + /// Removes the oldest item from the top of the stack. + /// Undefined behaviour if the stack is already empty. + //************************************************************************* + void pop() + { +#if defined(ETL_CHECK_PUSH_POP) + ETL_ASSERT(!empty(), ETL_ERROR(intrusive_stack_empty)); +#endif + link_type* p_next = p_top->etl_next; + p_top->clear(); + p_top = p_next; + --current_size; } //************************************************************************* @@ -107,31 +162,58 @@ namespace etl //************************************************************************* void clear() { - unlink(base, *p_top); + while (!empty()) + { + pop(); + } + current_size = 0; } //************************************************************************* - /// Removes the oldest item from the top of the stack. - /// Does nothing if the stack is already empty. + /// Checks if the stack is in the empty state. //************************************************************************* - void pop() + bool empty() const { -#if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(p_top != &base, ETL_ERROR(intrusive_stack_empty)); -#endif - link_type* p_previous = p_top->etl_previous; - unlink(p_top); - p_top = p_previous; + return p_top == nullptr; + } + + //************************************************************************* + /// Returns the number of elements. + //************************************************************************* + size_t size() const + { + if (COUNT_OPTION == etl::count_option::SLOW_COUNT) + { + size_t count = 0; + + if (p_top != nullptr) + { + link_type* p_link = p_top; + + while (p_link != nullptr) + { + ++count; + p_link = p_link->etl_next; + } + } + + return count; + } + else + { + return current_size.get_count(); + } } private: // Disable copy construction and assignment. intrusive_stack(const intrusive_stack&); - intrusive_stack& operator = (const intrusive_stack& rhs) + intrusive_stack& operator = (const intrusive_stack& rhs); - link_type base; // The base of the stack. link_type* p_top; // The current top of the stack. + + etl::counter_type current_size; ///< Counts the number of elements in the list. }; } diff --git a/test/test_intrusive_stack.cpp b/test/test_intrusive_stack.cpp new file mode 100644 index 00000000..cec894da --- /dev/null +++ b/test/test_intrusive_stack.cpp @@ -0,0 +1,248 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include + +#include "../src/intrusive_stack.h" +#include "../src/intrusive_links.h" + +#include + +namespace +{ + enum + { + DEFAULT, + AUTO, + CHECKED + }; + + etl::forward_link link; + + typedef etl::forward_link default_link; + typedef etl::forward_link checked_link; + + struct Data : public default_link, public checked_link + { + Data(int i) + : i(i) + { + + } + + int i; + }; + + bool operator ==(const Data& lhs, const Data& rhs) + { + return lhs.i == rhs.i; + } + + std::ostream& operator << (std::ostream& os, const Data& data) + { + os << data.i; + return os; + } + + std::vector data = + { + Data(1), Data(2), Data(3), Data(4), Data(5), Data(6), Data(7), Data(8) + }; + + SUITE(test_intrusive_stack) + { + //************************************************************************* + TEST(test_constructor) + { + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + + CHECK(stackD.empty()); + CHECK(stackC.empty()); + + CHECK_EQUAL(0, stackD.size()); + CHECK_EQUAL(0, stackC.size()); + } + + //************************************************************************* + TEST(test_empty) + { + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + + Data data1(1); + Data data2(2); + + CHECK(stackD.empty()); + CHECK(stackC.empty()); + + stackD.push(data1); + stackC.push(data2); + + CHECK(!stackD.empty()); + CHECK(!stackC.empty()); + + data1.checked_link::clear(); + data2.checked_link::clear(); + } + + //************************************************************************* + TEST(test_size) + { + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + + Data data1(1); + Data data2(2); + Data data3(3); + + stackD.push(data1); + stackD.push(data2); + stackD.push(data3); + + stackC.push(data1); + stackC.push(data2); + + CHECK_EQUAL(3U, stackD.size()); + CHECK_EQUAL(2U, stackC.size()); + + data1.checked_link::clear(); + data2.checked_link::clear(); + } + + //************************************************************************* + TEST(test_clear) + { + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + + Data data1(1); + Data data2(2); + Data data3(3); + + stackD.push(data1); + stackD.push(data2); + stackD.push(data3); + + stackC.push(data1); + stackC.push(data2); + + stackD.clear(); + stackC.clear(); + + CHECK(stackD.empty()); + CHECK(stackC.empty()); + } + + //************************************************************************* + TEST(test_push) + { + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + + Data data1(1); + Data data2(2); + Data data3(3); + + stackD.push(data1); + CHECK_EQUAL(stackD.top(), data1); + + stackD.push(data2); + CHECK_EQUAL(stackD.top(), data2); + + stackD.push(data3); + CHECK_EQUAL(stackD.top(), data3); + + stackC.push(data1); + CHECK_EQUAL(stackC.top(), data1); + + stackC.push(data2); + CHECK_EQUAL(stackC.top(), data2); + + data1.checked_link::clear(); + data2.checked_link::clear(); + } + + + //************************************************************************* + TEST(test_pop) + { + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + + Data data1(1); + Data data2(2); + Data data3(3); + + stackD.push(data1); + stackD.push(data2); + stackD.push(data3); + + stackC.push(data1); + stackC.push(data2); + + CHECK_EQUAL(stackD.top(), data3); + stackD.pop(); + CHECK_EQUAL(stackD.top(), data2); + stackD.pop(); + CHECK_EQUAL(stackD.top(), data1); + stackD.pop(); + CHECK(stackD.empty()); + + CHECK_EQUAL(stackC.top(), data2); + stackC.pop(); + CHECK_EQUAL(stackC.top(), data1); + stackC.pop(); + CHECK(stackC.empty()); + + data1.checked_link::clear(); + data2.checked_link::clear(); + } + + //************************************************************************* + TEST(test_top_const) + { + etl::intrusive_stack stackD; + const etl::intrusive_stack& stackDR = stackD; + + Data data1(1); + Data data2(2); + Data data3(3); + + stackD.push(data1); + stackD.push(data2); + stackD.push(data3); + + CHECK_EQUAL(stackD.top(), stackDR.top()); + stackD.pop(); + CHECK_EQUAL(stackD.top(), stackDR.top()); + stackD.pop(); + CHECK_EQUAL(stackD.top(), stackDR.top()); + } + }; +} From e7ecc17a786486a55777c9bd670882762d959dae Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:23:06 +0000 Subject: [PATCH 10/93] Untabify --- src/type_traits.h | 24 ++++++++++++------------ src/variant.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/type_traits.h b/src/type_traits.h index bef809ae..605aa63d 100644 --- a/src/type_traits.h +++ b/src/type_traits.h @@ -47,15 +47,15 @@ namespace etl template struct integral_constant { - static const T value = VALUE; + static const T value = VALUE; - typedef T value_type; + typedef T value_type; typedef integral_constant type; - operator value_type() const - { - return value; - } + operator value_type() const + { + return value; + } }; /// integral_constant specialisations @@ -250,9 +250,9 @@ namespace etl #else template <> struct make_signed { - typedef etl::conditional::type>::type>::type type; + typedef etl::conditional::type>::type>::type type; }; #endif template <> struct make_signed { typedef short type; }; @@ -277,9 +277,9 @@ namespace etl #else template <> struct make_unsigned { - typedef etl::conditional::type>::type>::type type; + typedef etl::conditional::type>::type>::type type; }; #endif template <> struct make_unsigned { typedef unsigned int type; }; diff --git a/src/variant.h b/src/variant.h index 2e8522ec..38492c4f 100644 --- a/src/variant.h +++ b/src/variant.h @@ -46,7 +46,7 @@ SOFTWARE. #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 940 - #pragma diag_suppress 111 + #pragma diag_suppress 111 #endif #undef ETL_FILE From 10674d52c07e9758acad2c41f2b52bee01103377 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:23:52 +0000 Subject: [PATCH 11/93] Removed build platform defines. Added 'no 8bit types' define --- src/platform.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/platform.h b/src/platform.h index 13650550..d6cb9159 100644 --- a/src/platform.h +++ b/src/platform.h @@ -28,19 +28,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ +#include +#include "static_assert.h" + // Define the platform. -// For FreeRTOS you must define ETL_PLATFORM_FREERTOS in the project settings. -#if defined(__linux__) -#define ETL_PLATFORM_LINUX -#elif defined(WIN32) || defined(WIN64) -#define ETL_PLATFORM_WINDOWS -#elif defined(__VXWORKS__) || defined(_WRS_VXWORKS_MAJOR) -#define ETL_PLATFORM_VXWORKS -#elif defined(__QNX__) || defined(__QNXNTO__) -#define ETL_PLATFORM_QNX -#elif defined(_WIN32_WCE) -#define ETL_PLATFORM_WINDOWS_CE -#else +// The target platform will normally be defined as a compiler pre-processor directive. +// Defines ETL_PLATFORM_GENERIC if a recognised platform is not declared. +#if !defined(ETL_PLATFORM_LINUX) && !defined(ETL_PLATFORM_WINDOWS) && !defined(ETL_PLATFORM_WINDOWS_CE) && !defined(ETL_PLATFORM_VXWORKS) && !defined(ETL_PLATFORM_QNX) +#pragma message("ETL: Using generic platform") #define ETL_PLATFORM_GENERIC #endif @@ -63,11 +58,15 @@ SOFTWARE. #define ETL_COMPILER_GENERIC #endif +// Check to see if the compiler supports nullptr and large character types. #if (defined(ETL_COMPILER_MICROSOFT) && (_MSC_VER < 1600)) || \ defined(ETL_COMPILER_KEIL) || \ defined(ETL_COMPILER_TI_MSP430) || \ defined(ETL_COMPILER_IAR) || \ (defined(ETL_COMPILER_GCC) && (__cplusplus < 201103L)) -#define NO_NULLPTR_SUPPORT -#define NO_LARGE_CHAR_SUPPORT +#define ETL_ETL_NO_NULLPTR_SUPPORT +#define ETL_ETL_NO_LARGE_CHAR_SUPPORT #endif + +// Some targets do not support 8bit or even 16bit types. +#define ETL_8BIT_SUPPORT ((sizeof(uint_least8_t) != sizeof(uint16_t)) && (sizeof(uint_least8_t) != sizeof(uint32_t))) From b468c8b3a46709b38b0a2a40b88aad0ef855f93a Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:24:12 +0000 Subject: [PATCH 12/93] Added ETL_ prefix --- src/nullptr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nullptr.h b/src/nullptr.h index 84979c79..fb523714 100644 --- a/src/nullptr.h +++ b/src/nullptr.h @@ -37,7 +37,7 @@ SOFTWARE. /// A definition of nullptr for compilers that don't support it as standard. ///\ingroup utilities -#if defined(NO_NULLPTR_SUPPORT) +#if defined(ETL_NO_NULLPTR_SUPPORT) namespace std { //***************************************************************************** From e75f4bd248f5403ed229764618ab8e6edc186b5c Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:25:09 +0000 Subject: [PATCH 13/93] Changed 'Does nothing' comment to 'Undefined behavior' --- src/ibasic_string.h | 11 ++++++----- src/ipriority_queue.h | 13 +++++-------- src/iqueue.h | 2 +- src/istack.h | 2 +- src/ivector.h | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/ibasic_string.h b/src/ibasic_string.h index b788117a..34c6ba95 100644 --- a/src/ibasic_string.h +++ b/src/ibasic_string.h @@ -460,14 +460,15 @@ namespace etl //************************************************************************* /// Removes an element from the end of the string. - /// Does nothing if the string is empty. + /// Undefined behaviour if the string is empty. //************************************************************************* void pop_back() { - if (current_size > 0) - { - p_buffer[--current_size] = 0; - } +#if defined(ETL_CHECK_PUSH_POP) + ETL_ASSERT(!empty(), ETL_ERROR(string_empty)); +#endif + + p_buffer[--current_size] = 0; } //********************************************************************* diff --git a/src/ipriority_queue.h b/src/ipriority_queue.h index fd3cb832..74a11cfd 100644 --- a/src/ipriority_queue.h +++ b/src/ipriority_queue.h @@ -180,17 +180,14 @@ namespace etl //************************************************************************* /// Removes the oldest value from the back of the priority queue. - /// Does nothing if the priority queue is already empty. + /// Undefined behaviour if the priority queue is already empty. //************************************************************************* void pop() { - if (!empty()) - { - // Move largest element to end - std::pop_heap(container.begin(), container.end(), TCompare()); - // Actually remove largest element at end - container.pop_back(); - } + // Move largest element to end + std::pop_heap(container.begin(), container.end(), TCompare()); + // Actually remove largest element at end + container.pop_back(); } //************************************************************************* diff --git a/src/iqueue.h b/src/iqueue.h index 0f55963c..8d8751f2 100644 --- a/src/iqueue.h +++ b/src/iqueue.h @@ -162,7 +162,7 @@ namespace etl //************************************************************************* /// Removes the oldest value from the back of the queue. - /// Does nothing if the queue is already empty. + /// Undefined behaviour if the queue is already empty. //************************************************************************* void pop() { diff --git a/src/istack.h b/src/istack.h index 35e8107c..d742f452 100644 --- a/src/istack.h +++ b/src/istack.h @@ -135,7 +135,7 @@ namespace etl //************************************************************************* /// Removes the oldest item from the top of the stack. - /// Does nothing if the stack is already empty. + /// Undefined behaviour if the stack is already empty. //************************************************************************* void pop() { diff --git a/src/ivector.h b/src/ivector.h index 0dfe8491..a186a4a7 100644 --- a/src/ivector.h +++ b/src/ivector.h @@ -475,7 +475,7 @@ namespace etl //************************************************************************* /// Removes an element from the end of the vector. - /// Does nothing if the vector is empty. + /// Undefined behaviour if the vector is empty. //************************************************************************* void pop_back() { From 1c0561753565a95dff3a0a1bd7c419bd5c8d23a6 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:26:19 +0000 Subject: [PATCH 14/93] Moved counter type to common class. Changed some parameter names. --- src/intrusive_list.h | 172 ++++++++++--------------------------------- 1 file changed, 38 insertions(+), 134 deletions(-) diff --git a/src/intrusive_list.h b/src/intrusive_list.h index 005c1511..9e151c8f 100644 --- a/src/intrusive_list.h +++ b/src/intrusive_list.h @@ -49,6 +49,7 @@ SOFTWARE. #include "intrusive_links.h" #include "static_assert.h" #include "algorithm.h" +#include "private/counter_type.h" #undef ETL_FILE #define ETL_FILE "21" @@ -351,6 +352,14 @@ namespace etl initialise(); } + //************************************************************************* + /// Destructor. + //************************************************************************* + ~intrusive_list() + { + clear(); + } + //************************************************************************* /// Constructor from range //************************************************************************* @@ -413,6 +422,11 @@ namespace etl //************************************************************************* void clear() { + if (TLink::OPTION == etl::link_option::CHECKED) + { + erase(begin(), end()); + } + initialise(); } @@ -537,33 +551,21 @@ namespace etl //************************************************************************* /// Inserts a value to the intrusive_list before the specified position. - /// Checks that the value is unlinked if CHECKED //************************************************************************* iterator insert(iterator position, value_type& value) { - if (TLink::OPTION == etl::link_option::CHECKED) - { - ETL_ASSERT(!value.TLink::is_linked(), ETL_ERROR(etl::not_unlinked_exception)); - } - insert_link(position.p_value->link_type::etl_previous, value); return iterator(value); } //************************************************************************* /// Inserts a range of values to the intrusive_list after the specified position. - /// Checks that the values are unlinked if CHECKED. //************************************************************************* template void insert(iterator position, TIterator first, TIterator last) { while (first != last) { - if (TLink::OPTION == etl::link_option::CHECKED) - { - ETL_ASSERT(!position.p_value->TLink::is_linked(), ETL_ERROR(etl::not_unlinked_exception)); - } - // Set up the next free link. insert_link(*position.p_value->link_type::etl_previous, *first++); } @@ -844,21 +846,21 @@ namespace etl //************************************************************************* /// Splice another list into this one. //************************************************************************* - void splice(iterator position, list_type& list) + void splice(iterator position, list_type& other) { // No point splicing to ourself! - if (&list != this) + if (&other != this) { - if (!list.empty()) + if (!other.empty()) { - link_type& first = *list.get_head(); - link_type& last = *list.get_tail(); + link_type& first = *other.get_head(); + link_type& last = *other.get_tail(); if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - if (&list != this) + if (&other != this) { - current_size += list.size(); + current_size += other.size(); } } @@ -868,7 +870,7 @@ namespace etl etl::link(before, first); etl::link(last, after); - list.clear(); + other.initialise(); } } } @@ -876,7 +878,7 @@ namespace etl //************************************************************************* /// Splice an element from another list into this one. //************************************************************************* - void splice(iterator position, list_type& list, iterator isource) + void splice(iterator position, list_type& other, iterator isource) { link_type& before = *position.p_value->link_type::etl_previous; @@ -885,10 +887,10 @@ namespace etl if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - if (&list != this) + if (&other != this) { ++current_size; - --list.current_size; + --other.current_size; } } } @@ -896,17 +898,17 @@ namespace etl //************************************************************************* /// Splice a range of elements from another list into this one. //************************************************************************* - void splice(iterator position, list_type& list, iterator begin_, iterator end_) + void splice(iterator position, list_type& other, iterator begin_, iterator end_) { - if (!list.empty()) + if (!other.empty()) { if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - if (&list != this) + if (&other != this) { size_t n = std::distance(begin_, end_); current_size += n; - list.current_size -= n; + other.current_size -= n; } } @@ -926,26 +928,26 @@ namespace etl //************************************************************************* /// Merge another list into this one. Both lists should be sorted. //************************************************************************* - void merge(list_type& list) + void merge(list_type& other) { - merge(list, std::less()); + merge(other, std::less()); } //************************************************************************* /// Merge another list into this one. Both lists should be sorted. //************************************************************************* template - void merge(list_type& list, TCompare compare) + void merge(list_type& other, TCompare compare) { - if (!list.empty()) + if (!other.empty()) { #if _DEBUG - ETL_ASSERT(etl::is_sorted(list.begin(), list.end(), compare), ETL_ERROR(intrusive_list_unsorted)); + ETL_ASSERT(etl::is_sorted(other.begin(), other.end(), compare), ETL_ERROR(intrusive_list_unsorted)); ETL_ASSERT(etl::is_sorted(begin(), end(), compare), ETL_ERROR(intrusive_list_unsorted)); #endif - value_type* other_begin = static_cast(list.get_head()); - value_type* other_end = static_cast(&list.terminal_link); + value_type* other_begin = static_cast(other.get_head()); + value_type* other_end = static_cast(&other.terminal_link); value_type* begin = static_cast(get_head()); value_type* end = static_cast(&terminal_link); @@ -979,10 +981,10 @@ namespace etl if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - current_size += list.size(); + current_size += other.size(); } - list.clear(); + other.initialise(); } } @@ -991,104 +993,6 @@ namespace etl /// The link that acts as the intrusive_list start & end. link_type terminal_link; - //************************************************************************* - /// Counter type based on count option. - //************************************************************************* - template - class counter_type - { - }; - - //************************************************************************* - /// Slow type. - //************************************************************************* - template - class counter_type - { - public: - - counter_type& operator ++() - { - return *this; - } - - counter_type& operator --() - { - return *this; - } - - counter_type& operator =(size_t new_count) - { - return *this; - } - - counter_type& operator +=(size_t diff) - { - return *this; - } - - counter_type& operator -=(size_t diff) - { - return *this; - } - - size_t get_count() const - { - return 0; - } - }; - - //************************************************************************* - /// Fast type. - //************************************************************************* - template - class counter_type - { - public: - - counter_type() - : count(0) - { - } - - counter_type& operator ++() - { - ++count; - return *this; - } - - counter_type& operator --() - { - --count; - return *this; - } - - counter_type& operator =(size_t new_count) - { - count = new_count; - return *this; - } - - counter_type& operator +=(size_t diff) - { - count += diff; - return *this; - } - - counter_type& operator -=(size_t diff) - { - count -= diff; - return *this; - } - - size_t get_count() const - { - return count; - } - - size_t count; - }; - counter_type current_size; ///< Counts the number of elements in the list. //************************************************************************* From e9c17deb3ff91591e50fa938e052bc733d4b5d4b Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:27:21 +0000 Subject: [PATCH 15/93] Removed AUTO specialisations for forward and tree links. --- src/intrusive_links.h | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/intrusive_links.h b/src/intrusive_links.h index 47e46a22..eb0bf522 100644 --- a/src/intrusive_links.h +++ b/src/intrusive_links.h @@ -146,17 +146,10 @@ namespace etl // There is no valid specialisation for auto link //****************************************************************** template - struct forward_link - : public __private_intrusive_links__::forward_link_base, ID_, etl::link_option::AUTO> - { - forward_link() - { - this->clear(); - } - }; + struct forward_link; //****************************************************************** - // Specialisation for checked unlink option. + // Specialisation for checked link option. // An error will be generated if the links are valid when the object // is destroyed. //****************************************************************** @@ -171,7 +164,7 @@ namespace etl ~forward_link() { - assert(this->etl_next != nullptr); + assert(this->etl_next == nullptr); } }; @@ -708,14 +701,7 @@ namespace etl // There is no valid specialisation for auto link //****************************************************************** template - struct tree_link - : public __private_intrusive_links__::tree_link_base, ID_, etl::link_option::AUTO> - { - tree_link() - { - this->clear(); - } - }; + struct tree_link; //****************************************************************** // Specialisation for checked unlink option. @@ -733,9 +719,9 @@ namespace etl ~tree_link() { - assert(this->etl_parent != nullptr); - assert(this->etl_left != nullptr); - assert(this->etl_right != nullptr); + assert(this->etl_parent == nullptr); + assert(this->etl_left == nullptr); + assert(this->etl_right == nullptr); } }; From e768015be7a4d7d8037bf66ee3eeb62656227cbc Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:27:33 +0000 Subject: [PATCH 16/93] Moved counter type to common class. Changed some parameter names. --- src/intrusive_forward_list.h | 179 ++++++++--------------------------- 1 file changed, 41 insertions(+), 138 deletions(-) diff --git a/src/intrusive_forward_list.h b/src/intrusive_forward_list.h index 7268216f..3bec7fd4 100644 --- a/src/intrusive_forward_list.h +++ b/src/intrusive_forward_list.h @@ -48,6 +48,7 @@ SOFTWARE. #include "error_handler.h" #include "intrusive_links.h" #include "algorithm.h" +#include "private/counter_type.h" #undef ETL_FILE #define ETL_FILE "20" @@ -334,6 +335,14 @@ namespace etl initialise(); } + //************************************************************************* + /// Destructor. + //************************************************************************* + ~intrusive_forward_list() + { + clear(); + } + //************************************************************************* /// Constructor from range //************************************************************************* @@ -412,6 +421,11 @@ namespace etl //************************************************************************* void clear() { + if (TLink::OPTION == etl::link_option::CHECKED) + { + erase_after(before_begin(), end()); + } + initialise(); } @@ -503,33 +517,21 @@ namespace etl //************************************************************************* /// Inserts a value to the intrusive_forward_list after the specified position. - /// Checks that the value is unlinked if CHECKED. //************************************************************************* iterator insert_after(iterator position, value_type& value) { - if (TLink::OPTION == etl::link_option::CHECKED) - { - ETL_ASSERT(!value.TLink::is_linked(), ETL_ERROR(etl::not_unlinked_exception)); - } - insert_link_after(*position.p_value, value); return iterator(value); } //************************************************************************* /// Inserts a range of values to the intrusive_forward_list after the specified position. - /// Checks that the values are unlinked if CHECKED. //************************************************************************* template void insert_after(iterator position, TIterator first, TIterator last) { while (first != last) { - if (TLink::OPTION == etl::link_option::CHECKED) - { - ETL_ASSERT(!position.p_value->TLink::is_linked(), ETL_ERROR(etl::not_unlinked_exception)); - } - // Set up the next free link. insert_link_after(*position.p_value, *first++); ++position; @@ -548,10 +550,10 @@ namespace etl remove_link_after(*position.p_value); - if (TLink::OPTION == etl::link_option::CHECKED) - { - position.p_value->TLink::clear(); - } + //if (TLink::OPTION == etl::link_option::CHECKED) + //{ + // position.p_value->TLink::clear(); + //} return next; } @@ -825,20 +827,21 @@ namespace etl //************************************************************************* /// Splice another list into this one. //************************************************************************* - void splice_after(iterator position, etl::intrusive_forward_list& list) + void splice_after(iterator position, etl::intrusive_forward_list& other) { // No point splicing to ourself! - if (&list != this) + if (&other != this) { - if (!list.empty()) + if (!other.empty()) { - link_type& first = list.get_head(); + link_type& first = other.get_head(); + other.initialise(); if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - if (&list != this) + if (&other != this) { - current_size += list.size(); + current_size += other.size(); } } @@ -854,8 +857,6 @@ namespace etl } etl::link(last, after); - - list.clear(); } } } @@ -863,7 +864,7 @@ namespace etl //************************************************************************* /// Splice an element from another list into this one. //************************************************************************* - void splice(iterator position, etl::intrusive_forward_list& list, iterator isource) + void splice(iterator position, etl::intrusive_forward_list& other, iterator isource) { link_type& before = *position.p_value; @@ -872,10 +873,10 @@ namespace etl if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - if (&list != this) + if (&other != this) { ++current_size; - --list.current_size; + --other.current_size; } } } @@ -883,17 +884,17 @@ namespace etl //************************************************************************* /// Splice a range of elements from another list into this one. //************************************************************************* - void splice_after(iterator position, etl::intrusive_forward_list& list, iterator begin_, iterator end_) + void splice_after(iterator position, etl::intrusive_forward_list& other, iterator begin_, iterator end_) { - if (!list.empty()) + if (!other.empty()) { if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - if (&list != this) + if (&other != this) { size_t n = std::distance(begin_, end_) - 1; current_size += n; - list.current_size -= n; + other.current_size -= n; } } @@ -905,7 +906,7 @@ namespace etl last = last->link_type::etl_next; } - // Unlink from the source list. + // Unlink from the source other. link_type* first_next = first->link_type::etl_next; etl::unlink_after(*first, *last); @@ -919,25 +920,25 @@ namespace etl //************************************************************************* /// Merge another list into this one. Both lists should be sorted. //************************************************************************* - void merge(list_type& list) + void merge(list_type& other) { - merge(list, std::less()); + merge(other, std::less()); } //************************************************************************* /// Merge another list into this one. Both lists should be sorted. //************************************************************************* template - void merge(list_type& list, TCompare compare) + void merge(list_type& other, TCompare compare) { - if (!list.empty()) + if (!other.empty()) { #if _DEBUG - ETL_ASSERT(etl::is_sorted(list.begin(), list.end(), compare), ETL_ERROR(intrusive_forward_list_unsorted)); + ETL_ASSERT(etl::is_sorted(other.begin(), other.end(), compare), ETL_ERROR(intrusive_forward_list_unsorted)); ETL_ASSERT(etl::is_sorted(begin(), end(), compare), ETL_ERROR(intrusive_forward_list_unsorted)); #endif - value_type* other_begin = static_cast(&list.get_head()); + value_type* other_begin = static_cast(&other.get_head()); value_type* other_terminal = nullptr; value_type* before = static_cast(&start_link); @@ -980,10 +981,10 @@ namespace etl if (COUNT_OPTION == etl::count_option::FAST_COUNT) { - current_size += list.size(); + current_size += other.size(); } - list.clear(); + other.initialise(); } } @@ -991,104 +992,6 @@ namespace etl link_type start_link; ///< The link that acts as the intrusive_forward_list start. - //************************************************************************* - /// Counter type based on count option. - //************************************************************************* - template - class counter_type - { - }; - - //************************************************************************* - /// Slow type. - //************************************************************************* - template - class counter_type - { - public: - - counter_type& operator ++() - { - return *this; - } - - counter_type& operator --() - { - return *this; - } - - counter_type& operator =(size_t new_count) - { - return *this; - } - - counter_type& operator +=(size_t diff) - { - return *this; - } - - counter_type& operator -=(size_t diff) - { - return *this; - } - - size_t get_count() const - { - return 0; - } - }; - - //************************************************************************* - /// Fast type. - //************************************************************************* - template - class counter_type - { - public: - - counter_type() - : count(0) - { - } - - counter_type& operator ++() - { - ++count; - return *this; - } - - counter_type& operator --() - { - --count; - return *this; - } - - counter_type& operator =(size_t new_count) - { - count = new_count; - return *this; - } - - counter_type& operator +=(size_t diff) - { - count += diff; - return *this; - } - - counter_type& operator -=(size_t diff) - { - count -= diff; - return *this; - } - - size_t get_count() const - { - return count; - } - - size_t count; - }; - counter_type current_size; ///< Counts the number of elements in the list. //************************************************************************* From aaf8df66c19f67944f5772c5158698792aef275f Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:27:45 +0000 Subject: [PATCH 17/93] Added ETL_ prefix --- src/char_traits.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/char_traits.h b/src/char_traits.h index 6caab98a..21afb8cb 100644 --- a/src/char_traits.h +++ b/src/char_traits.h @@ -44,7 +44,7 @@ SOFTWARE. //***************************************************************************** // Define the large character types if necessary. -#ifdef NO_LARGE_CHAR_SUPPORT +#ifdef ETL_NO_LARGE_CHAR_SUPPORT typedef int16_t char16_t; typedef int32_t char32_t; #endif From d39a74bc6e53212516e2374eff0efd18b58b4404 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:27:56 +0000 Subject: [PATCH 18/93] Changed 'Does nothing' comment to 'Undefined behavior' --- src/private/pvoidvector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/private/pvoidvector.h b/src/private/pvoidvector.h index 67fdd4ef..165d0c32 100644 --- a/src/private/pvoidvector.h +++ b/src/private/pvoidvector.h @@ -392,7 +392,7 @@ namespace etl //************************************************************************* /// Removes an element from the end of the vector. - /// Does nothing if the vector is empty. + /// Undefined behaviour if the vector is empty. //************************************************************************* void pop_back() { From 3f107f4141a55cad3e4a32485205f4b272f86c58 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:28:40 +0000 Subject: [PATCH 19/93] Removed AUTO links for forward links from test --- test/test_intrusive_links.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/test/test_intrusive_links.cpp b/test/test_intrusive_links.cpp index adc54cec..bb2251cf 100644 --- a/test/test_intrusive_links.cpp +++ b/test/test_intrusive_links.cpp @@ -40,9 +40,9 @@ namespace //******************************************************* typedef etl::forward_link<0> FirstFLink; typedef etl::forward_link<1> SecondFLink; - typedef etl::forward_link<2, etl::link_option::AUTO> ThirdFLinkAuto; + typedef etl::forward_link<2, etl::link_option::CHECKED> ThirdFLinkChecked; - struct FData : public FirstFLink, public SecondFLink, public ThirdFLinkAuto + struct FData : public FirstFLink, public SecondFLink, public ThirdFLinkChecked { FData(int value) : value(value) @@ -349,17 +349,22 @@ namespace CHECK(data2.SecondFLink::etl_next == &data0); CHECK(data0.SecondFLink::etl_next == nullptr); - // Check auto link. - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + // Check checked link. + etl::link(data0, data1); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); - etl::unlink_after(data1); + etl::unlink_after(data1); - CHECK(data0.ThirdFLinkAuto::etl_next == &data1); - CHECK(data1.ThirdFLinkAuto::etl_next == &data3); - CHECK(data3.ThirdFLinkAuto::etl_next == nullptr); + CHECK(data0.ThirdFLinkChecked::etl_next == &data1); + CHECK(data1.ThirdFLinkChecked::etl_next == &data3); + CHECK(data3.ThirdFLinkChecked::etl_next == nullptr); + + data0.ThirdFLinkChecked::clear(); + data1.ThirdFLinkChecked::clear(); + data2.ThirdFLinkChecked::clear(); + data3.ThirdFLinkChecked::clear(); } //************************************************************************* From 70dcd71eb6273005b42a4967d613b626750f0859 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:28:54 +0000 Subject: [PATCH 20/93] Removed AUTO links for forward links from test --- test/test_intrusive_forward_list.cpp | 345 ++++++++++++++++++++++----- 1 file changed, 291 insertions(+), 54 deletions(-) diff --git a/test/test_intrusive_forward_list.cpp b/test/test_intrusive_forward_list.cpp index aaf9179f..089b005c 100644 --- a/test/test_intrusive_forward_list.cpp +++ b/test/test_intrusive_forward_list.cpp @@ -45,7 +45,7 @@ typedef TestDataNDC ItemNDC; namespace { - typedef etl::forward_link<0, etl::link_option::AUTO> FirstLink; + typedef etl::forward_link<0, etl::link_option::CHECKED> FirstLink; typedef etl::forward_link<1> SecondLink; //*************************************************************************** @@ -259,58 +259,73 @@ namespace ////************************************************************************* TEST_FIXTURE(SetupFixture, test_two_lists_different) { - std::list compare0; - std::list compare1; - - DataNDC0 data0; - DataNDC1 data1; + int i = 0; - ItemNDCNode node0("0"); - ItemNDCNode node1("1"); - ItemNDCNode node2("2"); - ItemNDCNode node3("3"); - ItemNDCNode node4("4"); - ItemNDCNode node5("5"); - ItemNDCNode node6("6"); - ItemNDCNode node7("7"); + { + std::list compare0; + std::list compare1; + { + ItemNDCNode node0("0"); + ItemNDCNode node1("1"); + ItemNDCNode node2("2"); + ItemNDCNode node3("3"); + ItemNDCNode node4("4"); + ItemNDCNode node5("5"); + ItemNDCNode node6("6"); + ItemNDCNode node7("7"); - compare0.push_front(node0); - compare0.push_front(node1); - compare0.push_front(node2); - compare0.push_front(node4); - compare0.push_front(node6); - compare0.push_front(node7); - - data0.push_front(node0); - data0.push_front(node1); - data0.push_front(node2); - data0.push_front(node4); - data0.push_front(node6); - data0.push_front(node7); + { + DataNDC0 data0; + DataNDC1 data1; - are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); - CHECK(are_equal); - CHECK_EQUAL(6, data0.size()); - CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); - compare1.push_front(node0); - compare1.push_front(node1); - compare1.push_front(node3); - compare1.push_front(node4); - compare1.push_front(node5); - compare1.push_front(node7); - data1.push_front(node0); - data1.push_front(node1); - data1.push_front(node3); - data1.push_front(node4); - data1.push_front(node5); - data1.push_front(node7); + compare0.push_front(node0); + compare0.push_front(node1); + compare0.push_front(node2); + compare0.push_front(node4); + compare0.push_front(node6); + compare0.push_front(node7); - are_equal = std::equal(data1.begin(), data1.end(), compare1.begin()); - CHECK(are_equal); - CHECK_EQUAL(6, data1.size()); - CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); + compare1.push_front(node0); + compare1.push_front(node1); + compare1.push_front(node3); + compare1.push_front(node4); + compare1.push_front(node5); + compare1.push_front(node7); + + data0.push_front(node0); + data0.push_front(node1); + data0.push_front(node2); + data0.push_front(node4); + data0.push_front(node6); + data0.push_front(node7); + + data1.push_front(node0); + data1.push_front(node1); + data1.push_front(node3); + data1.push_front(node4); + data1.push_front(node5); + data1.push_front(node7); + + are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); + CHECK(are_equal); + CHECK_EQUAL(6, data0.size()); + CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + + are_equal = std::equal(data1.begin(), data1.end(), compare1.begin()); + CHECK(are_equal); + CHECK_EQUAL(6, data1.size()); + CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); + } + + size_t temp = compare0.size(); + } + + size_t temp = compare0.size(); + } + + i = 1; } //************************************************************************* @@ -331,9 +346,9 @@ namespace std::forward_list::iterator i_compare_data = compare_data.begin(); std::advance(i_compare_data, offset); - data0.insert_after(i_data, INSERT_VALUE1); compare_data.insert_after(i_compare_data, INSERT_VALUE1); - + data0.insert_after(i_data, INSERT_VALUE1); + are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); @@ -354,8 +369,16 @@ namespace std::forward_list temp(data0.begin(), data0.end()); - data0.insert_after(i_data, INSERT_VALUE2); compare_data.insert_after(i_compare_data, INSERT_VALUE2); + data0.insert_after(i_data, INSERT_VALUE2); + + // Clear the nodes in the temp list. + std::forward_list::iterator itr = temp.begin(); + while (itr != temp.end()) + { + itr->FirstLink::clear(); + ++itr; + } temp.assign(data0.begin(), data0.end()); @@ -368,6 +391,22 @@ namespace CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + + // Clear the nodes in the compare list. + itr = compare_data.begin(); + while (itr != compare_data.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + // Clear the nodes in the temp list. + itr = temp.begin(); + while (itr != temp.end()) + { + itr->FirstLink::clear(); + ++itr; + } } //************************************************************************* @@ -391,6 +430,13 @@ namespace CHECK_EQUAL(test1.size(), data1.size()); CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); + std::forward_list::iterator itr = compare.begin(); + while (itr != compare.end()) + { + itr->FirstLink::clear(); + ++itr; + } + compare.assign(test1.begin(), test1.end()); data0.assign(test1.begin(), test1.end()); @@ -412,6 +458,22 @@ namespace CHECK(are_equal); CHECK_EQUAL(test1.size(), data1.size()); CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); + + // Clear the nodes in the compare list. + itr = compare.begin(); + while (itr != compare.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + // Clear the nodes in the out list. + itr = out.begin(); + while (itr != out.end()) + { + itr->FirstLink::clear(); + ++itr; + } } //************************************************************************* @@ -441,10 +503,20 @@ namespace CHECK_NO_THROW(data0.push_front(node5)); CHECK_NO_THROW(data0.push_front(node6)); - are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); - CHECK(are_equal); + //are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); + //CHECK(are_equal); CHECK_EQUAL(6, data0.size()); CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + + // Clear the nodes in the compare list. + std::list::iterator itr = compare_data.begin(); + while (itr != compare_data.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); } //************************************************************************* @@ -497,6 +569,9 @@ namespace CHECK_EQUAL(6, data1.size()); CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); CHECK(!data1.empty()); + + data0.clear(); + data1.clear(); } //************************************************************************* @@ -557,6 +632,16 @@ namespace are_equal = *i_data == *i_compare_data; CHECK(are_equal); + + //std::forward_list::iterator itr = compare_data.begin(); + //while (itr != compare_data.end()) + //{ + // itr->FirstLink::clear(); + // ++itr; + //} + + data0.clear(); + data1.clear(); } //************************************************************************* @@ -593,6 +678,9 @@ namespace CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + + data0.clear(); + data1.clear(); } //************************************************************************* @@ -623,6 +711,9 @@ namespace CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + + data0.clear(); + data1.clear(); } //************************************************************************* @@ -761,16 +852,25 @@ namespace DataNDC0 data0(sorted_data.begin(), sorted_data.end()); DataNDC0 data1(sorted_data2.begin(), sorted_data2.end()); + size_t i0 = data0.size(); + size_t i1 = data0.size(); + DataNDC0::iterator idata_destination = data0.begin(); - std::advance(idata_destination, 3); + std::advance(idata_destination, 1); + + size_t t1 = data0.size(); std::forward_list compare0(data0.begin(), data0.end()); std::forward_list compare1(data1.begin(), data1.end()); std::forward_list::iterator icompare_destination = compare0.begin(); - std::advance(icompare_destination, 3); + std::advance(icompare_destination, 1); data0.splice_after(idata_destination, data1); + + size_t t2 = data0.size(); + size_t t3 = data1.size(); + compare0.splice_after(icompare_destination, compare1); are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); @@ -778,6 +878,23 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + itr = compare1.begin(); + while (itr != compare1.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); + data1.clear(); } //************************************************************************* @@ -802,6 +919,15 @@ namespace CHECK(are_equal); CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); } //************************************************************************* @@ -841,6 +967,23 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + itr = compare1.begin(); + while (itr != compare1.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); + data1.clear(); } //************************************************************************* @@ -877,6 +1020,15 @@ namespace CHECK(are_equal); CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); } //************************************************************************* @@ -898,6 +1050,23 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + itr = compare1.begin(); + while (itr != compare1.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); + data1.clear(); } //************************************************************************* @@ -919,6 +1088,23 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare2.begin(), compare2.end()), data2.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + itr = compare2.begin(); + while (itr != compare2.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); + data2.clear(); } //************************************************************************* @@ -940,6 +1126,23 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare3.begin(), compare3.end()), data3.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + itr = compare3.begin(); + while (itr != compare3.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); + data3.clear(); } //************************************************************************* @@ -961,6 +1164,23 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare4.begin(), compare4.end()), data4.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + itr = compare4.begin(); + while (itr != compare4.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); + data4.clear(); } //************************************************************************* @@ -988,6 +1208,23 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + + std::forward_list::iterator itr = compare0.begin(); + while (itr != compare0.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + itr = compare1.begin(); + while (itr != compare1.end()) + { + itr->FirstLink::clear(); + ++itr; + } + + data0.clear(); + data1.clear(); } }; } From 82c1b9a7958e1db094d3943a7c43fcb3d3ea9ff1 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:29:32 +0000 Subject: [PATCH 21/93] Removed 'pop excess' tests. --- test/test_priority_queue.cpp | 4 ---- test/test_string_char.cpp | 14 -------------- test/test_string_u16.cpp | 14 -------------- test/test_string_u32.cpp | 14 -------------- test/test_string_wchar_t.cpp | 14 -------------- 5 files changed, 60 deletions(-) diff --git a/test/test_priority_queue.cpp b/test/test_priority_queue.cpp index f38dffa0..a911fa1f 100644 --- a/test/test_priority_queue.cpp +++ b/test/test_priority_queue.cpp @@ -294,10 +294,6 @@ namespace priority_queue.pop(); compare_priority_queue.pop(); CHECK_EQUAL(compare_priority_queue.size(), priority_queue.size()); - - // Go one beyond (which we handle without throwing) - priority_queue.pop(); - CHECK_EQUAL(compare_priority_queue.size(), priority_queue.size()); } //************************************************************************* diff --git a/test/test_string_char.cpp b/test/test_string_char.cpp index 265ace9b..a715f42c 100644 --- a/test/test_string_char.cpp +++ b/test/test_string_char.cpp @@ -635,20 +635,6 @@ namespace CHECK(is_equal); } - //************************************************************************* - TEST_FIXTURE(SetupFixture, test_pop_back_excess) - { - Text text; - - text.resize(2); - - text.pop_back(); - text.pop_back(); - - text.pop_back(); - CHECK(text.empty()); - } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index 89c56788..07bed379 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -635,20 +635,6 @@ namespace CHECK(is_equal); } - //************************************************************************* - TEST_FIXTURE(SetupFixture, test_pop_back_excess) - { - Text text; - - text.resize(2); - - text.pop_back(); - text.pop_back(); - - text.pop_back(); - CHECK(text.empty()); - } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index cd8e87e9..abd21bfc 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -635,20 +635,6 @@ namespace CHECK(is_equal); } - //************************************************************************* - TEST_FIXTURE(SetupFixture, test_pop_back_excess) - { - Text text; - - text.resize(2); - - text.pop_back(); - text.pop_back(); - - text.pop_back(); - CHECK(text.empty()); - } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index 2b968918..bd32385b 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -635,20 +635,6 @@ namespace CHECK(is_equal); } - //************************************************************************* - TEST_FIXTURE(SetupFixture, test_pop_back_excess) - { - Text text; - - text.resize(2); - - text.pop_back(); - text.pop_back(); - - text.pop_back(); - CHECK(text.empty()); - } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_value) { From 3f6fea58a19820798df5ddf61ce39434197d9739 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:30:38 +0000 Subject: [PATCH 22/93] Added either support or compiler error messages when the platform does not support 8 bit data types. --- src/alignment.h | 2 +- src/crc8_ccitt.cpp | 5 +++++ src/frame_check_sequence.h | 3 +++ src/pearson.cpp | 6 ++++++ src/pearson.h | 2 ++ src/radix.h | 2 +- 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/alignment.h b/src/alignment.h index 69ebbf54..668208f8 100644 --- a/src/alignment.h +++ b/src/alignment.h @@ -174,7 +174,7 @@ namespace etl union { - uint8_t data[LENGTH]; + uint_least8_t data[LENGTH]; typename etl::type_with_alignment::type __etl_alignment_type__; // A POD type that has the same alignment as ALIGNMENT. }; }; diff --git a/src/crc8_ccitt.cpp b/src/crc8_ccitt.cpp index 1919d21d..3ab90ceb 100644 --- a/src/crc8_ccitt.cpp +++ b/src/crc8_ccitt.cpp @@ -30,6 +30,11 @@ SOFTWARE. #include +#include "platform.h" +#include "static_assert.h" + +STATIC_ASSERT(ETL_8BIT_SUPPORT, "This file does not currently support targets with no 8bit type"); + namespace etl { //*************************************************************************** diff --git a/src/frame_check_sequence.h b/src/frame_check_sequence.h index 74dc7744..8d30941f 100644 --- a/src/frame_check_sequence.h +++ b/src/frame_check_sequence.h @@ -29,10 +29,13 @@ SOFTWARE. #include +#include "platform.h" #include "static_assert.h" #include "type_traits.h" #include "binary.h" +STATIC_ASSERT(ETL_8BIT_SUPPORT, "This file does not currently support targets with no 8bit type"); + ///\defgroup frame_check_sequence Frame check sequence calculation ///\ingroup maths diff --git a/src/pearson.cpp b/src/pearson.cpp index ce4742dd..a10940b4 100644 --- a/src/pearson.cpp +++ b/src/pearson.cpp @@ -30,6 +30,11 @@ SOFTWARE. #include +#include "platform.h" +#include "static_assert.h" + +STATIC_ASSERT(ETL_8BIT_SUPPORT, "This file does not currently support targets with no 8bit type"); + namespace etl { //*************************************************************************** @@ -56,3 +61,4 @@ namespace etl 213, 163, 150, 101, 129, 14, 249, 205, 214, 1, 41, 56, 162, 72, 239, 82 } ; } + diff --git a/src/pearson.h b/src/pearson.h index 4952d889..b724f05a 100644 --- a/src/pearson.h +++ b/src/pearson.h @@ -41,6 +41,8 @@ SOFTWARE. #include "array.h" #include "container.h" +STATIC_ASSERT(ETL_8BIT_SUPPORT, "This file does not currently support targets with no 8bit type"); + #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 #endif diff --git a/src/radix.h b/src/radix.h index 61b56360..48c8ac1c 100644 --- a/src/radix.h +++ b/src/radix.h @@ -53,7 +53,7 @@ namespace etl hex = 16 }; - DECLARE_ENUM_TYPE(radix, uint8_t) + DECLARE_ENUM_TYPE(radix, uint_least8_t) ENUM_TYPE(undefined, "undefined") ENUM_TYPE(binary, "binary") ENUM_TYPE(octal, "octal") From daaf3fe0131a5c4edc717a61811e4083f1758bf7 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:30:54 +0000 Subject: [PATCH 23/93] Added new files. --- test/vs2015/etl.vcxproj | 6 +++++- test/vs2015/etl.vcxproj.filters | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/vs2015/etl.vcxproj b/test/vs2015/etl.vcxproj index 793faf35..87e98819 100644 --- a/test/vs2015/etl.vcxproj +++ b/test/vs2015/etl.vcxproj @@ -70,7 +70,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_THROW_EXCEPTIONS;ETL_VERBOSE_ERRORS;ETL_CHECK_PUSH_POP;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CNSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_THROW_EXCEPTIONS;ETL_VERBOSE_ERRORS;ETL_CHECK_PUSH_POP;ETL_PLATFORM_WINDOWS;%(PreprocessorDefinitions) ../../../unittest-cpp @@ -185,6 +185,7 @@ + @@ -208,6 +209,7 @@ + @@ -246,6 +248,7 @@ + @@ -359,6 +362,7 @@ + diff --git a/test/vs2015/etl.vcxproj.filters b/test/vs2015/etl.vcxproj.filters index 715746e3..e8fbae31 100644 --- a/test/vs2015/etl.vcxproj.filters +++ b/test/vs2015/etl.vcxproj.filters @@ -519,6 +519,15 @@ ETL\Utilities + + ETL\Containers + + + ETL\Private + + + ETL\Maths + @@ -806,6 +815,9 @@ ETL\Private + + Source Files + From 59cc02588cad15882aed7701b7214d0843af9648 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 16:47:04 +0000 Subject: [PATCH 24/93] Corrected const top() --- src/intrusive_stack.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/intrusive_stack.h b/src/intrusive_stack.h index d7c43c24..0fc0cb61 100644 --- a/src/intrusive_stack.h +++ b/src/intrusive_stack.h @@ -117,6 +117,15 @@ namespace etl return *static_cast(p_top); } + //************************************************************************* + /// Gets a const reference to the value at the top of the stack.
+ /// \return A const reference to the value at the top of the stack. + //************************************************************************* + const_reference top() const + { + return *static_cast(p_top); + } + //************************************************************************* /// Adds a value to the stack. ///\param value The value to push to the stack. @@ -148,15 +157,6 @@ namespace etl --current_size; } - //************************************************************************* - /// Gets a const reference to the value at the top of the stack.
- /// \return A const reference to the value at the top of the stack. - //************************************************************************* - const_reference top() const - { - return *p_top; - } - //************************************************************************* /// Clears the stack to the empty state. //************************************************************************* From 020a834d62909945581c17f492982e6431917839 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 17:21:21 +0000 Subject: [PATCH 25/93] Converted to use etl:frame_check_sequence --- src/fnv_1.h | 344 +++++++++++++++------------------------------------- 1 file changed, 101 insertions(+), 243 deletions(-) diff --git a/src/fnv_1.h b/src/fnv_1.h index 5ae00dac..ce787651 100644 --- a/src/fnv_1.h +++ b/src/fnv_1.h @@ -37,6 +37,8 @@ SOFTWARE. #include "static_assert.h" #include "type_traits.h" #include "ihash.h" +#include "frame_check_sequence.h" + #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 @@ -47,22 +49,49 @@ SOFTWARE. namespace etl { + //*************************************************************************** + /// fnv_1 policy. + /// Calculates FNV1. + //*************************************************************************** + struct fnv_1_policy_64 + { + typedef uint64_t value_type; + + inline uint64_t initial() const + { + return OFFSET_BASIS; + } + + inline uint64_t add(uint64_t hash, uint8_t value) const + { + hash *= PRIME; + hash ^= value; + return hash; + } + + inline uint64_t final(uint64_t hash) const + { + return hash; + } + + static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325; + static const uint64_t PRIME = 0x00000100000001b3; + }; + //*************************************************************************** /// Calculates the fnv_1_64 hash. ///\ingroup fnv_1_64 //*************************************************************************** - class fnv_1_64 + class fnv_1_64 : public etl::frame_check_sequence { public: - typedef uint64_t value_type; - //************************************************************************* /// Default constructor. //************************************************************************* fnv_1_64() { - reset(); + this->reset(); } //************************************************************************* @@ -73,90 +102,54 @@ namespace etl template fnv_1_64(TIterator begin, const TIterator end) { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); + this->reset(); + this->add(begin, end); + } + }; + + //*************************************************************************** + /// fnv_1a policy. + /// Calculates FNV1A. + //*************************************************************************** + struct fnv_1a_policy_64 + { + typedef uint64_t value_type; - reset(); - while (begin != end) - { - hash *= PRIME; - hash ^= *begin++; - } + inline uint64_t initial() const + { + return OFFSET_BASIS; } - //************************************************************************* - /// Resets the CRC to the initial state. - //************************************************************************* - void reset() + inline uint64_t add(uint64_t hash, uint8_t value) const { - hash = OFFSET_BASIS; - } - - //************************************************************************* - /// Adds a range. - /// \param begin - /// \param end - //************************************************************************* - template - void add(TIterator begin, const TIterator end) - { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); - - while (begin != end) - { - hash *= PRIME; - hash ^= *begin++; - } - } - - //************************************************************************* - /// \param value The char to add to the fnv_1_64. - //************************************************************************* - void add(uint8_t value) - { - hash *= PRIME; hash ^= value; + hash *= PRIME; + return hash; } - //************************************************************************* - /// Gets the fnv_1_64 value. - //************************************************************************* - value_type value() const + inline uint64_t final(uint64_t hash) const { return hash; } - //************************************************************************* - /// Conversion operator to value_type. - //************************************************************************* - operator value_type () const - { - return hash; - } - - private: - - value_type hash; - static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325; static const uint64_t PRIME = 0x00000100000001b3; }; - + //*************************************************************************** /// Calculates the fnv_1a_64 hash. ///\ingroup fnv_1a_64 //*************************************************************************** - class fnv_1a_64 + class fnv_1a_64 : public etl::frame_check_sequence { public: - typedef uint64_t value_type; - //************************************************************************* /// Default constructor. //************************************************************************* fnv_1a_64() { - reset(); + this->reset(); } //************************************************************************* @@ -167,90 +160,54 @@ namespace etl template fnv_1a_64(TIterator begin, const TIterator end) { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); + this->reset(); + this->add(begin, end); + } + }; - reset(); - while (begin != end) - { - hash ^= *begin++; - hash *= PRIME; - } + //*************************************************************************** + /// fnv_1 policy. + /// Calculates FNV1. + //*************************************************************************** + struct fnv_1_policy_32 + { + typedef uint32_t value_type; + + inline uint32_t initial() const + { + return OFFSET_BASIS; } - //************************************************************************* - /// Resets the CRC to the initial state. - //************************************************************************* - void reset() + inline uint32_t add(uint32_t hash, uint8_t value) const { - hash = OFFSET_BASIS; - } - - //************************************************************************* - /// Adds a range. - /// \param begin - /// \param end - //************************************************************************* - template - void add(TIterator begin, const TIterator end) - { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); - - while (begin != end) - { - hash ^= *begin++; - hash *= PRIME; - } - } - - //************************************************************************* - /// \param value The char to add to the fnv_1a_64. - //************************************************************************* - void add(uint8_t value) - { - hash ^= value; hash *= PRIME; + hash ^= value; + return hash; } - //************************************************************************* - /// Gets the fnv_1a_64 value. - //************************************************************************* - value_type value() const + inline uint32_t final(uint32_t hash) const { return hash; } - //************************************************************************* - /// Conversion operator to value_type. - //************************************************************************* - operator value_type () const - { - return hash; - } - - private: - - value_type hash; - - static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325; - static const uint64_t PRIME = 0x00000100000001b3; + static const uint32_t OFFSET_BASIS = 0x811C9DC5; + static const uint32_t PRIME = 0x01000193; }; //*************************************************************************** /// Calculates the fnv_1_32 hash. ///\ingroup fnv_1_32 //*************************************************************************** - class fnv_1_32 + class fnv_1_32 : public etl::frame_check_sequence { public: - typedef uint32_t value_type; - //************************************************************************* /// Default constructor. //************************************************************************* fnv_1_32() { - reset(); + this->reset(); } //************************************************************************* @@ -261,70 +218,36 @@ namespace etl template fnv_1_32(TIterator begin, const TIterator end) { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); + this->reset(); + this->add(begin, end); + } + }; + + //*************************************************************************** + /// fnv_1a policy. + /// Calculates FNV1A. + //*************************************************************************** + struct fnv_1a_policy_32 + { + typedef uint32_t value_type; - reset(); - while (begin != end) - { - hash *= PRIME; - hash ^= *begin++; - } + inline uint32_t initial() const + { + return OFFSET_BASIS; } - //************************************************************************* - /// Resets the CRC to the initial state. - //************************************************************************* - void reset() + inline uint32_t add(uint32_t hash, uint8_t value) const { - hash = OFFSET_BASIS; - } - - //************************************************************************* - /// Adds a range. - /// \param begin - /// \param end - //************************************************************************* - template - void add(TIterator begin, const TIterator end) - { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); - - while (begin != end) - { - hash *= PRIME; - hash ^= *begin++; - } - } - - //************************************************************************* - /// \param value The char to add to the fnv_1_32. - //************************************************************************* - void add(uint8_t value) - { - hash *= PRIME; hash ^= value; + hash *= PRIME; + return hash; } - //************************************************************************* - /// Gets the fnv_1_32 value. - //************************************************************************* - value_type value() const + inline uint32_t final(uint32_t hash) const { return hash; } - //************************************************************************* - /// Conversion operator to value_type. - //************************************************************************* - operator value_type () const - { - return hash; - } - - private: - - value_type hash; - static const uint32_t OFFSET_BASIS = 0x811C9DC5; static const uint32_t PRIME = 0x01000193; }; @@ -333,18 +256,16 @@ namespace etl /// Calculates the fnv_1a_32 hash. ///\ingroup fnv_1a_32 //*************************************************************************** - class fnv_1a_32 + class fnv_1a_32 : public etl::frame_check_sequence { public: - typedef uint32_t value_type; - //************************************************************************* /// Default constructor. //************************************************************************* fnv_1a_32() { - reset(); + this->reset(); } //************************************************************************* @@ -355,72 +276,9 @@ namespace etl template fnv_1a_32(TIterator begin, const TIterator end) { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); - - reset(); - while (begin != end) - { - hash ^= *begin++; - hash *= PRIME; - } + this->reset(); + this->add(begin, end); } - - //************************************************************************* - /// Resets the CRC to the initial state. - //************************************************************************* - void reset() - { - hash = OFFSET_BASIS; - } - - //************************************************************************* - /// Adds a range. - /// \param begin - /// \param end - //************************************************************************* - template - void add(TIterator begin, const TIterator end) - { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Type not supported"); - - while (begin != end) - { - hash ^= *begin++; - hash *= PRIME; - } - } - - //************************************************************************* - /// \param value The char to add to the fnv_1a_32. - //************************************************************************* - void add(uint8_t value) - { - hash ^= value; - hash *= PRIME; - } - - //************************************************************************* - /// Gets the fnv_1a_32 value. - //************************************************************************* - value_type value() const - { - return hash; - } - - //************************************************************************* - /// Conversion operator to value_type. - //************************************************************************* - operator value_type () const - { - return hash; - } - - private: - - value_type hash; - - static const uint32_t OFFSET_BASIS = 0x811C9DC5; - static const uint32_t PRIME = 0x01000193; }; } From 0a8e3c8fdf370fede6d0c41a7281817454226a25 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Nov 2016 18:18:04 +0000 Subject: [PATCH 26/93] Added either support or compiler error messages when the platform does not support 8 bit data types. --- src/binary.h | 9 +++++++ src/debounce.h | 2 +- src/endian.h | 6 ++--- src/platform.h | 7 ++--- src/private/map_base.h | 10 +++---- src/private/multimap_base.h | 14 +++++----- src/private/multiset_base.h | 14 +++++----- src/private/set_base.h | 8 +++--- src/variant.h | 52 ++++++++++++++++++------------------- 9 files changed, 66 insertions(+), 56 deletions(-) diff --git a/src/binary.h b/src/binary.h index 3a1be615..fb99de13 100644 --- a/src/binary.h +++ b/src/binary.h @@ -44,6 +44,7 @@ SOFTWARE. #include "log.h" #include "power.h" #include "smallest.h" +#include "platform.h" namespace etl { @@ -170,6 +171,7 @@ namespace etl return result; } +#if ETL_8BIT_SUPPORT //*************************************************************************** /// Reverse 8 bits. //*************************************************************************** @@ -183,6 +185,7 @@ namespace etl return value; } +#endif //*************************************************************************** /// Reverse 16 bits. @@ -282,6 +285,7 @@ namespace etl return (value >> 1) ^ value; } +#if ETL_8BIT_SUPPORT //*************************************************************************** /// Converts Gray code to binary. //*************************************************************************** @@ -295,6 +299,7 @@ namespace etl return value; } +#endif //*************************************************************************** /// Converts Gray code to binary. @@ -344,6 +349,7 @@ namespace etl return value; } +#if ETL_8BIT_SUPPORT //*************************************************************************** /// Count set bits. 8 bits. //*************************************************************************** @@ -361,6 +367,7 @@ namespace etl return count; } +#endif //*************************************************************************** /// Count set bits. 16 bits. @@ -422,6 +429,7 @@ namespace etl return size_t(count); } +#if ETL_8BIT_SUPPORT //*************************************************************************** /// Parity. 8bits. 0 = even, 1 = odd //*************************************************************************** @@ -433,6 +441,7 @@ namespace etl value &= 0x0F; return (0x6996 >> value) & 1; } +#endif //*************************************************************************** /// Parity. 16bits. 0 = even, 1 = odd diff --git a/src/debounce.h b/src/debounce.h index 531b584d..729451f2 100644 --- a/src/debounce.h +++ b/src/debounce.h @@ -116,7 +116,7 @@ namespace etl REPEATING = 16 }; - uint8_t state; + uint_least8_t state; /// The state count. uint16_t count; diff --git a/src/endian.h b/src/endian.h index d905d8e1..35ad8d34 100644 --- a/src/endian.h +++ b/src/endian.h @@ -68,7 +68,7 @@ namespace etl struct endianness { endianness() - : ETL_ENDIAN_TEST(0x0011) + : ETL_ENDIAN_TEST(0x0011223344556677) { } @@ -79,12 +79,12 @@ namespace etl operator endian() const { - return (*reinterpret_cast(&ETL_ENDIAN_TEST) == 0x11) ? endian::little : endian::big; + return (*reinterpret_cast(&ETL_ENDIAN_TEST) == 0x44556677) ? endian::little : endian::big; } private: - const uint16_t ETL_ENDIAN_TEST; + const uint64_t ETL_ENDIAN_TEST; }; } diff --git a/src/platform.h b/src/platform.h index d6cb9159..d08bccc7 100644 --- a/src/platform.h +++ b/src/platform.h @@ -29,7 +29,7 @@ SOFTWARE. ******************************************************************************/ #include -#include "static_assert.h" +#include // Define the platform. // The target platform will normally be defined as a compiler pre-processor directive. @@ -68,5 +68,6 @@ SOFTWARE. #define ETL_ETL_NO_LARGE_CHAR_SUPPORT #endif -// Some targets do not support 8bit or even 16bit types. -#define ETL_8BIT_SUPPORT ((sizeof(uint_least8_t) != sizeof(uint16_t)) && (sizeof(uint_least8_t) != sizeof(uint32_t))) +// Some targets do not support 8bit types. +#define ETL_8BIT_SUPPORT (CHAR_BIT == 8) + diff --git a/src/private/map_base.h b/src/private/map_base.h index 539554a1..f23de8da 100644 --- a/src/private/map_base.h +++ b/src/private/map_base.h @@ -194,9 +194,9 @@ namespace etl children[1] = nullptr; } - Node* children[2]; - uint8_t weight; - uint8_t dir; + Node* children[2]; + uint_least8_t weight; + uint_least8_t dir; }; //************************************************************************* @@ -276,7 +276,7 @@ namespace etl //************************************************************************* /// Rotate two nodes at the position provided the to balance the tree //************************************************************************* - void rotate_2node(Node*& position, uint8_t dir) + void rotate_2node(Node*& position, uint_least8_t dir) { // A C A B // B C -> A E OR B C -> D A @@ -306,7 +306,7 @@ namespace etl //************************************************************************* /// Rotate three nodes at the position provided the to balance the tree //************************************************************************* - void rotate_3node(Node*& position, uint8_t dir, uint8_t third) + void rotate_3node(Node*& position, uint_least8_t dir, uint_least8_t third) { // __A__ __E__ __A__ __D__ // _B_ C -> B A OR B _C_ -> A C diff --git a/src/private/multimap_base.h b/src/private/multimap_base.h index 02b85f94..39afb67c 100644 --- a/src/private/multimap_base.h +++ b/src/private/multimap_base.h @@ -162,9 +162,9 @@ namespace etl protected: - static const uint8_t kLeft = 0; - static const uint8_t kRight = 1; - static const uint8_t kNeither = 2; + static const uint_least8_t kLeft = 0; + static const uint_least8_t kRight = 1; + static const uint_least8_t kNeither = 2; //************************************************************************* /// The node element in the multimap. @@ -194,8 +194,8 @@ namespace etl Node* parent; Node* children[2]; - uint8_t weight; - uint8_t dir; + uint_least8_t weight; + uint_least8_t dir; }; //************************************************************************* @@ -275,7 +275,7 @@ namespace etl //************************************************************************* /// Rotate two nodes at the position provided the to balance the tree //************************************************************************* - void rotate_2node(Node*& position, uint8_t dir) + void rotate_2node(Node*& position, uint_least8_t dir) { // A C A B // B C -> A E OR B C -> D A @@ -316,7 +316,7 @@ namespace etl //************************************************************************* /// Rotate three nodes at the position provided the to balance the tree //************************************************************************* - void rotate_3node(Node*& position, uint8_t dir, uint8_t third) + void rotate_3node(Node*& position, uint_least8_t dir, uint_least8_t third) { // __A__ __E__ __A__ __D__ // _B_ C -> B A OR B _C_ -> A C diff --git a/src/private/multiset_base.h b/src/private/multiset_base.h index 5b9a1d36..cad7120c 100644 --- a/src/private/multiset_base.h +++ b/src/private/multiset_base.h @@ -162,9 +162,9 @@ namespace etl protected: - static const uint8_t kLeft = 0; - static const uint8_t kRight = 1; - static const uint8_t kNeither = 2; + static const uint_least8_t kLeft = 0; + static const uint_least8_t kRight = 1; + static const uint_least8_t kNeither = 2; //************************************************************************* /// The node element in the multiset. @@ -194,8 +194,8 @@ namespace etl Node* parent; Node* children[2]; - uint8_t weight; - uint8_t dir; + uint_least8_t weight; + uint_least8_t dir; }; //************************************************************************* @@ -482,7 +482,7 @@ namespace etl //************************************************************************* /// Rotate two nodes at the position provided the to balance the tree //************************************************************************* - void rotate_2node(Node*& position, uint8_t dir) + void rotate_2node(Node*& position, uint_least8_t dir) { // A C A B // B C -> A E OR B C -> D A @@ -523,7 +523,7 @@ namespace etl //************************************************************************* /// Rotate three nodes at the position provided the to balance the tree //************************************************************************* - void rotate_3node(Node*& position, uint8_t dir, uint8_t third) + void rotate_3node(Node*& position, uint_least8_t dir, uint_least8_t third) { // __A__ __E__ __A__ __D__ // _B_ C -> B A OR B _C_ -> A C diff --git a/src/private/set_base.h b/src/private/set_base.h index 32a72c2f..b0b85b45 100644 --- a/src/private/set_base.h +++ b/src/private/set_base.h @@ -194,8 +194,8 @@ namespace etl } Node* children[2]; - uint8_t weight; - uint8_t dir; + uint_least8_t weight; + uint_least8_t dir; }; //************************************************************************* @@ -348,7 +348,7 @@ namespace etl //************************************************************************* /// Rotate two nodes at the position provided the to balance the tree //************************************************************************* - void rotate_2node(Node*& position, uint8_t dir) + void rotate_2node(Node*& position, uint_least8_t dir) { // A C A B // B C -> A E OR B C -> D A @@ -378,7 +378,7 @@ namespace etl //************************************************************************* /// Rotate three nodes at the position provided the to balance the tree //************************************************************************* - void rotate_3node(Node*& position, uint8_t dir, uint8_t third) + void rotate_3node(Node*& position, uint_least8_t dir, uint_least8_t third) { // __A__ __E__ __A__ __D__ // _B_ C -> B A OR B _C_ -> A C diff --git a/src/variant.h b/src/variant.h index 38492c4f..c57465b9 100644 --- a/src/variant.h +++ b/src/variant.h @@ -132,7 +132,7 @@ namespace etl //*************************************************************************** /// The type used for ids. //*************************************************************************** - typedef uint8_t type_id_t; + typedef uint_least8_t type_id_t; //*************************************************************************** /// The id a unsupported types. @@ -196,15 +196,15 @@ namespace etl template struct Type_Id_Lookup { - static const uint8_t type_id = etl::is_same::value ? 0 : - etl::is_same::value ? 1 : - etl::is_same::value ? 2 : - etl::is_same::value ? 3 : - etl::is_same::value ? 4 : - etl::is_same::value ? 5 : - etl::is_same::value ? 6 : - etl::is_same::value ? 7 : - UNSUPPORTED_TYPE_ID; + static const uint_least8_t type_id = etl::is_same::value ? 0 : + etl::is_same::value ? 1 : + etl::is_same::value ? 2 : + etl::is_same::value ? 3 : + etl::is_same::value ? 4 : + etl::is_same::value ? 5 : + etl::is_same::value ? 6 : + etl::is_same::value ? 7 : + UNSUPPORTED_TYPE_ID; }; //*************************************************************************** @@ -424,7 +424,7 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { switch (typeId) { @@ -440,7 +440,7 @@ namespace etl } } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { switch (typeId) { @@ -465,7 +465,7 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { switch (typeId) { @@ -480,7 +480,7 @@ namespace etl } } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { switch (typeId) { @@ -504,7 +504,7 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { switch (typeId) { @@ -518,7 +518,7 @@ namespace etl } } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { switch (typeId) { @@ -541,7 +541,7 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { switch (typeId) { @@ -554,7 +554,7 @@ namespace etl } } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { switch (typeId) { @@ -576,7 +576,7 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { switch (typeId) { @@ -588,7 +588,7 @@ namespace etl } } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { switch (typeId) { @@ -609,7 +609,7 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { switch (typeId) { @@ -620,7 +620,7 @@ namespace etl } } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { switch (typeId) { @@ -640,7 +640,7 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { switch (typeId) { @@ -650,7 +650,7 @@ namespace etl } } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { switch (typeId) { @@ -669,12 +669,12 @@ namespace etl { public: - TBase& operator()(uint8_t* p_data, uint8_t typeId) + TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) { return reinterpret_cast(*p_data); } - const TBase& operator()(uint8_t* p_data, uint8_t typeId) const + const TBase& operator()(uint_least8_t* p_data, uint_least8_t typeId) const { return reinterpret_cast(*p_data); } From 562d59faf02895918575bb613a1fee352a015c13 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Mon, 14 Nov 2016 16:45:01 +0000 Subject: [PATCH 27/93] Initial callback template class. Untested. --- src/callback.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/callback.h diff --git a/src/callback.h b/src/callback.h new file mode 100644 index 00000000..1fccd5c6 --- /dev/null +++ b/src/callback.h @@ -0,0 +1,74 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2015 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_CALLBACK__ +#define __ETL_CALLBACK__ + +namespace etl +{ + template + class callback + { + private: + + // Creates a parameter type unique to this ID. + template + struct parameter + { + parameter(T value) + : value(value) + { + } + + typedef T value_type; + + T value; + + private: + + parameter(); + }; + + // Specialisation for void. + template + struct parameter + { + typedef void value_type; + }; + + public: + + typedef parameter type; + + virtual void etl_callback(type p = type()) = 0; + }; +} + +#endif \ No newline at end of file From 670de34441e9e987b1e7af43ccaf0c5a70757dae Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Mon, 14 Nov 2016 16:45:26 +0000 Subject: [PATCH 28/93] Initial callback template class. Untested. --- src/callback.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/callback.h b/src/callback.h index 1fccd5c6..73f4fdb1 100644 --- a/src/callback.h +++ b/src/callback.h @@ -28,6 +28,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ +#error In Development. Do not use. + #ifndef __ETL_CALLBACK__ #define __ETL_CALLBACK__ From e5e3a6a4fce57387edbdbc841afa4161321dca7f Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Mon, 14 Nov 2016 16:54:05 +0000 Subject: [PATCH 29/93] Added more comments --- src/callback.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/callback.h b/src/callback.h index 73f4fdb1..0111c492 100644 --- a/src/callback.h +++ b/src/callback.h @@ -35,6 +35,13 @@ SOFTWARE. namespace etl { + //*************************************************************************** + /// A callback class designed to be multiply inherited by other client classes. + /// The class is parameterised with a callback parameter type and a unique id. + /// The unique id allows muliple callbacks with the same parameter type. + ///\tparam TParameter The callback parameter type. + ///\tparam ID The unique id for this callback. + //*************************************************************************** template class callback { From 1171d7e5556acc4508dc7513b4656b18b5d0df13 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 16 Nov 2016 13:04:04 +0000 Subject: [PATCH 30/93] Modified Jenkins hash to use frame_check_sequence classes. --- src/jenkins.h | 191 +++++++++++++++++++++++++++----------------------- 1 file changed, 105 insertions(+), 86 deletions(-) diff --git a/src/jenkins.h b/src/jenkins.h index 7dace164..0c500e3c 100644 --- a/src/jenkins.h +++ b/src/jenkins.h @@ -50,24 +50,96 @@ SOFTWARE. namespace etl { //*************************************************************************** - /// Calculates the jenkins hash. - ///\ingroup jenkins + /// Jenkins32 policy. + /// Calculates 32 bit Jenkins hash. //*************************************************************************** - template - class jenkins + struct jenkins32_policy + { + typedef uint32_t value_type; + + inline uint32_t initial() const + { + is_finalised = false; + + return 0; + } + + inline uint32_t add(uint8_t hash, uint8_t value) const + { + ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); + + hash += value; + hash += (hash << 10); + hash ^= (hash >> 6); + + return hash; + } + + inline uint32_t final(uint8_t hash) const + { + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + is_finalised = true; + + return hash; + } + + bool is_finalised; + }; + + //*************************************************************************** + /// Jenkins64 policy. + /// Calculates 32 bit Jenkins hash. + //*************************************************************************** + struct jenkins64_policy + { + typedef uint64_t value_type; + + inline uint64_t initial() const + { + is_finalised = false; + + return 0; + } + + inline uint64_t add(uint8_t hash, uint8_t value) const + { + ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); + + hash += value; + hash += (hash << 10); + hash ^= (hash >> 6); + + return hash; + } + + inline uint64_t final(uint8_t hash) const + { + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + is_finalised = true; + + return hash; + } + + bool is_finalised; + }; + + //************************************************************************* + /// Jenkins32 + //************************************************************************* + class jenkins32 : public etl::frame_check_sequence { public: - STATIC_ASSERT((etl::is_same::value || etl::is_same::value), "Only 32 & 64 bit types supported"); - - typedef THash value_type; - //************************************************************************* /// Default constructor. //************************************************************************* - jenkins() + jenkins32() { - reset(); + this->reset(); } //************************************************************************* @@ -76,92 +148,39 @@ namespace etl /// \param end End of the range. //************************************************************************* template - jenkins(TIterator begin, const TIterator end) + jenkins32(TIterator begin, const TIterator end) { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Incompatible type"); + this->reset(); + this->add(begin, end); + } + }; - reset(); + //************************************************************************* + /// Jenkins64 + //************************************************************************* + class jenkins64 : public etl::frame_check_sequence + { + public: - while (begin != end) - { - hash += *begin++; - hash += (hash << 10); - hash ^= (hash >> 6); - } + //************************************************************************* + /// Default constructor. + //************************************************************************* + jenkins64() + { + this->reset(); } //************************************************************************* - /// Resets the CRC to the initial state. - //************************************************************************* - void reset() - { - hash = 0; - is_finalised = false; - } - - //************************************************************************* - /// Adds a range. - /// \param begin - /// \param end + /// Constructor from range. + /// \param begin Start of the range. + /// \param end End of the range. //************************************************************************* template - void add(TIterator begin, const TIterator end) + jenkins64(TIterator begin, const TIterator end) { - STATIC_ASSERT(sizeof(typename std::iterator_traits::value_type) == 1, "Incompatible type"); - ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); - - while (begin != end) - { - hash += *begin++; - hash += (hash << 10); - hash ^= (hash >> 6); - } + this->reset(); + this->add(begin, end); } - - //************************************************************************* - /// \param value The char to add to the jenkins. - //************************************************************************* - void add(uint8_t value) - { - ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); - - hash += value; - hash += (hash << 10); - hash ^= (hash >> 6); - } - - //************************************************************************* - /// Gets the jenkins value. - //************************************************************************* - value_type value() - { - finalise(); - return hash; - } - - //************************************************************************* - /// Conversion operator to value_type. - //************************************************************************* - operator value_type () - { - return value(); - } - - private: - - void finalise() - { - if (!is_finalised) - { - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - is_finalised = true; - } - } - - value_type hash; - bool is_finalised; }; } From ae2e4609b22ea1ba31ced8f3bde6481b78301861 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 16 Nov 2016 13:06:16 +0000 Subject: [PATCH 31/93] Added hash functions for strings. --- src/string.h | 17 +++++++++++++++++ src/u16string.h | 17 +++++++++++++++++ src/u32string.h | 17 +++++++++++++++++ src/wstring.h | 17 +++++++++++++++++ 4 files changed, 68 insertions(+) diff --git a/src/string.h b/src/string.h index 3f5bfb80..055c1fc9 100644 --- a/src/string.h +++ b/src/string.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -180,6 +181,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for string. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const string& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT) diff --git a/src/u16string.h b/src/u16string.h index a7ca2b57..138fa916 100644 --- a/src/u16string.h +++ b/src/u16string.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -180,6 +181,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for u16string. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const u16string& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT) diff --git a/src/u32string.h b/src/u32string.h index 5890f1c7..8280fbba 100644 --- a/src/u32string.h +++ b/src/u32string.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -180,6 +181,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for u32string. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const u32string& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT) diff --git a/src/wstring.h b/src/wstring.h index 8019a29f..94bebc6b 100644 --- a/src/wstring.h +++ b/src/wstring.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -181,6 +182,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for wstring. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const wstring& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT) From ad0e3c4f8d9d94c6dc79ff12256854b296c0baab Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 16 Nov 2016 14:04:19 +0000 Subject: [PATCH 32/93] Added +-*/ operators. Added bool conversion operator. Added ! operator. get() returns const reference. --- src/type_def.h | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/type_def.h b/src/type_def.h index 66d6156e..707a0732 100644 --- a/src/type_def.h +++ b/src/type_def.h @@ -40,11 +40,11 @@ namespace etl /// Usage: ///\code /// // Short form. - /// ETL_TYPEDEF(int, mytype); + /// ETL_TYPEDEF(int, mytype_t); /// /// // Long form. /// class mytype_t_tag; - /// typedef etl::type_def mytype_t_tag; + /// typedef etl::type_def mytype_t; ///\endcode //************************************************************************* template @@ -79,6 +79,18 @@ namespace etl return value; } + //********************************************************************* + explicit operator bool() const + { + return static_cast(value); + } + + //********************************************************************* + bool operator !() const + { + return !bool(value); + } + //********************************************************************* type_def& operator ++() { @@ -243,11 +255,35 @@ namespace etl } //********************************************************************* - TValue get() const + const TValue& get() const { return value; } + //********************************************************************* + friend type_def operator +(const type_def& lhs, const type_def& rhs) + { + return type_def(lhs.value + rhs.value); + } + + //********************************************************************* + friend type_def operator -(const type_def& lhs, const type_def& rhs) + { + return type_def(lhs.value - rhs.value); + } + + //********************************************************************* + friend type_def operator *(const type_def& lhs, const type_def& rhs) + { + return type_def(lhs.value * rhs.value); + } + + //********************************************************************* + friend type_def operator /(const type_def& lhs, const type_def& rhs) + { + return type_def(lhs.value / rhs.value); + } + //********************************************************************* friend bool operator <(const type_def& lhs, const type_def& rhs) { From 98b0c888eab94469d3a8f0d55223c7f54c872aa4 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Thu, 8 Dec 2016 10:47:30 +0000 Subject: [PATCH 33/93] Possible fix for 'strict aliasing' warnings. --- src/hash.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/hash.h b/src/hash.h index 3d02ab9b..a89aa9b4 100644 --- a/src/hash.h +++ b/src/hash.h @@ -32,6 +32,7 @@ SOFTWARE. #define __ETL_HASH__ #include +#include // The default hash calculation. #include "fnv_1.h" @@ -322,7 +323,9 @@ namespace etl { if (sizeof(size_t) == sizeof(v)) { - return *reinterpret_cast(&v); + size_t t; + memcpy(&t, &v, sizeof(size_t)); + return t; } else { @@ -344,7 +347,9 @@ namespace etl { if (sizeof(size_t) == sizeof(v)) { - return *reinterpret_cast(&v); + size_t t; + memcpy(&t, &v, sizeof(size_t)); + return t; } else { @@ -366,7 +371,9 @@ namespace etl { if (sizeof(size_t) == sizeof(v)) { - return *reinterpret_cast(&v); + size_t t; + memcpy(&t, &v, sizeof(size_t)); + return t; } else { @@ -387,7 +394,9 @@ namespace etl { if (sizeof(size_t) == sizeof(T*)) { - return reinterpret_cast(v); + size_t t; + memcpy(&t, &v, sizeof(size_t)); + return t; } else { From caf6cbf2737fd6ac33735293ec197cf29b04a189 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Thu, 8 Dec 2016 11:22:44 +0000 Subject: [PATCH 34/93] Possible fix for 'strict aliasing' warnings. --- src/hash.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/hash.h b/src/hash.h index a89aa9b4..2a3f8ddc 100644 --- a/src/hash.h +++ b/src/hash.h @@ -230,9 +230,9 @@ namespace etl template<> struct hash { - // If it fits into a size_t. size_t operator ()(long v) const { + // If it's the same size as a size_t. if (sizeof(size_t) >= sizeof(v)) { return static_cast(v); @@ -252,9 +252,9 @@ namespace etl template<> struct hash { - // If it fits into a size_t. size_t operator ()(long long v) const { + // If it's the same size as a size_t. if (sizeof(size_t) >= sizeof(v)) { return static_cast(v); @@ -274,9 +274,9 @@ namespace etl template<> struct hash { - // If it fits into a size_t. size_t operator ()(unsigned long v) const { + // If it's the same size as a size_t. if (sizeof(size_t) >= sizeof(v)) { return static_cast(v); @@ -296,9 +296,9 @@ namespace etl template<> struct hash { - // If it fits into a size_t. size_t operator ()(unsigned long long v) const { + // If it's the same size as a size_t. if (sizeof(size_t) >= sizeof(v)) { return static_cast(v); @@ -318,9 +318,9 @@ namespace etl template<> struct hash { - // If it's the same size as a size_t. size_t operator ()(float v) const { + // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(v)) { size_t t; @@ -342,9 +342,9 @@ namespace etl template<> struct hash { - // If it's the same size as a size_t. size_t operator ()(double v) const { + // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(v)) { size_t t; @@ -366,9 +366,9 @@ namespace etl template<> struct hash { - // If it's the same size as a size_t. size_t operator ()(long double v) const { + // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(v)) { size_t t; @@ -392,6 +392,7 @@ namespace etl { size_t operator ()(const T* v) const { + // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(T*)) { size_t t; From f2ec22e8f404f362928000c22a4e68932a0e2e03 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Thu, 8 Dec 2016 11:23:01 +0000 Subject: [PATCH 35/93] Fix 'shadow' warning. --- src/function.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/function.h b/src/function.h index caf7b4c9..6e1053da 100644 --- a/src/function.h +++ b/src/function.h @@ -200,8 +200,8 @@ namespace etl /// Constructor. ///\param p_function Pointer to the function. //************************************************************************* - function(void(*p_function)(void)) - : p_function(p_function) + function(void(*p_function_)(void)) + : p_function(p_function_) { } From 1aa6b33d067f24337dc46186c8931ba8c569c4d0 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Mon, 12 Dec 2016 10:42:56 +0000 Subject: [PATCH 36/93] Fixed unused parameter warning. --- src/exception.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/exception.h b/src/exception.h index 52369caa..3b39f1e9 100644 --- a/src/exception.h +++ b/src/exception.h @@ -35,7 +35,7 @@ SOFTWARE. /// The base class for all ETL exceptions. ///\ingroup utilities -namespace etl +namespace etl { //*************************************************************************** ///\ingroup exception @@ -66,6 +66,7 @@ namespace etl : reason(reason), line(line) { + (void)file; } #endif From db375602d43d1db3d370c3203167b9e3feedf122 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Mon, 12 Dec 2016 10:54:30 +0000 Subject: [PATCH 37/93] Added destructor to release all remaining items in the pool. --- src/ipool.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ipool.h b/src/ipool.h index 34c4e7d2..ad3c16d1 100644 --- a/src/ipool.h +++ b/src/ipool.h @@ -46,7 +46,7 @@ namespace etl //*************************************************************************** template class ipool : public pool_base - { + { public: typedef T value_type; @@ -358,7 +358,7 @@ namespace etl return result; } - + //************************************************************************* /// Release an object in the pool. /// If asserts or exceptions are enabled and the object does not belong to this @@ -505,6 +505,14 @@ namespace etl { } + //************************************************************************* + /// Destructor + //************************************************************************* + ~ipool() + { + release_all(); + } + private: // Disable copy construction and assignment. From 0bd7da7aaee32566e865de43c23c56acfed9c3e2 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Mon, 12 Dec 2016 11:01:53 +0000 Subject: [PATCH 38/93] Added destructor to release all remaining items in the vector. --- src/vector.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vector.h b/src/vector.h index 86a4998e..06c45d89 100644 --- a/src/vector.h +++ b/src/vector.h @@ -115,6 +115,14 @@ namespace etl ivector::assign(other.begin(), other.end()); } + //************************************************************************* + /// Destructor. + //************************************************************************* + ~vector() + { + ivector::clear(); + } + //************************************************************************* /// Assignment operator. //************************************************************************* From ada67f1bebfab08373af952a5dd84dd4502b2b61 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Mon, 12 Dec 2016 11:07:37 +0000 Subject: [PATCH 39/93] Added destructor to release current item. --- src/variant.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/variant.h b/src/variant.h index c57465b9..613c3c61 100644 --- a/src/variant.h +++ b/src/variant.h @@ -717,6 +717,14 @@ namespace etl { } + //*************************************************************************** + /// Destructor. + //*************************************************************************** + ~variant() + { + destruct_current(); + } + //*************************************************************************** /// Assignment operator for T1 type. ///\param value The value to assign. From 28cd028b5e3a5fba4eb567556953fa5c8159a942 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Tue, 13 Dec 2016 09:35:32 +0000 Subject: [PATCH 40/93] Updated macros. Added compilers to list. --- src/platform.h | 50 +++++++++++++++++++++++++++++---------------- src/static_assert.h | 17 ++++++++------- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/platform.h b/src/platform.h index d08bccc7..a8e5e544 100644 --- a/src/platform.h +++ b/src/platform.h @@ -31,31 +31,39 @@ SOFTWARE. #include #include -// Define the platform. -// The target platform will normally be defined as a compiler pre-processor directive. -// Defines ETL_PLATFORM_GENERIC if a recognised platform is not declared. -#if !defined(ETL_PLATFORM_LINUX) && !defined(ETL_PLATFORM_WINDOWS) && !defined(ETL_PLATFORM_WINDOWS_CE) && !defined(ETL_PLATFORM_VXWORKS) && !defined(ETL_PLATFORM_QNX) -#pragma message("ETL: Using generic platform") -#define ETL_PLATFORM_GENERIC -#endif - // Define the compiler. #if defined(__IAR_SYSTEMS_ICC__) -#define ETL_COMPILER_IAR + #define ETL_COMPILER_IAR #elif defined(__KEIL__) && !defined(__GNUC__) -#define ETL_COMPILER_KEIL + #define ETL_COMPILER_KEIL #elif defined(__ghs__) -#define ETL_COMPILER_GREEN_HILLS + #define ETL_COMPILER_GREEN_HILLS #elif defined(__INTEL_COMPILER) -#define ETL_COMPILER_INTEL + #define ETL_COMPILER_INTEL #elif defined(_MSC_VER) -#define ETL_COMPILER_MICROSOFT + #define ETL_COMPILER_MICROSOFT #elif defined(__GNUC__) -#define ETL_COMPILER_GCC + #define ETL_COMPILER_GCC #elif defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) -#define ETL_COMPILER_TI_MSP430 + #define ETL_COMPILER_TI_MSP430 +#elif defined(_MRI) + #define ETL_COMPILER_MICROTEC +#elif defined(__HIGHC__) + #define ETL_COMPILER_METAWARE_HIGH +#elif defined(__llvm__) + #define ETL_COMPILER_LLVM +#elif defined(__KCC_VERSION) + #define ETL_COMPILER_KAI +#elif defined(_COMO__) + #define ETL_COMPILER_COMEAU +#elif defined(__BORLANDC__) + #define ETL_COMPILER_BORLAND +#elif defined(__CC_ARM) + #define ETL_COMPILER_ARM +#elif defined(__MRC__) + #define ETL_COMPILER_MPW #else -#define ETL_COMPILER_GENERIC + #define ETL_COMPILER_GENERIC #endif // Check to see if the compiler supports nullptr and large character types. @@ -64,8 +72,14 @@ SOFTWARE. defined(ETL_COMPILER_TI_MSP430) || \ defined(ETL_COMPILER_IAR) || \ (defined(ETL_COMPILER_GCC) && (__cplusplus < 201103L)) -#define ETL_ETL_NO_NULLPTR_SUPPORT -#define ETL_ETL_NO_LARGE_CHAR_SUPPORT + #define ETL_ETL_NO_NULLPTR_SUPPORT + #define ETL_ETL_NO_LARGE_CHAR_SUPPORT +#endif + +// Check to see if the compiler supports static_assert. +#if (defined(ETL_COMPILER_MICROSOFT) && (_MSC_VER >= 1600) || \ + (defined(ETL_COMPILER_GCC) && (__cplusplus >= 201103L)) +#define ETL_STATIC_ASSERT_SUPPORTED #endif // Some targets do not support 8bit types. diff --git a/src/static_assert.h b/src/static_assert.h index 575b9c2b..ced509aa 100644 --- a/src/static_assert.h +++ b/src/static_assert.h @@ -31,9 +31,7 @@ SOFTWARE. #include "platform.h" -#if defined(ETL_COMPILER_MICROSOFT) - #define STATIC_ASSERT(Condition, Message) static_assert(Condition, Message) -#elif defined(ETL_COMPILER_GCC) +#if defined(ETL_STATIC_ASSERT_SUPPORTED) #define STATIC_ASSERT(Condition, Message) static_assert(Condition, Message) #else template @@ -42,12 +40,13 @@ SOFTWARE. template <> struct STATIC_ASSERT_FAILED {}; - #define ETL_FCAT(a,b) a##b - #define ETL_ACAT(a,b) ETL_FCAT(a,b) - #define STATIC_ASSERT(cond,msg) \ - enum \ - { ETL_ACAT(dummy,__LINE__)=sizeof(STATIC_ASSERT_FAILED<(bool)(cond)>) \ - } + #define ETL_SA1(a,b) a##b + #define ETL_SA2(a,b) ETL_SA1(a,b) + #define STATIC_ASSERT(Condition, Message) \ + enum \ + { \ + ETL_SA2(dummy, __LINE__) = sizeof(STATIC_ASSERT_FAILED<(bool)(Condition)>) \ + } #endif #endif From 195b34f77532d1df1f9d6e6ba18ae7cc786b715a Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Tue, 13 Dec 2016 09:36:23 +0000 Subject: [PATCH 41/93] Fixed compile errors. --- src/jenkins.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/jenkins.h b/src/jenkins.h index 0c500e3c..3cffc790 100644 --- a/src/jenkins.h +++ b/src/jenkins.h @@ -39,9 +39,10 @@ SOFTWARE. #include "type_traits.h" #include "error_handler.h" #include "ihash.h" +#include "frame_check_sequence.h" #if defined(ETL_COMPILER_KEIL) -#pragma diag_suppress 1300 +#pragma diag_suppress 1300 #endif ///\defgroup jenkins Jenkins 32 & 64 bit hash calculations @@ -57,7 +58,7 @@ namespace etl { typedef uint32_t value_type; - inline uint32_t initial() const + inline uint32_t initial() { is_finalised = false; @@ -75,7 +76,7 @@ namespace etl return hash; } - inline uint32_t final(uint8_t hash) const + inline uint32_t final(uint8_t hash) { hash += (hash << 3); hash ^= (hash >> 11); @@ -96,7 +97,7 @@ namespace etl { typedef uint64_t value_type; - inline uint64_t initial() const + inline uint64_t initial() { is_finalised = false; @@ -114,7 +115,7 @@ namespace etl return hash; } - inline uint64_t final(uint8_t hash) const + inline uint64_t final(uint8_t hash) { hash += (hash << 3); hash ^= (hash >> 11); From 315e4c4d4fb66f78924d46b8f6330e3fb580d128 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Tue, 13 Dec 2016 09:37:06 +0000 Subject: [PATCH 42/93] Removed const from value funtions. --- src/frame_check_sequence.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frame_check_sequence.h b/src/frame_check_sequence.h index 8d30941f..0a1aabc7 100644 --- a/src/frame_check_sequence.h +++ b/src/frame_check_sequence.h @@ -53,9 +53,9 @@ namespace etl typedef TPolicy policy_type; typedef typename policy_type::value_type value_type; - + STATIC_ASSERT(etl::is_unsigned::value, "Signed frame check type not supported"); - + //************************************************************************* /// Default constructor. //************************************************************************* @@ -113,7 +113,7 @@ namespace etl //************************************************************************* /// Gets the FCS value. //************************************************************************* - value_type value() const + value_type value() { return policy.final(frame_check); } @@ -121,7 +121,7 @@ namespace etl //************************************************************************* /// Conversion operator to value_type. //************************************************************************* - operator value_type () const + operator value_type () { return policy.final(frame_check); } From 98a09ca07cc6e8341a8900addec210c896acde97 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Tue, 13 Dec 2016 09:46:03 +0000 Subject: [PATCH 43/93] Missing closing ) --- src/platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform.h b/src/platform.h index a8e5e544..cfbb4eed 100644 --- a/src/platform.h +++ b/src/platform.h @@ -77,7 +77,7 @@ SOFTWARE. #endif // Check to see if the compiler supports static_assert. -#if (defined(ETL_COMPILER_MICROSOFT) && (_MSC_VER >= 1600) || \ +#if (defined(ETL_COMPILER_MICROSOFT) && (_MSC_VER >= 1600)) || \ (defined(ETL_COMPILER_GCC) && (__cplusplus >= 201103L)) #define ETL_STATIC_ASSERT_SUPPORTED #endif From 9f9791b9c1cacaf0004e77046e61b792d74c99db Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 14 Dec 2016 11:25:33 +0000 Subject: [PATCH 44/93] Initial code for intrusive_queue. --- src/intrusive_queue.h | 256 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 src/intrusive_queue.h diff --git a/src/intrusive_queue.h b/src/intrusive_queue.h new file mode 100644 index 00000000..6889d784 --- /dev/null +++ b/src/intrusive_queue.h @@ -0,0 +1,256 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_INTRUSIVE_QUEUE__ +#define __ETL_INTRUSIVE_QUEUE__ + +#error In Development. Do not use. + +#include + +#include "type_traits.h" +#include "error_handler.h" +#include "intrusive_links.h" +#include "private/counter_type.h" + +namespace etl +{ + //*************************************************************************** + /// Exception base for intrusive queue + ///\ingroup intrusive_queue + //*************************************************************************** + class intrusive_queue_exception : public etl::exception + { + public: + + intrusive_queue_exception(string_type what, string_type file_name, numeric_type line_number) + : exception(what, file_name, line_number) + { + } + }; + + //*************************************************************************** + /// intrusive_queue empty exception. + ///\ingroup intrusive_queue + //*************************************************************************** + class intrusive_queue_empty : public intrusive_queue_exception + { + public: + + intrusive_queue_empty(string_type file_name, numeric_type line_number) + : intrusive_queue_exception(ETL_ERROR_TEXT("intrusive_queue:empty", ETL_FILE"A"), file_name, line_number) + { + } + }; + + //*************************************************************************** + ///\ingroup queue + /// An intrusive queue. Stores elements derived from etl::forward_link + /// \warning This queue cannot be used for concurrent access from multiple threads. + /// \tparam TValue The type of value that the queue holds. + /// \tparam TLink The link type that the value is derived from. + //*************************************************************************** + template + class intrusive_queue + { + public: + + // Node typedef. + typedef TLink link_type; + + // STL style typedefs. + typedef TValue value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + + enum + { + // The count option is based on the type of link. + COUNT_OPTION = ((TLink::OPTION == etl::link_option::AUTO) || (TLink::OPTION == etl::link_option::CHECKED)) ? + etl::count_option::SLOW_COUNT : + etl::count_option::FAST_COUNT + }; + + //************************************************************************* + /// Constructor + //************************************************************************* + intrusive_queue() + : p_front(nullptr), + p_back(nullptr) + { + } + + //************************************************************************* + /// Gets a reference to the value at the front of the queue. + /// Undefined behaviour if the queue is empty. + /// \return A reference to the value at the front of the queue. + //************************************************************************* + reference front() + { + return *static_cast(p_front); + } + + //************************************************************************* + /// Gets a reference to the value at the back of the queue. + /// Undefined behaviour if the queue is empty. + /// \return A reference to the value at the back of the queue. + //************************************************************************* + reference back() + { + return *static_cast(p_back); + } + + //************************************************************************* + /// Gets a const reference to the value at the front of the queue. + /// Undefined behaviour if the queue is empty. + /// \return A const reference to the value at the front of the queue. + //************************************************************************* + const_reference front() const + { + return *static_cast(p_front); + } + + //************************************************************************* + /// Gets a reference to the value at the back of the queue. + /// Undefined behaviour if the queue is empty. + /// \return A reference to the value at the back of the queue. + //************************************************************************* + const_reference back() const + { + return *static_cast(p_back); + } + + //************************************************************************* + /// Adds a value to the queue. + ///\param value The value to push to the queue. + //************************************************************************* + void push(link_type& value) + { + if (p_back != nullptr) + { + etl::link(p_front, value); + } + else + { + p_front = &value; + } + + p_back = &value; + + ++current_size; + } + + //************************************************************************* + /// Removes the oldest item from the queue. + /// Undefined behaviour if the queue is already empty. + //************************************************************************* + void pop() + { +#if defined(ETL_CHECK_PUSH_POP) + ETL_ASSERT(!empty(), ETL_ERROR(intrusive_queue_empty)); +#endif + link_type* p_next = p_front->etl_next; + p_front->clear(); + p_front = p_next; + + // Now empty? + if (p_front == nullptr) + { + p_back == nullptr; + } + + --current_size; + } + + //************************************************************************* + /// Clears the queue to the empty state. + //************************************************************************* + void clear() + { + while (!empty()) + { + pop(); + } + current_size = 0; + } + + //************************************************************************* + /// Checks if the queue is in the empty state. + //************************************************************************* + bool empty() const + { + return p_front == nullptr; + } + + //************************************************************************* + /// Returns the number of elements. + //************************************************************************* + size_t size() const + { + if (COUNT_OPTION == etl::count_option::SLOW_COUNT) + { + size_t count = 0; + + if (p_front != nullptr) + { + link_type* p_link = p_front; + + while (p_link != nullptr) + { + ++count; + p_link = p_link->etl_next; + } + } + + return count; + } + else + { + return current_size.get_count(); + } + } + + private: + + // Disable copy construction and assignment. + intrusive_queue(const intrusive_queue&); + intrusive_queue& operator = (const intrusive_queue& rhs); + + link_type* p_front; // The current front of the queue. + link_type* p_back; // The current back of the queue. + + etl::counter_type current_size; ///< Counts the number of elements in the list. + }; +} + +#endif From 2cb60e43a4456c9df97facbd2cb81e385e2b0775 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 14 Dec 2016 12:53:51 +0000 Subject: [PATCH 45/93] Added ETL_FILE defines. --- src/intrusive_queue.h | 4 ++++ src/intrusive_stack.h | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/intrusive_queue.h b/src/intrusive_queue.h index 6889d784..69a530d9 100644 --- a/src/intrusive_queue.h +++ b/src/intrusive_queue.h @@ -40,6 +40,8 @@ SOFTWARE. #include "intrusive_links.h" #include "private/counter_type.h" +#define ETL_FILE "29" + namespace etl { //*************************************************************************** @@ -253,4 +255,6 @@ namespace etl }; } +#undef ETL_FILE + #endif diff --git a/src/intrusive_stack.h b/src/intrusive_stack.h index 0fc0cb61..787f2dba 100644 --- a/src/intrusive_stack.h +++ b/src/intrusive_stack.h @@ -38,6 +38,8 @@ SOFTWARE. #include "intrusive_links.h" #include "private/counter_type.h" +#define ETL_FILE "28" + namespace etl { //*************************************************************************** @@ -95,7 +97,7 @@ namespace etl { // The count option is based on the type of link. COUNT_OPTION = ((TLink::OPTION == etl::link_option::AUTO) || (TLink::OPTION == etl::link_option::CHECKED)) ? - etl::count_option::SLOW_COUNT : + etl::count_option::SLOW_COUNT : etl::count_option::FAST_COUNT }; @@ -136,7 +138,7 @@ namespace etl { etl::link(value, p_top); } - + p_top = &value; ++current_size; @@ -217,4 +219,6 @@ namespace etl }; } +#undef ETL_FILE + #endif From 42f81f0fa8dd7b2026e3c5774c039d5c77822d61 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 14 Dec 2016 12:54:30 +0000 Subject: [PATCH 46/93] Modified ETL_FILE definition. --- src/private/string_base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/private/string_base.h b/src/private/string_base.h index f3e84212..7807448f 100644 --- a/src/private/string_base.h +++ b/src/private/string_base.h @@ -42,7 +42,7 @@ SOFTWARE. #include "../exception.h" #include "../error_handler.h" -#define ETL_FILE "24" +#define ETL_FILE "27" #ifdef ETL_COMPILER_MICROSOFT #undef max From 676097f8b94ef746b68185554669219129f11949 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 14 Dec 2016 12:55:18 +0000 Subject: [PATCH 47/93] Linux compatible filename case. --- test/murmurhash3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/murmurhash3.cpp b/test/murmurhash3.cpp index 75a6110e..eb453366 100644 --- a/test/murmurhash3.cpp +++ b/test/murmurhash3.cpp @@ -7,7 +7,7 @@ // compile and run any of them on any platform, but your performance with the // non-native version will be less than optimal. -#include "MurmurHash3.h" +#include "murmurhash3.h" //----------------------------------------------------------------------------- // Platform-specific functions and macros From 4bab3ab6d452ee532955166de072ff88cdf05655 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Wed, 14 Dec 2016 12:58:08 +0000 Subject: [PATCH 48/93] Updated error numbers --- src/file_error_numbers.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/file_error_numbers.txt b/src/file_error_numbers.txt index db9728cc..48b14101 100644 --- a/src/file_error_numbers.txt +++ b/src/file_error_numbers.txt @@ -23,4 +23,7 @@ 23 iunordered_set, iunordered_multiset 24 variant 25 iunordered_multimap -26 iunordered_multiset \ No newline at end of file +26 iunordered_multiset +27 string_base +28 intrusive_stack +29 intrusive_queue \ No newline at end of file From d5aeff4a8ed87a8325468062cb293014ff148890 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Thu, 15 Dec 2016 09:30:09 +0000 Subject: [PATCH 49/93] Added etl::exchange --- src/utility.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/utility.h diff --git a/src/utility.h b/src/utility.h new file mode 100644 index 00000000..d660ef4d --- /dev/null +++ b/src/utility.h @@ -0,0 +1,49 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_UTILITY__ +#define __ETL_UTILITY__ + +///\defgroup utility utility +///\ingroup utilities + +namespace etl +{ + template + T exchange(T& object, U& new_value) + { + T old_value = object; + object = new_value; + return old_value; + } +} + +#endif + From ed785da11b229c442ec6e6a5cade4e10deb7bb45 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Thu, 15 Dec 2016 14:15:06 +0000 Subject: [PATCH 50/93] Added const version of exchange. Added exchange tests --- src/utility.h | 8 ++++++ test/test_utility.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 test/test_utility.cpp diff --git a/src/utility.h b/src/utility.h index d660ef4d..19772936 100644 --- a/src/utility.h +++ b/src/utility.h @@ -43,6 +43,14 @@ namespace etl object = new_value; return old_value; } + + template + T exchange(T& object, const U& new_value) + { + T old_value = object; + object = new_value; + return old_value; + } } #endif diff --git a/test/test_utility.cpp b/test/test_utility.cpp new file mode 100644 index 00000000..fad3bc26 --- /dev/null +++ b/test/test_utility.cpp @@ -0,0 +1,61 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2014 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include + +#include "../src/utility.h" + +namespace +{ + SUITE(test_utility) + { + //========================================================================= + TEST(test_exchange) + { + int a = 1; + int b = 2; + int c = etl::exchange(a, b); // c = a, a = b + + CHECK_EQUAL(2, a); + CHECK_EQUAL(2, b); + CHECK_EQUAL(1, c); + } + + //========================================================================= + TEST(test_exchange_const) + { + int a = 1; + const int b = 2; + int c = etl::exchange(a, b); // c = a, a = b + + CHECK_EQUAL(2, a); + CHECK_EQUAL(2, b); + CHECK_EQUAL(1, c); + } + }; +} From 8c1f678ac946c2218e98649cb06c855757f1c0c1 Mon Sep 17 00:00:00 2001 From: jwellbelove Date: Fri, 16 Dec 2016 14:24:37 +0000 Subject: [PATCH 51/93] Created 'ratio.h' Added as_const to 'utility.h' --- src/ratio.h | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/utility.h | 8 +++++ 2 files changed, 102 insertions(+) create mode 100644 src/ratio.h diff --git a/src/ratio.h b/src/ratio.h new file mode 100644 index 00000000..c0f03436 --- /dev/null +++ b/src/ratio.h @@ -0,0 +1,94 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_RATIO__ +#define __ETL_RATIO__ + +#include + +///\defgroup ratio ratio +///\ingroup utilities + +namespace etl +{ + template + struct ratio + { + static const std::intmax_t num = NUM; + static const std::intmax_t den = DEN; + }; + + #if INT_MAX > INT32_MAX + typedef ratio<1, 1000000000000000000000000> yocto; + typedef ratio<1, 1000000000000000000000> zepto; + typedef ratio<1, 1000000000000000000> atto + typedef ratio<1, 1000000000000000> femto + typedef ratio<1, 1000000000000> pico; + #endif + + #if (INT_MAX >= INT32_MAX) + typedef ratio<1, 1000000000> nano; + typedef ratio<1, 1000000> micro; + #endif + + #if (INT_MAX >= INT16_MAX) + typedef ratio<1, 1000> milli; + typedef ratio<1, 100> centi; + typedef ratio<1, 10> deci; + typedef ratio<10, 1> deca; + typedef ratio<100, 1> hecto + typedef ratio<1000, 1> kilo + #endif + + #if (INT_MAX >= INT32_MAX) + typedef ratio<1000000, 1> mega; + typedef ratio<1000000000, 1> giga; + #endif + + #if INT_MAX > INT32_MAX + typedef ratio<1000000000000, 1> tera; + typedef ratio<1000000000000000, 1> peta; + typedef ratio<1000000000000000000, 1> exa; + typedef ratio<1000000000000000000000, 1> zetta; + typedef ratio<1000000000000000000000000, 1> yotta; + #endif + + /// An approximation of PI to 6 digits. + typedef ratio<355, 113> ratio_pi; + + /// An approximation of root 2. + typedef ratio<239, 169> ratio_root2; + + /// An approximation of e. + typedef ratio<326, 120> ratio_e; +} + +#endif + diff --git a/src/utility.h b/src/utility.h index 19772936..1b1c2347 100644 --- a/src/utility.h +++ b/src/utility.h @@ -31,6 +31,8 @@ SOFTWARE. #ifndef __ETL_UTILITY__ #define __ETL_UTILITY__ +#include "type_traits.h" + ///\defgroup utility utility ///\ingroup utilities @@ -51,6 +53,12 @@ namespace etl object = new_value; return old_value; } + + template + etl::add_const_t& as_const(T& t) + { + return t; + } } #endif From d58f675722f190bbb9395b496c85e3c4fd72e185 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:40:29 +0000 Subject: [PATCH 52/93] Added hash functions --- src/callback.h | 6 +- src/fnv_1.h | 28 +-- src/hash.h | 60 +++-- src/ibasic_string.h | 6 +- src/iforward_list.h | 30 +-- src/intrusive_forward_list.h | 30 +-- src/intrusive_links.h | 3 +- src/intrusive_list.h | 2 +- src/ipriority_queue.h | 10 +- src/iqueue.h | 2 +- src/istack.h | 2 +- src/ivector.h | 2 +- src/pearson.cpp | 1 - src/private/ivectorpointer.h | 47 +++- src/private/map_base.h | 28 +-- src/private/pvoidvector.h | 16 +- src/string.h | 17 +- src/type_def.h | 42 +--- src/type_traits.h | 46 ++-- src/u16string.h | 17 +- src/u32string.h | 17 +- src/variant.h | 71 ++++-- src/wstring.h | 17 +- test/test_intrusive_forward_list.cpp | 343 +++++---------------------- test/test_intrusive_links.cpp | 7 +- test/test_variant.cpp | 16 ++ test/vs2015/etl.vcxproj | 16 +- test/vs2015/etl.vcxproj.filters | 6 - 28 files changed, 353 insertions(+), 535 deletions(-) diff --git a/src/callback.h b/src/callback.h index 0111c492..805e3bec 100644 --- a/src/callback.h +++ b/src/callback.h @@ -28,8 +28,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#error In Development. Do not use. - #ifndef __ETL_CALLBACK__ #define __ETL_CALLBACK__ @@ -37,8 +35,8 @@ namespace etl { //*************************************************************************** /// A callback class designed to be multiply inherited by other client classes. - /// The class is parameterised with a callback parameter type and a unique id. - /// The unique id allows muliple callbacks with the same parameter type. + /// The class is parametrised with a callback parameter type and a unique id. + /// The unique id allows multiple callbacks with the same parameter type. ///\tparam TParameter The callback parameter type. ///\tparam ID The unique id for this callback. //*************************************************************************** diff --git a/src/fnv_1.h b/src/fnv_1.h index ce787651..c9799196 100644 --- a/src/fnv_1.h +++ b/src/fnv_1.h @@ -106,17 +106,17 @@ namespace etl this->add(begin, end); } }; - + //*************************************************************************** /// fnv_1a policy. /// Calculates FNV1A. //*************************************************************************** struct fnv_1a_policy_64 - { + { typedef uint64_t value_type; inline uint64_t initial() const - { + { return OFFSET_BASIS; } @@ -124,7 +124,7 @@ namespace etl { hash ^= value; hash *= PRIME; - return hash; + return hash; } inline uint64_t final(uint64_t hash) const @@ -135,7 +135,7 @@ namespace etl static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325; static const uint64_t PRIME = 0x00000100000001b3; }; - + //*************************************************************************** /// Calculates the fnv_1a_64 hash. ///\ingroup fnv_1a_64 @@ -170,11 +170,11 @@ namespace etl /// Calculates FNV1. //*************************************************************************** struct fnv_1_policy_32 - { - typedef uint32_t value_type; - - inline uint32_t initial() const { + typedef uint32_t value_type; + + inline uint32_t initial() const + { return OFFSET_BASIS; } @@ -182,7 +182,7 @@ namespace etl { hash *= PRIME; hash ^= value; - return hash; + return hash; } inline uint32_t final(uint32_t hash) const @@ -222,17 +222,17 @@ namespace etl this->add(begin, end); } }; - + //*************************************************************************** /// fnv_1a policy. /// Calculates FNV1A. //*************************************************************************** struct fnv_1a_policy_32 - { + { typedef uint32_t value_type; inline uint32_t initial() const - { + { return OFFSET_BASIS; } @@ -240,7 +240,7 @@ namespace etl { hash ^= value; hash *= PRIME; - return hash; + return hash; } inline uint32_t final(uint32_t hash) const diff --git a/src/hash.h b/src/hash.h index 2a3f8ddc..39408f3a 100644 --- a/src/hash.h +++ b/src/hash.h @@ -50,9 +50,9 @@ namespace etl /// Hash to use when size_t is 16 bits. /// T is always expected to be size_t. //************************************************************************* - template + template typename enable_if::type - generic_hash(uint8_t* begin, uint8_t* end) + generic_hash(const uint8_t* begin, const uint8_t* end) { uint32_t h = fnv_1a_32(begin, end); @@ -63,9 +63,9 @@ namespace etl /// Hash to use when size_t is 32 bits. /// T is always expected to be size_t. //************************************************************************* - template + template typename enable_if::type - generic_hash(uint8_t* begin, uint8_t* end) + generic_hash(const uint8_t* begin, const uint8_t* end) { return fnv_1a_32(begin, end); } @@ -74,9 +74,9 @@ namespace etl /// Hash to use when size_t is 64 bits. /// T is always expected to be size_t. //************************************************************************* - template + template typename enable_if::type - generic_hash(uint8_t* begin, uint8_t* end) + generic_hash(const uint8_t* begin, const uint8_t* end) { return fnv_1a_64(begin, end); } @@ -323,9 +323,15 @@ namespace etl // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(v)) { - size_t t; - memcpy(&t, &v, sizeof(size_t)); - return t; + union + { + size_t s; + float v; + } u; + + u.v = v; + + return u.s; } else { @@ -347,9 +353,15 @@ namespace etl // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(v)) { - size_t t; - memcpy(&t, &v, sizeof(size_t)); - return t; + union + { + size_t s; + double v; + } u; + + u.v = v; + + return u.s; } else { @@ -371,9 +383,15 @@ namespace etl // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(v)) { - size_t t; - memcpy(&t, &v, sizeof(size_t)); - return t; + union + { + size_t s; + long double v; + } u; + + u.v = v; + + return u.s; } else { @@ -395,9 +413,15 @@ namespace etl // If it's the same size as a size_t. if (sizeof(size_t) == sizeof(T*)) { - size_t t; - memcpy(&t, &v, sizeof(size_t)); - return t; + union + { + size_t s; + const T* v; + } u; + + u.v = v; + + return u.s; } else { diff --git a/src/ibasic_string.h b/src/ibasic_string.h index 34c6ba95..85bd6d9c 100644 --- a/src/ibasic_string.h +++ b/src/ibasic_string.h @@ -36,7 +36,7 @@ SOFTWARE. #include #include #include -#include +#include #include "private/string_base.h" #include "platform.h" @@ -460,7 +460,7 @@ namespace etl //************************************************************************* /// Removes an element from the end of the string. - /// Undefined behaviour if the string is empty. + /// Does nothing if the string is empty. //************************************************************************* void pop_back() { @@ -468,7 +468,7 @@ namespace etl ETL_ASSERT(!empty(), ETL_ERROR(string_empty)); #endif - p_buffer[--current_size] = 0; + p_buffer[--current_size] = 0; } //********************************************************************* diff --git a/src/iforward_list.h b/src/iforward_list.h index 0f418209..b663ad8e 100644 --- a/src/iforward_list.h +++ b/src/iforward_list.h @@ -256,7 +256,7 @@ namespace etl const Node* p_node; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Gets the beginning of the forward_list. @@ -348,7 +348,7 @@ namespace etl //************************************************************************* /// Assigns a range of values to the forward_list. - /// If asserts or exceptions are enabled throws etl::forward_list_full if the forward_list does not have enough free space. + /// If asserts or exceptions are enabled throws etl::forward_list_full if the forward_list does not have enough free space. /// If ETL_THROW_EXCEPTIONS & _DEBUG are defined throws forward_list_iterator if the iterators are reversed. //************************************************************************* template @@ -707,7 +707,7 @@ namespace etl if (is_trivial_list()) { - return; + return; } while (true) @@ -746,32 +746,32 @@ namespace etl // Decide whether the next node of merge comes from left or right. if (left_size == 0) { - // Left is empty. The node must come from right. - p_node = p_right; + // Left is empty. The node must come from right. + p_node = p_right; ++p_right; --right_size; - } + } else if (right_size == 0 || p_right == end()) { - // Right is empty. The node must come from left. - p_node = p_left; + // Right is empty. The node must come from left. + p_node = p_left; ++p_left; --left_size; - } + } else if (compare(*p_left, *p_right)) { - // First node of left is lower or same. The node must come from left. - p_node = p_left; + // First node of left is lower or same. The node must come from left. + p_node = p_left; ++p_left; --left_size; - } + } else { - // First node of right is lower. The node must come from right. - p_node = p_right; + // First node of right is lower. The node must come from right. + p_node = p_right; ++p_right; --right_size; - } + } // Add the next node to the merged head. if (p_head == before_begin()) diff --git a/src/intrusive_forward_list.h b/src/intrusive_forward_list.h index 3bec7fd4..fa275352 100644 --- a/src/intrusive_forward_list.h +++ b/src/intrusive_forward_list.h @@ -325,7 +325,7 @@ namespace etl const value_type* p_value; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -659,7 +659,7 @@ namespace etl if (is_trivial_list()) { - return; + return; } while (true) @@ -698,32 +698,32 @@ namespace etl // Decide whether the next link of merge comes from left or right. if (left_size == 0) { - // Left is empty. The link must come from right. - i_link = i_right; + // Left is empty. The link must come from right. + i_link = i_right; ++i_right; --right_size; - } + } else if (right_size == 0 || i_right == end()) { - // Right is empty. The link must come from left. - i_link = i_left; + // Right is empty. The link must come from left. + i_link = i_left; ++i_left; --left_size; - } + } else if (compare(*i_left, *i_right)) { - // First link of left is lower or same. The link must come from left. - i_link = i_left; + // First link of left is lower or same. The link must come from left. + i_link = i_left; ++i_left; --left_size; - } + } else { - // First link of right is lower. The link must come from right. - i_link = i_right; + // First link of right is lower. The link must come from right. + i_link = i_right; ++i_right; --right_size; - } + } // Add the next link to the merged head. if (i_head == before_begin()) @@ -906,7 +906,7 @@ namespace etl last = last->link_type::etl_next; } - // Unlink from the source other. + // Unlink from the source list. link_type* first_next = first->link_type::etl_next; etl::unlink_after(*first, *last); diff --git a/src/intrusive_links.h b/src/intrusive_links.h index eb0bf522..823a6dc2 100644 --- a/src/intrusive_links.h +++ b/src/intrusive_links.h @@ -149,7 +149,7 @@ namespace etl struct forward_link; //****************************************************************** - // Specialisation for checked link option. + // Specialisation for checked unlink option. // An error will be generated if the links are valid when the object // is destroyed. //****************************************************************** @@ -669,7 +669,6 @@ namespace etl { clear(); } - void clear() { etl_parent = nullptr; diff --git a/src/intrusive_list.h b/src/intrusive_list.h index 9e151c8f..2da75417 100644 --- a/src/intrusive_list.h +++ b/src/intrusive_list.h @@ -342,7 +342,7 @@ namespace etl const value_type* p_value; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. diff --git a/src/ipriority_queue.h b/src/ipriority_queue.h index 74a11cfd..8e58300a 100644 --- a/src/ipriority_queue.h +++ b/src/ipriority_queue.h @@ -180,14 +180,14 @@ namespace etl //************************************************************************* /// Removes the oldest value from the back of the priority queue. - /// Undefined behaviour if the priority queue is already empty. + /// Does nothing if the priority queue is already empty. //************************************************************************* void pop() { - // Move largest element to end - std::pop_heap(container.begin(), container.end(), TCompare()); - // Actually remove largest element at end - container.pop_back(); + // Move largest element to end + std::pop_heap(container.begin(), container.end(), TCompare()); + // Actually remove largest element at end + container.pop_back(); } //************************************************************************* diff --git a/src/iqueue.h b/src/iqueue.h index 8d8751f2..0f55963c 100644 --- a/src/iqueue.h +++ b/src/iqueue.h @@ -162,7 +162,7 @@ namespace etl //************************************************************************* /// Removes the oldest value from the back of the queue. - /// Undefined behaviour if the queue is already empty. + /// Does nothing if the queue is already empty. //************************************************************************* void pop() { diff --git a/src/istack.h b/src/istack.h index d742f452..35e8107c 100644 --- a/src/istack.h +++ b/src/istack.h @@ -135,7 +135,7 @@ namespace etl //************************************************************************* /// Removes the oldest item from the top of the stack. - /// Undefined behaviour if the stack is already empty. + /// Does nothing if the stack is already empty. //************************************************************************* void pop() { diff --git a/src/ivector.h b/src/ivector.h index a186a4a7..0dfe8491 100644 --- a/src/ivector.h +++ b/src/ivector.h @@ -475,7 +475,7 @@ namespace etl //************************************************************************* /// Removes an element from the end of the vector. - /// Undefined behaviour if the vector is empty. + /// Does nothing if the vector is empty. //************************************************************************* void pop_back() { diff --git a/src/pearson.cpp b/src/pearson.cpp index a10940b4..94c5ec0f 100644 --- a/src/pearson.cpp +++ b/src/pearson.cpp @@ -61,4 +61,3 @@ namespace etl 213, 163, 150, 101, 129, 14, 249, 205, 214, 1, 41, 56, 162, 72, 239, 82 } ; } - diff --git a/src/private/ivectorpointer.h b/src/private/ivectorpointer.h index 13c4512b..1aae4e5c 100644 --- a/src/private/ivectorpointer.h +++ b/src/private/ivectorpointer.h @@ -35,7 +35,7 @@ SOFTWARE. #error This header is a private element of etl::ivector #endif -#include "private/pvoidvector.h" +#include "pvoidvector.h" namespace etl { @@ -456,7 +456,7 @@ namespace etl template bool operator ==(const etl::ivector& lhs, const etl::ivector& rhs) { - return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin()); + return pvoidvector_equal(lhs, rhs); } //*************************************************************************** @@ -469,7 +469,7 @@ namespace etl template bool operator !=(const etl::ivector& lhs, const etl::ivector& rhs) { - return !(lhs == rhs); + return pvoidvector_not_equal(lhs, rhs); } //*************************************************************************** @@ -482,7 +482,7 @@ namespace etl template bool operator <(const etl::ivector& lhs, const etl::ivector& rhs) { - return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return pvoidvector_less_than(lhs, rhs); } //*************************************************************************** @@ -495,7 +495,7 @@ namespace etl template bool operator >(const etl::ivector& lhs, const etl::ivector& rhs) { - return (rhs < lhs); + return pvoidvector_greater_than(lhs, rhs); } //*************************************************************************** @@ -508,7 +508,7 @@ namespace etl template bool operator <=(const etl::ivector& lhs, const etl::ivector& rhs) { - return !(lhs > rhs); + return pvoidvector_less_than_equal(lhs, rhs); } //*************************************************************************** @@ -521,7 +521,40 @@ namespace etl template bool operator >=(const etl::ivector& lhs, const etl::ivector& rhs) { - return !(lhs < rhs); + return pvoidvector_greater_than_equal(lhs, rhs); + } + + //*************************************************************************** + // Helper functions + //*************************************************************************** + inline bool pvoidvector_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return operator ==(lhs, rhs); + } + + inline bool pvoidvector_not_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return operator !=(lhs, rhs); + } + + inline bool pvoidvector_less_than(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return operator <(lhs, rhs); + } + + inline bool pvoidvector_greater_than(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return operator >(lhs, rhs); + } + + inline bool pvoidvector_less_than_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return operator <=(lhs, rhs); + } + + inline bool pvoidvector_greater_than_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return operator >=(lhs, rhs); } } diff --git a/src/private/map_base.h b/src/private/map_base.h index f23de8da..2ac3256f 100644 --- a/src/private/map_base.h +++ b/src/private/map_base.h @@ -178,8 +178,8 @@ namespace etl /// Constructor //*********************************************************************** Node() : - weight(kNeither), - dir(kNeither) + weight(uint_least8_t(kNeither)), + dir(uint_least8_t(kNeither)) { } @@ -188,13 +188,13 @@ namespace etl //*********************************************************************** void mark_as_leaf() { - weight = kNeither; - dir = kNeither; + weight = uint_least8_t(kNeither); + dir = uint_least8_t(kNeither); children[0] = nullptr; children[1] = nullptr; } - Node* children[2]; + Node* children[2]; uint_least8_t weight; uint_least8_t dir; }; @@ -222,12 +222,12 @@ namespace etl while (weight_node) { // Keep going until we reach a terminal node (dir == kNeither) - if (kNeither != weight_node->dir) + if (uint_least8_t(kNeither) != weight_node->dir) { // Does this insert balance the previous weight factor value? if (weight_node->weight == 1 - weight_node->dir) { - weight_node->weight = kNeither; + weight_node->weight = uint_least8_t(kNeither); } else { @@ -245,14 +245,14 @@ namespace etl } // while(weight_node) // Step 2: Update weight for critical_node or rotate tree to balance node - if (kNeither == critical_node->weight) + if (uint_least8_t(kNeither) == critical_node->weight) { critical_node->weight = critical_node->dir; } // If direction is different than weight, then it will now be balanced else if (critical_node->dir != critical_node->weight) { - critical_node->weight = kNeither; + critical_node->weight = uint_least8_t(kNeither); } // Rotate is required to balance the tree at the critical node else @@ -296,11 +296,11 @@ namespace etl // New root now becomes parent of current position new_root->children[1 - dir] = position; // Clear weight factor from current position - position->weight = kNeither; + position->weight = uint_least8_t(kNeither); // Newly detached right now becomes current position position = new_root; // Clear weight factor from new root - position->weight = kNeither; + position->weight = uint_least8_t(kNeither); } //************************************************************************* @@ -323,7 +323,7 @@ namespace etl // Capture new root (either E or D depending on dir) Node* new_root = position->children[dir]->children[1 - dir]; // Set weight factor for B or C based on F or G existing and being a different than dir - position->children[dir]->weight = third != kNeither && third != dir ? dir : kNeither; + position->children[dir]->weight = third != uint_least8_t(kNeither) && third != dir ? dir : uint_least8_t(kNeither); // Detach new root from its tree (replace with new roots child) position->children[dir]->children[1 - dir] = @@ -331,7 +331,7 @@ namespace etl // Attach current left tree to new root new_root->children[dir] = position->children[dir]; // Set weight factor for A based on F or G - position->weight = third != kNeither && third == dir ? 1 - dir : kNeither; + position->weight = third != uint_least8_t(kNeither) && third == dir ? 1 - dir : uint_least8_t(kNeither); // Move new root's right tree to current roots left tree position->children[dir] = new_root->children[1 - dir]; @@ -340,7 +340,7 @@ namespace etl // Replace current position with new root position = new_root; // Clear weight factor for new current position - position->weight = kNeither; + position->weight = uint_least8_t(kNeither); } //************************************************************************* diff --git a/src/private/pvoidvector.h b/src/private/pvoidvector.h index 165d0c32..010b47c0 100644 --- a/src/private/pvoidvector.h +++ b/src/private/pvoidvector.h @@ -392,7 +392,7 @@ namespace etl //************************************************************************* /// Removes an element from the end of the vector. - /// Undefined behaviour if the vector is empty. + /// Does nothing if the vector is empty. //************************************************************************* void pop_back() { @@ -616,6 +616,20 @@ namespace etl // Disable copy construction. pvoidvector(const pvoidvector&); }; + + bool pvoidvector_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool pvoidvector_not_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool pvoidvector_less_than(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool pvoidvector_greater_than(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool pvoidvector_less_than_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool pvoidvector_greater_than_equal(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + + bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool operator !=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool operator >(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool operator <=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); + bool operator >=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs); } #ifdef ETL_COMPILER_MICROSOFT diff --git a/src/string.h b/src/string.h index 055c1fc9..26f1fbdf 100644 --- a/src/string.h +++ b/src/string.h @@ -182,19 +182,16 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; - //*************************************************************************** - /// Specialisation for string. - ///\ingroup hash - //*************************************************************************** + //************************************************************************* + /// Hash function. + //************************************************************************* template <> - struct hash + struct hash { - size_t operator ()(const string& s) const + size_t operator()(const etl::istring& text) const { - uint8_t* p_begin = &s[0]; - uint8_t* p_end = &s[s.size()]; - - return etl::__private_hash__::generic_hash(p_begin, p_end); + return etl::__private_hash__::generic_hash<>(reinterpret_cast(&text[0]), + reinterpret_cast(&text[text.size()])); } }; } diff --git a/src/type_def.h b/src/type_def.h index 707a0732..66d6156e 100644 --- a/src/type_def.h +++ b/src/type_def.h @@ -40,11 +40,11 @@ namespace etl /// Usage: ///\code /// // Short form. - /// ETL_TYPEDEF(int, mytype_t); + /// ETL_TYPEDEF(int, mytype); /// /// // Long form. /// class mytype_t_tag; - /// typedef etl::type_def mytype_t; + /// typedef etl::type_def mytype_t_tag; ///\endcode //************************************************************************* template @@ -79,18 +79,6 @@ namespace etl return value; } - //********************************************************************* - explicit operator bool() const - { - return static_cast(value); - } - - //********************************************************************* - bool operator !() const - { - return !bool(value); - } - //********************************************************************* type_def& operator ++() { @@ -255,35 +243,11 @@ namespace etl } //********************************************************************* - const TValue& get() const + TValue get() const { return value; } - //********************************************************************* - friend type_def operator +(const type_def& lhs, const type_def& rhs) - { - return type_def(lhs.value + rhs.value); - } - - //********************************************************************* - friend type_def operator -(const type_def& lhs, const type_def& rhs) - { - return type_def(lhs.value - rhs.value); - } - - //********************************************************************* - friend type_def operator *(const type_def& lhs, const type_def& rhs) - { - return type_def(lhs.value * rhs.value); - } - - //********************************************************************* - friend type_def operator /(const type_def& lhs, const type_def& rhs) - { - return type_def(lhs.value / rhs.value); - } - //********************************************************************* friend bool operator <(const type_def& lhs, const type_def& rhs) { diff --git a/src/type_traits.h b/src/type_traits.h index 605aa63d..776bfda0 100644 --- a/src/type_traits.h +++ b/src/type_traits.h @@ -47,15 +47,15 @@ namespace etl template struct integral_constant { - static const T value = VALUE; + static const T value = VALUE; - typedef T value_type; + typedef T value_type; typedef integral_constant type; - operator value_type() const - { - return value; - } + operator value_type() const + { + return value; + } }; /// integral_constant specialisations @@ -242,19 +242,16 @@ namespace etl template struct make_signed { typedef T type; }; template <> struct make_signed { typedef signed char type; }; template <> struct make_signed { typedef signed char type; }; -#if defined(ETL_COMPILER_GCC) + template <> struct make_signed { - typedef wchar_t type; + typedef typename etl::conditional::type>::type type; }; -#else - template <> struct make_signed - { - typedef etl::conditional::type>::type>::type type; - }; -#endif + template <> struct make_signed { typedef short type; }; template <> struct make_signed { typedef int type; }; template <> struct make_signed { typedef long type; }; @@ -269,19 +266,16 @@ namespace etl template <> struct make_unsigned { typedef unsigned char type; }; template <> struct make_unsigned { typedef unsigned char type; }; template <> struct make_unsigned { typedef unsigned short type; }; -#if defined(ETL_COMPILER_GCC) && !defined(ETL_PLATFORM_LINUX) + template <> struct make_unsigned { - typedef wchar_t type; + typedef typename etl::conditional::type>::type type; }; -#else - template <> struct make_unsigned - { - typedef etl::conditional::type>::type>::type type; - }; -#endif + template <> struct make_unsigned { typedef unsigned int type; }; template <> struct make_unsigned { typedef unsigned long type; }; template <> struct make_unsigned { typedef unsigned long long type; }; diff --git a/src/u16string.h b/src/u16string.h index 138fa916..95766d2b 100644 --- a/src/u16string.h +++ b/src/u16string.h @@ -182,19 +182,16 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; - //*************************************************************************** - /// Specialisation for u16string. - ///\ingroup hash - //*************************************************************************** + //************************************************************************* + /// Hash function. + //************************************************************************* template <> - struct hash + struct hash { - size_t operator ()(const u16string& s) const + size_t operator()(const etl::iu16string& text) const { - uint8_t* p_begin = &s[0]; - uint8_t* p_end = &s[s.size()]; - - return etl::__private_hash__::generic_hash(p_begin, p_end); + return etl::__private_hash__::generic_hash<>(reinterpret_cast(&text[0]), + reinterpret_cast(&text[text.size()])); } }; } diff --git a/src/u32string.h b/src/u32string.h index 8280fbba..4493acad 100644 --- a/src/u32string.h +++ b/src/u32string.h @@ -182,19 +182,16 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; - //*************************************************************************** - /// Specialisation for u32string. - ///\ingroup hash - //*************************************************************************** + //************************************************************************* + /// Hash function. + //************************************************************************* template <> - struct hash + struct hash { - size_t operator ()(const u32string& s) const + size_t operator()(const etl::iu32string& text) const { - uint8_t* p_begin = &s[0]; - uint8_t* p_end = &s[s.size()]; - - return etl::__private_hash__::generic_hash(p_begin, p_end); + return etl::__private_hash__::generic_hash<>(reinterpret_cast(&text[0]), + reinterpret_cast(&text[text.size()])); } }; } diff --git a/src/variant.h b/src/variant.h index 613c3c61..767432a8 100644 --- a/src/variant.h +++ b/src/variant.h @@ -225,6 +225,14 @@ namespace etl public: + //*************************************************************************** + /// Destructor. + //*************************************************************************** + ~variant() + { + destruct_current(); + } + //************************************************************************* //**** Reader types ******************************************************* //************************************************************************* @@ -712,17 +720,21 @@ namespace etl ///\param other The other variant object to copy. //*************************************************************************** variant(const variant& other) - : data(other.data), - type_id(other.type_id) { - } + switch (other.type_id) + { + case 0: new(static_cast(data)) T1(other.get()); break; + case 1: new(static_cast(data)) T2(other.get()); break; + case 2: new(static_cast(data)) T3(other.get()); break; + case 3: new(static_cast(data)) T4(other.get()); break; + case 4: new(static_cast(data)) T5(other.get()); break; + case 5: new(static_cast(data)) T6(other.get()); break; + case 6: new(static_cast(data)) T7(other.get()); break; + case 7: new(static_cast(data)) T8(other.get()); break; + default: break; + } - //*************************************************************************** - /// Destructor. - //*************************************************************************** - ~variant() - { - destruct_current(); + type_id = other.type_id; } //*************************************************************************** @@ -734,18 +746,37 @@ namespace etl { STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - // Assigning the same type as last time? - if (type_id == Type_Id_Lookup::type_id) + destruct_current(); + new(static_cast(data)) T(value); + type_id = Type_Id_Lookup::type_id; + + return *this; + } + + //*************************************************************************** + /// Assignment operator for variant type. + ///\param other The variant to assign. + //*************************************************************************** + variant& operator =(const variant& other) + { + if (this != &other) { - // Do a simple copy. - *static_cast(data) = value; - } - else - { - // We must destruct the old type, as the new one is different. destruct_current(); - new(static_cast(data)) T(value); - type_id = Type_Id_Lookup::type_id; + + switch (other.type_id) + { + case 0: new(static_cast(data)) T1(other.get()); break; + case 1: new(static_cast(data)) T2(other.get()); break; + case 2: new(static_cast(data)) T3(other.get()); break; + case 3: new(static_cast(data)) T4(other.get()); break; + case 4: new(static_cast(data)) T5(other.get()); break; + case 5: new(static_cast(data)) T6(other.get()); break; + case 6: new(static_cast(data)) T7(other.get()); break; + case 7: new(static_cast(data)) T8(other.get()); break; + default: break; + } + + type_id = other.type_id; } return *this; @@ -923,6 +954,8 @@ namespace etl case 7: { static_cast(data)->~T8(); break; } default: { break; } } + + type_id = UNSUPPORTED_TYPE_ID; } //*************************************************************************** diff --git a/src/wstring.h b/src/wstring.h index 94bebc6b..6633173c 100644 --- a/src/wstring.h +++ b/src/wstring.h @@ -183,19 +183,16 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; - //*************************************************************************** - /// Specialisation for wstring. - ///\ingroup hash - //*************************************************************************** + //************************************************************************* + /// Hash function. + //************************************************************************* template <> - struct hash + struct hash { - size_t operator ()(const wstring& s) const + size_t operator()(const etl::iwstring& text) const { - uint8_t* p_begin = &s[0]; - uint8_t* p_end = &s[s.size()]; - - return etl::__private_hash__::generic_hash(p_begin, p_end); + return etl::__private_hash__::generic_hash<>(reinterpret_cast(&text[0]), + reinterpret_cast(&text[text.size()])); } }; } diff --git a/test/test_intrusive_forward_list.cpp b/test/test_intrusive_forward_list.cpp index 089b005c..46ce13b7 100644 --- a/test/test_intrusive_forward_list.cpp +++ b/test/test_intrusive_forward_list.cpp @@ -259,73 +259,58 @@ namespace ////************************************************************************* TEST_FIXTURE(SetupFixture, test_two_lists_different) { - int i = 0; + std::list compare0; + std::list compare1; + + DataNDC0 data0; + DataNDC1 data1; - { - std::list compare0; - std::list compare1; - { - ItemNDCNode node0("0"); - ItemNDCNode node1("1"); - ItemNDCNode node2("2"); - ItemNDCNode node3("3"); - ItemNDCNode node4("4"); - ItemNDCNode node5("5"); - ItemNDCNode node6("6"); - ItemNDCNode node7("7"); + ItemNDCNode node0("0"); + ItemNDCNode node1("1"); + ItemNDCNode node2("2"); + ItemNDCNode node3("3"); + ItemNDCNode node4("4"); + ItemNDCNode node5("5"); + ItemNDCNode node6("6"); + ItemNDCNode node7("7"); - { - DataNDC0 data0; - DataNDC1 data1; + compare0.push_front(node0); + compare0.push_front(node1); + compare0.push_front(node2); + compare0.push_front(node4); + compare0.push_front(node6); + compare0.push_front(node7); + + data0.push_front(node0); + data0.push_front(node1); + data0.push_front(node2); + data0.push_front(node4); + data0.push_front(node6); + data0.push_front(node7); + are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); + CHECK(are_equal); + CHECK_EQUAL(6, data0.size()); + CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + compare1.push_front(node0); + compare1.push_front(node1); + compare1.push_front(node3); + compare1.push_front(node4); + compare1.push_front(node5); + compare1.push_front(node7); - compare0.push_front(node0); - compare0.push_front(node1); - compare0.push_front(node2); - compare0.push_front(node4); - compare0.push_front(node6); - compare0.push_front(node7); + data1.push_front(node0); + data1.push_front(node1); + data1.push_front(node3); + data1.push_front(node4); + data1.push_front(node5); + data1.push_front(node7); - compare1.push_front(node0); - compare1.push_front(node1); - compare1.push_front(node3); - compare1.push_front(node4); - compare1.push_front(node5); - compare1.push_front(node7); - - data0.push_front(node0); - data0.push_front(node1); - data0.push_front(node2); - data0.push_front(node4); - data0.push_front(node6); - data0.push_front(node7); - - data1.push_front(node0); - data1.push_front(node1); - data1.push_front(node3); - data1.push_front(node4); - data1.push_front(node5); - data1.push_front(node7); - - are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); - CHECK(are_equal); - CHECK_EQUAL(6, data0.size()); - CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); - - are_equal = std::equal(data1.begin(), data1.end(), compare1.begin()); - CHECK(are_equal); - CHECK_EQUAL(6, data1.size()); - CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); - } - - size_t temp = compare0.size(); - } - - size_t temp = compare0.size(); - } - - i = 1; + are_equal = std::equal(data1.begin(), data1.end(), compare1.begin()); + CHECK(are_equal); + CHECK_EQUAL(6, data1.size()); + CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); } //************************************************************************* @@ -346,9 +331,9 @@ namespace std::forward_list::iterator i_compare_data = compare_data.begin(); std::advance(i_compare_data, offset); - compare_data.insert_after(i_compare_data, INSERT_VALUE1); data0.insert_after(i_data, INSERT_VALUE1); - + compare_data.insert_after(i_compare_data, INSERT_VALUE1); + are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); @@ -369,16 +354,8 @@ namespace std::forward_list temp(data0.begin(), data0.end()); - compare_data.insert_after(i_compare_data, INSERT_VALUE2); data0.insert_after(i_data, INSERT_VALUE2); - - // Clear the nodes in the temp list. - std::forward_list::iterator itr = temp.begin(); - while (itr != temp.end()) - { - itr->FirstLink::clear(); - ++itr; - } + compare_data.insert_after(i_compare_data, INSERT_VALUE2); temp.assign(data0.begin(), data0.end()); @@ -391,22 +368,6 @@ namespace CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); - - // Clear the nodes in the compare list. - itr = compare_data.begin(); - while (itr != compare_data.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - // Clear the nodes in the temp list. - itr = temp.begin(); - while (itr != temp.end()) - { - itr->FirstLink::clear(); - ++itr; - } } //************************************************************************* @@ -430,13 +391,6 @@ namespace CHECK_EQUAL(test1.size(), data1.size()); CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); - std::forward_list::iterator itr = compare.begin(); - while (itr != compare.end()) - { - itr->FirstLink::clear(); - ++itr; - } - compare.assign(test1.begin(), test1.end()); data0.assign(test1.begin(), test1.end()); @@ -458,22 +412,6 @@ namespace CHECK(are_equal); CHECK_EQUAL(test1.size(), data1.size()); CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); - - // Clear the nodes in the compare list. - itr = compare.begin(); - while (itr != compare.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - // Clear the nodes in the out list. - itr = out.begin(); - while (itr != out.end()) - { - itr->FirstLink::clear(); - ++itr; - } } //************************************************************************* @@ -503,20 +441,10 @@ namespace CHECK_NO_THROW(data0.push_front(node5)); CHECK_NO_THROW(data0.push_front(node6)); - //are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); - //CHECK(are_equal); + are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); + CHECK(are_equal); CHECK_EQUAL(6, data0.size()); CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); - - // Clear the nodes in the compare list. - std::list::iterator itr = compare_data.begin(); - while (itr != compare_data.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); } //************************************************************************* @@ -569,9 +497,6 @@ namespace CHECK_EQUAL(6, data1.size()); CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); CHECK(!data1.empty()); - - data0.clear(); - data1.clear(); } //************************************************************************* @@ -632,16 +557,6 @@ namespace are_equal = *i_data == *i_compare_data; CHECK(are_equal); - - //std::forward_list::iterator itr = compare_data.begin(); - //while (itr != compare_data.end()) - //{ - // itr->FirstLink::clear(); - // ++itr; - //} - - data0.clear(); - data1.clear(); } //************************************************************************* @@ -678,9 +593,6 @@ namespace CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); - - data0.clear(); - data1.clear(); } //************************************************************************* @@ -711,9 +623,6 @@ namespace CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); - - data0.clear(); - data1.clear(); } //************************************************************************* @@ -852,25 +761,16 @@ namespace DataNDC0 data0(sorted_data.begin(), sorted_data.end()); DataNDC0 data1(sorted_data2.begin(), sorted_data2.end()); - size_t i0 = data0.size(); - size_t i1 = data0.size(); - DataNDC0::iterator idata_destination = data0.begin(); - std::advance(idata_destination, 1); - - size_t t1 = data0.size(); + std::advance(idata_destination, 3); std::forward_list compare0(data0.begin(), data0.end()); std::forward_list compare1(data1.begin(), data1.end()); std::forward_list::iterator icompare_destination = compare0.begin(); - std::advance(icompare_destination, 1); + std::advance(icompare_destination, 3); data0.splice_after(idata_destination, data1); - - size_t t2 = data0.size(); - size_t t3 = data1.size(); - compare0.splice_after(icompare_destination, compare1); are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); @@ -878,23 +778,6 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - itr = compare1.begin(); - while (itr != compare1.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); - data1.clear(); } //************************************************************************* @@ -919,15 +802,6 @@ namespace CHECK(are_equal); CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); } //************************************************************************* @@ -967,23 +841,6 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - itr = compare1.begin(); - while (itr != compare1.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); - data1.clear(); } //************************************************************************* @@ -1020,15 +877,6 @@ namespace CHECK(are_equal); CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); } //************************************************************************* @@ -1050,23 +898,6 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - itr = compare1.begin(); - while (itr != compare1.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); - data1.clear(); } //************************************************************************* @@ -1088,23 +919,6 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare2.begin(), compare2.end()), data2.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - itr = compare2.begin(); - while (itr != compare2.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); - data2.clear(); } //************************************************************************* @@ -1126,23 +940,6 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare3.begin(), compare3.end()), data3.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - itr = compare3.begin(); - while (itr != compare3.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); - data3.clear(); } //************************************************************************* @@ -1164,23 +961,6 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare4.begin(), compare4.end()), data4.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - itr = compare4.begin(); - while (itr != compare4.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); - data4.clear(); } //************************************************************************* @@ -1208,23 +988,6 @@ namespace CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); - - std::forward_list::iterator itr = compare0.begin(); - while (itr != compare0.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - itr = compare1.begin(); - while (itr != compare1.end()) - { - itr->FirstLink::clear(); - ++itr; - } - - data0.clear(); - data1.clear(); } }; } diff --git a/test/test_intrusive_links.cpp b/test/test_intrusive_links.cpp index bb2251cf..9351497b 100644 --- a/test/test_intrusive_links.cpp +++ b/test/test_intrusive_links.cpp @@ -349,7 +349,7 @@ namespace CHECK(data2.SecondFLink::etl_next == &data0); CHECK(data0.SecondFLink::etl_next == nullptr); - // Check checked link. + // Check auto link. etl::link(data0, data1); etl::link(data1, data2); etl::link(data2, data3); @@ -360,11 +360,6 @@ namespace CHECK(data0.ThirdFLinkChecked::etl_next == &data1); CHECK(data1.ThirdFLinkChecked::etl_next == &data3); CHECK(data3.ThirdFLinkChecked::etl_next == nullptr); - - data0.ThirdFLinkChecked::clear(); - data1.ThirdFLinkChecked::clear(); - data2.ThirdFLinkChecked::clear(); - data3.ThirdFLinkChecked::clear(); } //************************************************************************* diff --git a/test/test_variant.cpp b/test/test_variant.cpp index 12967dc7..8583c239 100644 --- a/test/test_variant.cpp +++ b/test/test_variant.cpp @@ -192,6 +192,22 @@ namespace CHECK(variant_2.is_valid()); } + //************************************************************************* + TEST(test_assign_from_variant2) + { + std::string text("Some Text"); + int integer(99); + test_variant_3a variant_1; + test_variant_3a variant_2; + + variant_1 = text; + variant_2 = integer; + variant_2 = variant_1; + + CHECK_EQUAL(text, variant_2.get()); + CHECK(variant_2.is_valid()); + } + //************************************************************************* TEST(test_assignment_incorrect_type_exception) { diff --git a/test/vs2015/etl.vcxproj b/test/vs2015/etl.vcxproj index 87e98819..c671e270 100644 --- a/test/vs2015/etl.vcxproj +++ b/test/vs2015/etl.vcxproj @@ -70,7 +70,7 @@ Level3 Disabled - WIN32;_DEBUG;_CNSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_THROW_EXCEPTIONS;ETL_VERBOSE_ERRORS;ETL_CHECK_PUSH_POP;ETL_PLATFORM_WINDOWS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_THROW_EXCEPTIONS;ETL_VERBOSE_ERRORS;ETL_CHECK_PUSH_POP;%(PreprocessorDefinitions) ../../../unittest-cpp @@ -185,7 +185,6 @@ - @@ -248,7 +247,6 @@ - @@ -359,9 +357,15 @@ - - - + + true + + + true + + + true + diff --git a/test/vs2015/etl.vcxproj.filters b/test/vs2015/etl.vcxproj.filters index e8fbae31..244fdd50 100644 --- a/test/vs2015/etl.vcxproj.filters +++ b/test/vs2015/etl.vcxproj.filters @@ -522,12 +522,6 @@ ETL\Containers - - ETL\Private - - - ETL\Maths -
From 4974d578e0917b7802b5431c18908cfd3d8e6ae3 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:41:08 +0000 Subject: [PATCH 53/93] Removed trailing spaces --- src/type_traits.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/type_traits.h b/src/type_traits.h index 776bfda0..71768f09 100644 --- a/src/type_traits.h +++ b/src/type_traits.h @@ -245,9 +245,9 @@ namespace etl template <> struct make_signed { - typedef typename etl::conditional::type>::type type; }; From 618ca469605fac3814392a7e828f84e6457a4b26 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:41:26 +0000 Subject: [PATCH 54/93] Added comments --- src/utility.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utility.h b/src/utility.h index 1b1c2347..81a27a17 100644 --- a/src/utility.h +++ b/src/utility.h @@ -38,6 +38,9 @@ SOFTWARE. namespace etl { + //*************************************************************************** + /// exchange + //*************************************************************************** template T exchange(T& object, U& new_value) { @@ -46,6 +49,9 @@ namespace etl return old_value; } + //*************************************************************************** + /// exchange (const) + //*************************************************************************** template T exchange(T& object, const U& new_value) { @@ -54,8 +60,11 @@ namespace etl return old_value; } + //*************************************************************************** + /// as_const + //*************************************************************************** template - etl::add_const_t& as_const(T& t) + typename etl::add_const::type& as_const(T& t) { return t; } From 74ee81908af80858c343d2b19842bfa34ea8c557 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:43:03 +0000 Subject: [PATCH 55/93] Added best_fit_int_type Added smallest_int_for_value Added smallest_uint_for_value --- src/smallest.h | 109 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) diff --git a/src/smallest.h b/src/smallest.h index 6419c607..d3a4b947 100644 --- a/src/smallest.h +++ b/src/smallest.h @@ -154,6 +154,48 @@ namespace etl { typedef uint_least64_t type; }; + + //************************************************************************* + // Determine the type to hold the number of bits based on the index. + //************************************************************************* + template + struct best_fit_int_type; + + //************************************************************************* + // Less than or equal to 8 bits. + //************************************************************************* + template <> + struct best_fit_int_type<0> + { + typedef int_least8_t type; + }; + + //************************************************************************* + // 9 to 16 bits. + //************************************************************************* + template <> + struct best_fit_int_type<1> + { + typedef int_least16_t type; + }; + + //************************************************************************* + // 17 to 31 bits. + //************************************************************************* + template <> + struct best_fit_int_type<2> + { + typedef int_least32_t type; + }; + + //************************************************************************* + // Greater than 32 bits. + //************************************************************************* + template <> + struct best_fit_int_type<3> + { + typedef int_least64_t type; + }; } //*************************************************************************** @@ -168,12 +210,77 @@ namespace etl private: // Determines the index of the best unsigned type for the required number of bits. - static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + ((NBITS > 16) ? 1 : 0) + ((NBITS > 32) ? 1 : 0); + static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + ((NBITS > 16) ? 1 : 0) + + ((NBITS > 32) ? 1 : 0); public: typedef typename __private_smallest__::best_fit_uint_type::type type; }; + + //*************************************************************************** + /// Template to determine the smallest signed int type that can contain a + /// value with the specified number of bits. + /// Defines 'type' which is the type of the smallest signed integer. + ///\ingroup smallest + //*************************************************************************** + template + struct smallest_int_for_bits + { + private: + + // Determines the index of the best unsigned type for the required number of bits. + static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + ((NBITS > 16) ? 1 : 0) + + ((NBITS > 32) ? 1 : 0); + + public: + + typedef typename __private_smallest__::best_fit_int_type::type type; + }; + + //*************************************************************************** + /// Template to determine the smallest unsigned int type that can contain the + /// specified unsigned value. + /// Defines 'type' which is the type of the smallest unsigned integer. + ///\ingroup smallest + //*************************************************************************** + template + struct smallest_uint_for_value + { + private: + + // Determines the index of the best unsigned type for the required value. + static const int TYPE_INDEX = ((VALUE > UINT8_MAX) ? 1 : 0) + + ((VALUE > UINT16_MAX) ? 1 : 0) + + ((VALUE > UINT32_MAX) ? 1 : 0); + + public: + + typedef typename __private_smallest__::best_fit_uint_type::type type; + }; + + //*************************************************************************** + /// Template to determine the smallest int type that can contain the + /// specified signed value. + /// Defines 'type' which is the type of the smallest signed integer. + ///\ingroup smallest + //*************************************************************************** + template + struct smallest_int_for_value + { + private: + + // Determines the index of the best signed type for the required value. + static const int TYPE_INDEX = (((VALUE > INT8_MAX) || (VALUE < INT8_MIN)) ? 1 : 0) + + (((VALUE > INT16_MAX) || (VALUE < INT16_MIN)) ? 1 : 0) + + (((VALUE > INT32_MAX) || (VALUE < INT32_MIN)) ? 1 : 0); + + public: + + typedef typename __private_smallest__::best_fit_int_type::type type; + }; } #endif From 65b064a8b76f3d6763cf342fe7148746eb8f4010 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:43:30 +0000 Subject: [PATCH 56/93] Modified debug #defines --- src/optional.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/optional.h b/src/optional.h index 3fb1c47c..7795a8c8 100644 --- a/src/optional.h +++ b/src/optional.h @@ -218,7 +218,7 @@ namespace etl //*************************************************************************** T* operator ->() { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) ETL_ASSERT(valid, ETL_ERROR(optional_invalid)); #endif @@ -230,7 +230,7 @@ namespace etl //*************************************************************************** const T* operator ->() const { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) ETL_ASSERT(valid, ETL_ERROR(optional_invalid)); #endif @@ -242,7 +242,7 @@ namespace etl //*************************************************************************** T& operator *() { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) ETL_ASSERT(valid, ETL_ERROR(optional_invalid)); #endif @@ -254,7 +254,7 @@ namespace etl //*************************************************************************** const T& operator *() const { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) ETL_ASSERT(valid, ETL_ERROR(optional_invalid)); #endif @@ -274,7 +274,7 @@ namespace etl //*************************************************************************** T& value() { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) ETL_ASSERT(valid, ETL_ERROR(optional_invalid)); #endif @@ -286,7 +286,7 @@ namespace etl //*************************************************************************** const T& value() const { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) ETL_ASSERT(valid, ETL_ERROR(optional_invalid)); #endif From b04516d2583c1f7133eb8ecedf0bcacedc129325 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:43:55 +0000 Subject: [PATCH 57/93] Changed uint8_t to value_type --- src/jenkins.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jenkins.h b/src/jenkins.h index 3cffc790..b5e50833 100644 --- a/src/jenkins.h +++ b/src/jenkins.h @@ -65,7 +65,7 @@ namespace etl return 0; } - inline uint32_t add(uint8_t hash, uint8_t value) const + inline uint32_t add(value_type hash, uint8_t value) const { ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); @@ -76,7 +76,7 @@ namespace etl return hash; } - inline uint32_t final(uint8_t hash) + inline uint32_t final(value_type hash) { hash += (hash << 3); hash ^= (hash >> 11); @@ -104,7 +104,7 @@ namespace etl return 0; } - inline uint64_t add(uint8_t hash, uint8_t value) const + inline uint64_t add(value_type hash, uint8_t value) const { ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); @@ -115,7 +115,7 @@ namespace etl return hash; } - inline uint64_t final(uint8_t hash) + inline uint64_t final(value_type hash) { hash += (hash << 3); hash ^= (hash >> 11); From 5a0c830f006eabc0ae1f1e6b562f325718522e25 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:50:57 +0000 Subject: [PATCH 58/93] Modified debug #defines --- src/ivector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ivector.h b/src/ivector.h index 0dfe8491..de7c5cd8 100644 --- a/src/ivector.h +++ b/src/ivector.h @@ -382,7 +382,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(static_cast(count) <= MAX_SIZE, ETL_ERROR(vector_full)); #endif From 77859ad023347741cf40a986da90fdd5339fef52 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:51:19 +0000 Subject: [PATCH 59/93] Modified debug #defines --- src/ipriority_queue.h | 2 +- src/iunordered_map.h | 2 +- src/iunordered_multimap.h | 2 +- src/iunordered_multiset.h | 2 +- src/iunordered_set.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ipriority_queue.h b/src/ipriority_queue.h index 8e58300a..2992acc5 100644 --- a/src/ipriority_queue.h +++ b/src/ipriority_queue.h @@ -167,7 +167,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(priority_queue_iterator)); ETL_ASSERT(static_cast(count) <= max_size(), ETL_ERROR(priority_queue_full)); diff --git a/src/iunordered_map.h b/src/iunordered_map.h index e8447fa6..2c1ff1bb 100644 --- a/src/iunordered_map.h +++ b/src/iunordered_map.h @@ -736,7 +736,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(unordered_map_iterator)); ETL_ASSERT(size_t(count) <= max_size() , ETL_ERROR(unordered_map_full)); diff --git a/src/iunordered_multimap.h b/src/iunordered_multimap.h index 2d2ba701..6b62924a 100644 --- a/src/iunordered_multimap.h +++ b/src/iunordered_multimap.h @@ -630,7 +630,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(unordered_multimap_iterator)); ETL_ASSERT(size_t(count) <= max_size() , ETL_ERROR(unordered_multimap_full)); diff --git a/src/iunordered_multiset.h b/src/iunordered_multiset.h index 995836b5..29a75fc3 100644 --- a/src/iunordered_multiset.h +++ b/src/iunordered_multiset.h @@ -625,7 +625,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(unordered_multiset_iterator)); ETL_ASSERT(size_t(count) <= max_size() , ETL_ERROR(unordered_multiset_full)); diff --git a/src/iunordered_set.h b/src/iunordered_set.h index e11ac9c6..af6c90c8 100644 --- a/src/iunordered_set.h +++ b/src/iunordered_set.h @@ -625,7 +625,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(unordered_set_iterator)); ETL_ASSERT(size_t(count) <= max_size() , ETL_ERROR(unordered_set_full)); From 430248fdf1696c559b871b8a1d773bdcbc3519d7 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:52:06 +0000 Subject: [PATCH 60/93] Removed support for auto and checked links. --- src/intrusive_forward_list.h | 115 +++------ src/intrusive_links.h | 486 ++++++++++++++++------------------- src/intrusive_list.h | 84 ++---- src/intrusive_queue.h | 52 +--- src/intrusive_stack.h | 41 +-- 5 files changed, 302 insertions(+), 476 deletions(-) diff --git a/src/intrusive_forward_list.h b/src/intrusive_forward_list.h index fa275352..8acd26ed 100644 --- a/src/intrusive_forward_list.h +++ b/src/intrusive_forward_list.h @@ -146,13 +146,6 @@ namespace etl typedef const value_type& const_reference; typedef size_t size_type; - enum - { - // The count option is based on the type of link. - COUNT_OPTION = ((TLink::OPTION == etl::link_option::AUTO) || - (TLink::OPTION == etl::link_option::CHECKED)) ? etl::count_option::SLOW_COUNT : etl::count_option::FAST_COUNT - }; - typedef intrusive_forward_list list_type; //************************************************************************* @@ -325,7 +318,7 @@ namespace etl const value_type* p_value; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -421,11 +414,6 @@ namespace etl //************************************************************************* void clear() { - if (TLink::OPTION == etl::link_option::CHECKED) - { - erase_after(before_begin(), end()); - } - initialise(); } @@ -452,7 +440,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(intrusive_forward_list_iterator_exception)); #endif @@ -546,14 +534,11 @@ namespace etl { iterator next(position); ++next; - ++next; - - remove_link_after(*position.p_value); - - //if (TLink::OPTION == etl::link_option::CHECKED) - //{ - // position.p_value->TLink::clear(); - //} + if (next != end()) + { + ++next; + remove_link_after(*position.p_value); + } return next; } @@ -579,14 +564,8 @@ namespace etl // One less. --current_size; - p_next = p_first->etl_next; // Remember the next link. - - if (TLink::OPTION == etl::link_option::CHECKED) - { - p_first->TLink::clear(); // Clear the link. - } - - p_first = p_next; // Move to the next link. + p_next = p_first->etl_next; // Remember the next link. + p_first = p_next; // Move to the next link. } if (p_next == nullptr) @@ -659,7 +638,7 @@ namespace etl if (is_trivial_list()) { - return; + return; } while (true) @@ -698,32 +677,32 @@ namespace etl // Decide whether the next link of merge comes from left or right. if (left_size == 0) { - // Left is empty. The link must come from right. - i_link = i_right; + // Left is empty. The link must come from right. + i_link = i_right; ++i_right; --right_size; - } + } else if (right_size == 0 || i_right == end()) { - // Right is empty. The link must come from left. - i_link = i_left; + // Right is empty. The link must come from left. + i_link = i_left; ++i_left; --left_size; - } + } else if (compare(*i_left, *i_right)) { - // First link of left is lower or same. The link must come from left. - i_link = i_left; + // First link of left is lower or same. The link must come from left. + i_link = i_left; ++i_left; --left_size; - } + } else { - // First link of right is lower. The link must come from right. - i_link = i_right; + // First link of right is lower. The link must come from right. + i_link = i_right; ++i_right; --right_size; - } + } // Add the next link to the merged head. if (i_head == before_begin()) @@ -814,14 +793,7 @@ namespace etl //************************************************************************* size_t size() const { - if (COUNT_OPTION == etl::count_option::SLOW_COUNT) - { - return std::distance(cbegin(), cend()); - } - else - { - return current_size.get_count(); - } + return current_size; } //************************************************************************* @@ -835,14 +807,10 @@ namespace etl if (!other.empty()) { link_type& first = other.get_head(); - other.initialise(); - if (COUNT_OPTION == etl::count_option::FAST_COUNT) + if (&other != this) { - if (&other != this) - { - current_size += other.size(); - } + current_size += other.size(); } link_type& before = *position.p_value; @@ -857,6 +825,8 @@ namespace etl } etl::link(last, after); + + other.initialise(); } } } @@ -871,13 +841,10 @@ namespace etl etl::unlink(*isource.p_value); etl::link_splice(before, *isource.p_value); - if (COUNT_OPTION == etl::count_option::FAST_COUNT) + if (&other != this) { - if (&other != this) - { - ++current_size; - --other.current_size; - } + ++current_size; + --other.current_size; } } @@ -888,14 +855,11 @@ namespace etl { if (!other.empty()) { - if (COUNT_OPTION == etl::count_option::FAST_COUNT) + if (&other != this) { - if (&other != this) - { - size_t n = std::distance(begin_, end_) - 1; - current_size += n; - other.current_size -= n; - } + size_t n = std::distance(begin_, end_) - 1; + current_size += n; + other.current_size -= n; } link_type* first = begin_.p_value; @@ -979,10 +943,7 @@ namespace etl } } - if (COUNT_OPTION == etl::count_option::FAST_COUNT) - { - current_size += other.size(); - } + current_size += other.size(); other.initialise(); } @@ -992,7 +953,7 @@ namespace etl link_type start_link; ///< The link that acts as the intrusive_forward_list start. - counter_type current_size; ///< Counts the number of elements in the list. + size_t current_size; ///< Counts the number of elements in the list. //************************************************************************* /// Is the intrusive_forward_list a trivial length? @@ -1017,7 +978,9 @@ namespace etl //************************************************************************* void remove_link_after(link_type& link) { - if (link.etl_next != nullptr) + link_type* p_next = link.etl_next; + + if (p_next != nullptr) { etl::unlink_after(link); --current_size; diff --git a/src/intrusive_links.h b/src/intrusive_links.h index 823a6dc2..35a8e345 100644 --- a/src/intrusive_links.h +++ b/src/intrusive_links.h @@ -55,25 +55,6 @@ SOFTWARE. namespace etl { - namespace link_option - { - enum - { - DEFAULT, - AUTO, - CHECKED - }; - } - - namespace count_option - { - enum - { - SLOW_COUNT, - FAST_COUNT - }; - } - //*************************************************************************** /// Link exception. //*************************************************************************** @@ -100,25 +81,17 @@ namespace etl } }; - namespace __private_intrusive_links__ + //*************************************************************************** + /// A forward link. + //*************************************************************************** + template + struct forward_link { - //*************************************************************************** - /// A forward link base. - //*************************************************************************** - template - struct forward_link_base - { enum { ID = ID_, - OPTION = OPTION_ }; - forward_link_base() - { - clear(); - } - void clear() { etl_next = nullptr; @@ -129,48 +102,12 @@ namespace etl return etl_next != nullptr; } - TLink* etl_next; - }; - } - - //*************************************************************************** - /// A forward link. - //*************************************************************************** - template - struct forward_link - : public __private_intrusive_links__::forward_link_base, ID_, OPTION_> - { - }; - - //****************************************************************** - // There is no valid specialisation for auto link - //****************************************************************** - template - struct forward_link; - - //****************************************************************** - // Specialisation for checked unlink option. - // An error will be generated if the links are valid when the object - // is destroyed. - //****************************************************************** - template - struct forward_link - : public __private_intrusive_links__::forward_link_base, ID_, etl::link_option::CHECKED> - { - forward_link() - { - this->clear(); - } - - ~forward_link() - { - assert(this->etl_next == nullptr); - } + forward_link* etl_next; }; // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink& rhs) { lhs.etl_next = &rhs; @@ -178,7 +115,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& rhs) { rhs.etl_next = lhs.etl_next; @@ -187,7 +124,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -198,7 +135,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -214,7 +151,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink* rhs) { lhs.etl_next = rhs; @@ -222,7 +159,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink* rhs) { if (rhs != nullptr) @@ -235,7 +172,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -246,7 +183,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -258,7 +195,7 @@ namespace etl // Reference, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& first, TLink& last) { last.etl_next = lhs.etl_next; @@ -267,7 +204,7 @@ namespace etl // Pointer, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& first, TLink& last) { if (lhs != nullptr) @@ -283,55 +220,35 @@ namespace etl // Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink_after(TLink& node) { if (node.etl_next != nullptr) { TLink* unlinked_node = node.etl_next; node.etl_next = unlinked_node->etl_next; - - if ((int(TLink::OPTION) == etl::link_option::AUTO) || - (int(TLink::OPTION) == etl::link_option::CHECKED)) - { - unlinked_node->clear(); - } } } // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink_after(TLink& before, TLink& last) { before.etl_next = last.etl_next; - - if ((int(TLink::OPTION) == etl::link_option::AUTO) || - (int(TLink::OPTION) == etl::link_option::CHECKED)) - { - last.clear(); - } } - namespace __private_intrusive_links__ + //*************************************************************************** + /// A bidirectional link. + //*************************************************************************** + template + struct bidirectional_link { - //*************************************************************************** - /// A bidirectional link base. - //*************************************************************************** - template - struct bidirectional_link_base - { enum { - ID = ID_, - OPTION = OPTION_ + ID = ID_, }; - bidirectional_link_base() - { - clear(); - } - void clear() { etl_previous = nullptr; @@ -348,13 +265,11 @@ namespace etl std::swap(etl_previous, etl_next); } - TLink* etl_previous; - TLink* etl_next; + bidirectional_link* etl_previous; + bidirectional_link* etl_next; - protected: - - void base_unlink() - { + void unlink() + { // Connect the previous link with the next. if (etl_previous != nullptr) { @@ -366,78 +281,12 @@ namespace etl { etl_next->etl_previous = etl_previous; } - } - }; - } - - //*************************************************************************** - /// A bidirectional link. - //*************************************************************************** - template - struct bidirectional_link - : public __private_intrusive_links__::bidirectional_link_base, ID_, OPTION_> - { - void unlink() - { - this->base_unlink(); - } - }; - - //****************************************************************** - // Specialisation for auto unlinked option. - // When this link is destroyed it will automatically unlink itself. - //****************************************************************** - template - struct bidirectional_link - : public __private_intrusive_links__::bidirectional_link_base, ID_, etl::link_option::AUTO> - { - bidirectional_link() - { - this->clear(); - } - - ~bidirectional_link() - { - this->base_unlink(); - } - - void unlink() - { - this->base_unlink(); - this->clear(); - } - }; - - //****************************************************************** - // Specialisation for checked unlink option. - // An error will be generated if the links are valid when the object - // is destroyed. - //****************************************************************** - template - struct bidirectional_link - : public __private_intrusive_links__::bidirectional_link_base, ID_, etl::link_option::CHECKED> - { - bidirectional_link() - { - this->clear(); - } - - ~bidirectional_link() - { - assert(this->etl_previous == nullptr); - assert(this->etl_next == nullptr); - } - - void unlink() - { - this->base_unlink(); - this->clear(); } }; // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink& rhs) { lhs.etl_next = &rhs; @@ -446,7 +295,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& rhs) { rhs.etl_next = lhs.etl_next; @@ -462,7 +311,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -478,7 +327,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink* rhs) { if (rhs != nullptr) @@ -504,7 +353,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink* rhs) { lhs.etl_next = rhs; @@ -517,7 +366,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink* rhs) { if (rhs != nullptr) @@ -536,7 +385,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -549,7 +398,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -572,7 +421,7 @@ namespace etl // Reference, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& first, TLink& last) { last.etl_next = lhs.etl_next; @@ -588,7 +437,7 @@ namespace etl // Pointer, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& first, TLink& last) { if (lhs != nullptr) @@ -615,7 +464,7 @@ namespace etl // Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink(TLink& node) { node.unlink(); @@ -623,7 +472,7 @@ namespace etl // Reference Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink(TLink& first, TLink& last) { if (&first == &last) @@ -641,34 +490,20 @@ namespace etl { first.etl_previous->etl_next = last.etl_next; } - - if ((TLink::OPTION == etl::link_option::AUTO) || - (int(TLink::OPTION) == etl::link_option::CHECKED)) - { - first.etl_previous = nullptr; - last.etl_next = nullptr; - } } } - namespace __private_intrusive_links__ + //*************************************************************************** + /// A binary tree link. + //*************************************************************************** + template + struct tree_link { - //*************************************************************************** - /// A tree link base. - //*************************************************************************** - template - struct tree_link_base - { enum { - ID = ID_, - OPTION = OPTION_ + ID = ID_, }; - tree_link_base() - { - clear(); - } void clear() { etl_parent = nullptr; @@ -681,52 +516,14 @@ namespace etl return (etl_parent != nullptr) || (etl_left != nullptr) || (etl_right != nullptr); } - TLink* etl_parent; - TLink* etl_left; - TLink* etl_right; - }; - } - - //*************************************************************************** - /// A tree link. - //*************************************************************************** - template - struct tree_link - : public __private_intrusive_links__::tree_link_base, ID_, OPTION_> - { - }; - - //****************************************************************** - // There is no valid specialisation for auto link - //****************************************************************** - template - struct tree_link; - - //****************************************************************** - // Specialisation for checked unlink option. - // An error will be generated if the links are valid when the object - // is destroyed. - //****************************************************************** - template - struct tree_link - : public __private_intrusive_links__::tree_link_base, ID_, etl::link_option::CHECKED> - { - tree_link() - { - this->clear(); - } - - ~tree_link() - { - assert(this->etl_parent == nullptr); - assert(this->etl_left == nullptr); - assert(this->etl_right == nullptr); - } + tree_link* etl_parent; + tree_link* etl_left; + tree_link* etl_right; }; // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink& parent, TLink& leaf) { parent.etl_left = &leaf; @@ -734,7 +531,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink& parent, TLink& leaf) { parent.etl_right = &leaf; @@ -743,7 +540,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink* parent, TLink* leaf) { if (parent != nullptr) @@ -758,7 +555,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink* parent, TLink* leaf) { if (parent != nullptr) @@ -774,7 +571,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink& parent, TLink* leaf) { parent.etl_left = leaf; @@ -786,7 +583,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink& parent, TLink* leaf) { parent.etl_right = leaf; @@ -799,7 +596,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -811,7 +608,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -821,6 +618,175 @@ namespace etl leaf.etl_parent = parent; } + + // Reference, Reference + template + typename etl::enable_if >::value, void>::type + link_rotate_left(TLink& parent, TLink& leaf) + { + parent.etl_right = leaf.etl_left; + + if (parent.etl_right != nullptr) + { + parent.etl_right->etl_parent = &parent; + } + + leaf.etl_parent = parent.etl_parent; + parent.etl_parent = &leaf; + leaf.etl_left = &parent; + } + + template + typename etl::enable_if >::value, void>::type + link_rotate_right(TLink& parent, TLink& leaf) + { + parent.etl_left = leaf.etl_right; + + if (parent.etl_left != nullptr) + { + parent.etl_left->etl_parent = &parent; + } + + leaf.etl_parent = parent.etl_parent; + parent.etl_parent = &leaf; + leaf.etl_right = &parent; + } + + // Pointer, Pointer + template + typename etl::enable_if >::value, void>::type + link_rotate_left(TLink* parent, TLink* leaf) + { + if ((parent != nullptr) && (leaf != nullptr)) + { + link_rotate_left(*parent, *leaf); + } + } + + template + typename etl::enable_if >::value, void>::type + link_rotate_right(TLink* parent, TLink* leaf) + { + if ((parent != nullptr) && (leaf != nullptr)) + { + link_rotate_right(*parent, *leaf); + } + } + + // Reference, Pointer + template + typename etl::enable_if >::value, void>::type + link_rotate_left(TLink& parent, TLink* leaf) + { + if (leaf != nullptr) + { + link_rotate_left(parent, *leaf); + } + } + + template + typename etl::enable_if >::value, void>::type + link_rotate_right(TLink& parent, TLink* leaf) + { + if (leaf != nullptr) + { + link_rotate_right(parent, *leaf); + } + } + + // Pointer, Reference + template + typename etl::enable_if >::value, void>::type + link_rotate_left(TLink* parent, TLink& leaf) + { + if (parent != nullptr) + { + link_rotate_left(*parent, leaf); + } + } + + template + typename etl::enable_if >::value, void>::type + link_rotate_right(TLink* parent, TLink& leaf) + { + if (parent != nullptr) + { + link_rotate_right(*parent, leaf); + } + } + + // Reference, Reference + /// Automatically detects whether a left or right rotate is expected. + template + typename etl::enable_if >::value, void>::type + link_rotate(TLink& parent, TLink& leaf) + { + if (parent.etl_left == &leaf) + { + etl::link_rotate_right(parent, leaf); + } + else + { + etl::link_rotate_left(parent, leaf); + } + } + + // Pointer, Pointer + /// Automatically detects whether a left or right rotate is expected. + template + typename etl::enable_if >::value, void>::type + link_rotate(TLink* parent, TLink* leaf) + { + if ((parent != nullptr) && (leaf != nullptr)) + { + if (parent->etl_left == leaf) + { + etl::link_rotate_right(*parent, *leaf); + } + else + { + etl::link_rotate_left(*parent, *leaf); + } + } + } + + // Reference, Pointer + /// Automatically detects whether a left or right rotate is expected. + template + typename etl::enable_if >::value, void>::type + link_rotate(TLink& parent, TLink* leaf) + { + if (leaf != nullptr) + { + if (parent.etl_left == leaf) + { + etl::link_rotate_right(parent, *leaf); + } + else + { + etl::link_rotate_left(parent, *leaf); + } + } + } + + // Pointer, Reference + /// Automatically detects whether a left or right rotate is expected. + template + typename etl::enable_if >::value, void>::type + link_rotate(TLink* parent, TLink& leaf) + { + if (parent != nullptr) + { + if (parent->etl_left == &leaf) + { + etl::link_rotate_right(*parent, leaf); + } + else + { + etl::link_rotate_left(*parent, leaf); + } + } + } } #undef ETL_FILE diff --git a/src/intrusive_list.h b/src/intrusive_list.h index 2da75417..981a8d80 100644 --- a/src/intrusive_list.h +++ b/src/intrusive_list.h @@ -122,13 +122,6 @@ namespace etl { public: - enum - { - // The count option is based on the type of link. - COUNT_OPTION = ((TLink::OPTION == etl::link_option::AUTO) || - (TLink::OPTION == etl::link_option::CHECKED)) ? etl::count_option::SLOW_COUNT : etl::count_option::FAST_COUNT - }; - typedef intrusive_list list_type; // Node typedef. @@ -342,7 +335,7 @@ namespace etl const value_type* p_value; }; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -422,11 +415,6 @@ namespace etl //************************************************************************* void clear() { - if (TLink::OPTION == etl::link_option::CHECKED) - { - erase(begin(), end()); - } - initialise(); } @@ -470,7 +458,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(intrusive_list_iterator_exception)); #endif @@ -492,7 +480,7 @@ namespace etl //************************************************************************* /// Pushes a value to the front of the intrusive_list. //************************************************************************* - void push_front(value_type& value) + void push_front(link_type& value) { insert_link(terminal_link, value); } @@ -596,27 +584,7 @@ namespace etl // Join the ends. etl::link(p_first->etl_previous, p_last); - if (COUNT_OPTION == etl::count_option::FAST_COUNT) - { - current_size -= std::distance(first, last); - } - - if ((TLink::OPTION == etl::link_option::AUTO) || - (TLink::OPTION == etl::link_option::CHECKED)) - { - // Clear the ones in between. - link_type* p_next; - - while (p_first != p_last) - { - // One less. - --current_size; - - p_next = p_first->etl_next; // Remember the next link. - p_first->TLink::clear(); // Clear the link. - p_first = p_next; // Move to the next link. - } - } + current_size -= std::distance(first, last); if (p_last == &terminal_link) { @@ -833,14 +801,7 @@ namespace etl //************************************************************************* size_t size() const { - if (COUNT_OPTION == etl::count_option::SLOW_COUNT) - { - return std::distance(cbegin(), cend()); - } - else - { - return current_size.get_count(); - } + return current_size; } //************************************************************************* @@ -856,12 +817,9 @@ namespace etl link_type& first = *other.get_head(); link_type& last = *other.get_tail(); - if (COUNT_OPTION == etl::count_option::FAST_COUNT) + if (&other != this) { - if (&other != this) - { - current_size += other.size(); - } + current_size += other.size(); } link_type& after = *position.p_value; @@ -885,13 +843,10 @@ namespace etl etl::unlink(*isource.p_value); etl::link_splice(before, *isource.p_value); - if (COUNT_OPTION == etl::count_option::FAST_COUNT) + if (&other != this) { - if (&other != this) - { - ++current_size; - --other.current_size; - } + ++current_size; + --other.current_size; } } @@ -902,14 +857,11 @@ namespace etl { if (!other.empty()) { - if (COUNT_OPTION == etl::count_option::FAST_COUNT) + if (&other != this) { - if (&other != this) - { - size_t n = std::distance(begin_, end_); - current_size += n; - other.current_size -= n; - } + size_t n = std::distance(begin_, end_); + current_size += n; + other.current_size -= n; } link_type& first = *begin_.p_value; @@ -978,11 +930,7 @@ namespace etl etl::link_splice(*get_tail(), *other_begin, *other_end->link_type::etl_previous); } - - if (COUNT_OPTION == etl::count_option::FAST_COUNT) - { - current_size += other.size(); - } + current_size += other.size(); other.initialise(); } @@ -993,7 +941,7 @@ namespace etl /// The link that acts as the intrusive_list start & end. link_type terminal_link; - counter_type current_size; ///< Counts the number of elements in the list. + size_t current_size; ///< Counts the number of elements in the list. //************************************************************************* /// Is the intrusive_list a trivial length? diff --git a/src/intrusive_queue.h b/src/intrusive_queue.h index 69a530d9..efd77e41 100644 --- a/src/intrusive_queue.h +++ b/src/intrusive_queue.h @@ -31,8 +31,6 @@ SOFTWARE. #ifndef __ETL_INTRUSIVE_QUEUE__ #define __ETL_INTRUSIVE_QUEUE__ -#error In Development. Do not use. - #include #include "type_traits.h" @@ -95,20 +93,13 @@ namespace etl typedef const value_type& const_reference; typedef size_t size_type; - enum - { - // The count option is based on the type of link. - COUNT_OPTION = ((TLink::OPTION == etl::link_option::AUTO) || (TLink::OPTION == etl::link_option::CHECKED)) ? - etl::count_option::SLOW_COUNT : - etl::count_option::FAST_COUNT - }; - //************************************************************************* /// Constructor //************************************************************************* intrusive_queue() : p_front(nullptr), - p_back(nullptr) + p_back(nullptr), + current_size(0) { } @@ -158,15 +149,17 @@ namespace etl //************************************************************************* void push(link_type& value) { + value.clear(); + if (p_back != nullptr) { - etl::link(p_front, value); + etl::link(p_back, value); } else - { + { p_front = &value; } - + p_back = &value; ++current_size; @@ -182,13 +175,13 @@ namespace etl ETL_ASSERT(!empty(), ETL_ERROR(intrusive_queue_empty)); #endif link_type* p_next = p_front->etl_next; - p_front->clear(); + p_front = p_next; // Now empty? if (p_front == nullptr) { - p_back == nullptr; + p_back = nullptr; } --current_size; @@ -203,6 +196,7 @@ namespace etl { pop(); } + current_size = 0; } @@ -211,7 +205,7 @@ namespace etl //************************************************************************* bool empty() const { - return p_front == nullptr; + return current_size == 0; } //************************************************************************* @@ -219,27 +213,7 @@ namespace etl //************************************************************************* size_t size() const { - if (COUNT_OPTION == etl::count_option::SLOW_COUNT) - { - size_t count = 0; - - if (p_front != nullptr) - { - link_type* p_link = p_front; - - while (p_link != nullptr) - { - ++count; - p_link = p_link->etl_next; - } - } - - return count; - } - else - { - return current_size.get_count(); - } + return current_size; } private: @@ -251,7 +225,7 @@ namespace etl link_type* p_front; // The current front of the queue. link_type* p_back; // The current back of the queue. - etl::counter_type current_size; ///< Counts the number of elements in the list. + size_t current_size; ///< Counts the number of elements in the list. }; } diff --git a/src/intrusive_stack.h b/src/intrusive_stack.h index 787f2dba..ffa61e72 100644 --- a/src/intrusive_stack.h +++ b/src/intrusive_stack.h @@ -93,19 +93,12 @@ namespace etl typedef const value_type& const_reference; typedef size_t size_type; - enum - { - // The count option is based on the type of link. - COUNT_OPTION = ((TLink::OPTION == etl::link_option::AUTO) || (TLink::OPTION == etl::link_option::CHECKED)) ? - etl::count_option::SLOW_COUNT : - etl::count_option::FAST_COUNT - }; - //************************************************************************* /// Constructor //************************************************************************* intrusive_stack() - : p_top(nullptr) + : p_top(nullptr), + current_size(0) { } @@ -134,6 +127,8 @@ namespace etl //************************************************************************* void push(link_type& value) { + value.clear(); + if (p_top != nullptr) { etl::link(value, p_top); @@ -154,7 +149,6 @@ namespace etl ETL_ASSERT(!empty(), ETL_ERROR(intrusive_stack_empty)); #endif link_type* p_next = p_top->etl_next; - p_top->clear(); p_top = p_next; --current_size; } @@ -168,6 +162,7 @@ namespace etl { pop(); } + current_size = 0; } @@ -176,7 +171,7 @@ namespace etl //************************************************************************* bool empty() const { - return p_top == nullptr; + return current_size == 0; } //************************************************************************* @@ -184,27 +179,7 @@ namespace etl //************************************************************************* size_t size() const { - if (COUNT_OPTION == etl::count_option::SLOW_COUNT) - { - size_t count = 0; - - if (p_top != nullptr) - { - link_type* p_link = p_top; - - while (p_link != nullptr) - { - ++count; - p_link = p_link->etl_next; - } - } - - return count; - } - else - { - return current_size.get_count(); - } + return current_size; } private: @@ -215,7 +190,7 @@ namespace etl link_type* p_top; // The current top of the stack. - etl::counter_type current_size; ///< Counts the number of elements in the list. + size_t current_size; ///< Counts the number of elements in the list. }; } From 4b9e9cd651231a713a03212d75a2c684d8b3b036 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:52:31 +0000 Subject: [PATCH 61/93] Fixed GCC warnings --- src/imultimap.h | 4 ++-- src/imultiset.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/imultimap.h b/src/imultimap.h index f88fd25b..5291177c 100644 --- a/src/imultimap.h +++ b/src/imultimap.h @@ -675,7 +675,7 @@ namespace etl ///\param position The position that would precede the value to insert. ///\param value The value to insert. //********************************************************************* - iterator insert(iterator position, const value_type& value) + iterator insert(iterator /*position*/, const value_type& value) { // Ignore position provided and just do a normal insert return insert(value); @@ -687,7 +687,7 @@ namespace etl ///\param position The position that would precede the value to insert. ///\param value The value to insert. //********************************************************************* - iterator insert(const_iterator position, const value_type& value) + iterator insert(const_iterator /*position*/, const value_type& value) { // Ignore position provided and just do a normal insert return insert(value); diff --git a/src/imultiset.h b/src/imultiset.h index 9f36182c..c0c96840 100644 --- a/src/imultiset.h +++ b/src/imultiset.h @@ -656,7 +656,7 @@ namespace etl ///\param position The position that would precede the value to insert. ///\param value The value to insert. //********************************************************************* - iterator insert(iterator position, const value_type& value) + iterator insert(iterator /*position*/, const value_type& value) { // Ignore position provided and just do a normal insert return insert(value); @@ -668,7 +668,7 @@ namespace etl ///\param position The position that would precede the value to insert. ///\param value The value to insert. //********************************************************************* - iterator insert(const_iterator position, const value_type& value) + iterator insert(const_iterator /*position*/, const value_type& value) { // Ignore position provided and just do a normal insert return insert(value); From 0906d2927896fb4734fa1d217bb92655bbd8d89e Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:52:50 +0000 Subject: [PATCH 62/93] Modified debug #defines --- src/iflat_map.h | 2 +- src/iflat_multimap.h | 2 +- src/iflat_multiset.h | 2 +- src/iflat_set.h | 2 +- src/iforward_list.h | 6 +++--- src/ilist.h | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/iflat_map.h b/src/iflat_map.h index 399897f2..1e50ea1c 100644 --- a/src/iflat_map.h +++ b/src/iflat_map.h @@ -271,7 +271,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count <= difference_type(capacity()), ETL_ERROR(flat_map_full)); #endif diff --git a/src/iflat_multimap.h b/src/iflat_multimap.h index e5fa864e..ed4e75ed 100644 --- a/src/iflat_multimap.h +++ b/src/iflat_multimap.h @@ -222,7 +222,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count <= difference_type(capacity()), ETL_ERROR(flat_multimap_full)); #endif diff --git a/src/iflat_multiset.h b/src/iflat_multiset.h index 135511c0..e06995a4 100644 --- a/src/iflat_multiset.h +++ b/src/iflat_multiset.h @@ -198,7 +198,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count <= difference_type(capacity()), ETL_ERROR(flat_multiset_full)); #endif diff --git a/src/iflat_set.h b/src/iflat_set.h index 55ca571a..be975c69 100644 --- a/src/iflat_set.h +++ b/src/iflat_set.h @@ -198,7 +198,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count <= difference_type(capacity()), ETL_ERROR(flat_set_full)); #endif diff --git a/src/iforward_list.h b/src/iforward_list.h index b663ad8e..e4a7dfb5 100644 --- a/src/iforward_list.h +++ b/src/iforward_list.h @@ -354,7 +354,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(forward_list_iterator)); #endif @@ -512,7 +512,7 @@ namespace etl template void insert_after(iterator position, TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT((count + current_size) <= MAX_SIZE, ETL_ERROR(forward_list_full)); #endif @@ -609,7 +609,7 @@ namespace etl return; // Can't more to before yourself! } -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) // Check that we are not doing an illegal move! for (const_iterator item = first_before; item != last; ++item) { diff --git a/src/ilist.h b/src/ilist.h index 50795bf2..514ffc7a 100644 --- a/src/ilist.h +++ b/src/ilist.h @@ -452,7 +452,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(list_iterator)); ETL_ASSERT(size_t(count) <= MAX_SIZE, ETL_ERROR(list_full)); @@ -475,7 +475,7 @@ namespace etl //************************************************************************* void assign(size_t n, parameter_t value) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) ETL_ASSERT(n <= MAX_SIZE, ETL_ERROR(list_full)); #endif @@ -1062,7 +1062,7 @@ namespace etl return; // Can't more to before yourself! } -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) // Check that we are not doing an illegal move! for (const_iterator item = first; item != last; ++item) { From 6e5ef7b2300fa6942d2686e80797a2ddd8836586 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:53:06 +0000 Subject: [PATCH 63/93] Fixed GCC warnings --- src/ideque.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ideque.h b/src/ideque.h index 6c235183..9afcc3bb 100644 --- a/src/ideque.h +++ b/src/ideque.h @@ -295,7 +295,7 @@ namespace etl //*************************************************** const_iterator& operator ++() { - index = (index == p_deque->BUFFER_SIZE - 1) ? 0 : index + 1; + index = (static_cast(index) == p_deque->BUFFER_SIZE - 1) ? 0 : index + 1; return *this; } @@ -331,7 +331,7 @@ namespace etl if (offset > 0) { index -= offset; - index = (index < 0) ? index + p_deque->BUFFER_SIZE : index; + index = (index < 0) ? static_cast(index) + p_deque->BUFFER_SIZE : index; } else if (offset < 0) { From 388f1c2d436f67fe928603bd38bd7b91bac4ed95 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:53:52 +0000 Subject: [PATCH 64/93] Fixed GCC warnings --- src/container.h | 2 +- src/fixed_iterator.h | 8 ++++---- src/private/set_base.h | 18 +++++++++--------- src/private/string_base.h | 5 ++++- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/container.h b/src/container.h index d03cddc4..1cf87391 100644 --- a/src/container.h +++ b/src/container.h @@ -277,7 +277,7 @@ namespace etl ///\ingroup container ///************************************************************************** template - size_t size(TValue(&data)[ARRAY_SIZE]) + size_t size(TValue(&)[ARRAY_SIZE]) { return ARRAY_SIZE; } diff --git a/src/fixed_iterator.h b/src/fixed_iterator.h index 1b9d1370..8357f30a 100644 --- a/src/fixed_iterator.h +++ b/src/fixed_iterator.h @@ -137,7 +137,7 @@ namespace etl //*************************************************************************** /// += operator. //*************************************************************************** - fixed_iterator& operator +=(typename std::iterator_traits::difference_type offset) + fixed_iterator& operator +=(typename std::iterator_traits::difference_type /*offset*/) { return *this; } @@ -145,7 +145,7 @@ namespace etl //*************************************************************************** /// -= operator. //*************************************************************************** - fixed_iterator& operator -=(typename std::iterator_traits::difference_type offset) + fixed_iterator& operator -=(typename std::iterator_traits::difference_type /*offset*/) { return *this; } @@ -179,7 +179,7 @@ namespace etl //***************************************************************************** template etl::fixed_iterator& operator +(etl::fixed_iterator& lhs, - typename std::iterator_traits::difference_type rhs) + typename std::iterator_traits::difference_type /*rhs*/) { return lhs; } @@ -189,7 +189,7 @@ etl::fixed_iterator& operator +(etl::fixed_iterator& lhs, //***************************************************************************** template etl::fixed_iterator& operator -(etl::fixed_iterator& lhs, - typename std::iterator_traits::difference_type rhs) + typename std::iterator_traits::difference_type /*rhs*/) { return lhs; } diff --git a/src/private/set_base.h b/src/private/set_base.h index b0b85b45..a4eab8c2 100644 --- a/src/private/set_base.h +++ b/src/private/set_base.h @@ -260,12 +260,12 @@ namespace etl while (weight_node) { // Keep going until we reach a terminal node (dir == kNeither) - if (kNeither != weight_node->dir) + if (uint_least8_t(kNeither) != weight_node->dir) { // Does this insert balance the previous weight factor value? if (weight_node->weight == 1 - weight_node->dir) { - weight_node->weight = kNeither; + weight_node->weight = uint_least8_t(kNeither); } else { @@ -283,14 +283,14 @@ namespace etl } // while(weight_node) // Step 2: Update weight for critical_node or rotate tree to balance node - if (kNeither == critical_node->weight) + if (uint_least8_t(kNeither) == critical_node->weight) { critical_node->weight = critical_node->dir; } // If direction is different than weight, then it will now be balanced else if (critical_node->dir != critical_node->weight) { - critical_node->weight = kNeither; + critical_node->weight = uint_least8_t(kNeither); } // Rotate is required to balance the tree at the critical node else @@ -368,11 +368,11 @@ namespace etl // New root now becomes parent of current position new_root->children[1 - dir] = position; // Clear weight factor from current position - position->weight = kNeither; + position->weight = uint_least8_t(kNeither); // Newly detached right now becomes current position position = new_root; // Clear weight factor from new root - position->weight = kNeither; + position->weight = uint_least8_t(kNeither); } //************************************************************************* @@ -395,7 +395,7 @@ namespace etl // Capture new root (either E or D depending on dir) Node* new_root = position->children[dir]->children[1 - dir]; // Set weight factor for B or C based on F or G existing and being a different than dir - position->children[dir]->weight = third != kNeither && third != dir ? dir : kNeither; + position->children[dir]->weight = third != uint_least8_t(kNeither) && third != dir ? dir : uint_least8_t(kNeither); // Detach new root from its tree (replace with new roots child) position->children[dir]->children[1 - dir] = @@ -403,7 +403,7 @@ namespace etl // Attach current left tree to new root new_root->children[dir] = position->children[dir]; // Set weight factor for A based on F or G - position->weight = third != kNeither && third == dir ? 1 - dir : kNeither; + position->weight = third != uint_least8_t(kNeither) && third == dir ? 1 - dir : uint_least8_t(kNeither); // Move new root's right tree to current roots left tree position->children[dir] = new_root->children[1 - dir]; @@ -412,7 +412,7 @@ namespace etl // Replace current position with new root position = new_root; // Clear weight factor for new current position - position->weight = kNeither; + position->weight = uint_least8_t(kNeither); } diff --git a/src/private/string_base.h b/src/private/string_base.h index 7807448f..98f15131 100644 --- a/src/private/string_base.h +++ b/src/private/string_base.h @@ -116,7 +116,10 @@ namespace etl typedef size_t size_type; - static const size_t npos = etl::integral_limits::max; + enum + { + npos = etl::integral_limits::max + }; //************************************************************************* /// Gets the current size of the string. From 3c5f8260c2730eac04bde8d875967a6631a34580 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:54:01 +0000 Subject: [PATCH 65/93] Modified debug #defines --- src/ibasic_string.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ibasic_string.h b/src/ibasic_string.h index 85bd6d9c..a6f3616d 100644 --- a/src/ibasic_string.h +++ b/src/ibasic_string.h @@ -400,7 +400,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(count >= 0, ETL_ERROR(string_iterator)); #endif @@ -893,7 +893,7 @@ namespace etl //********************************************************************* size_t find(const_pointer s, size_t pos = 0) const { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) if ((pos + etl::strlen(s)) > size()) { return npos; @@ -920,7 +920,7 @@ namespace etl //********************************************************************* size_t find(const_pointer s, size_t pos, size_t n) const { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) if ((pos + etl::strlen(s) - n) > size()) { return npos; From 3845ad41d400c4bec0af1a323b1ee7c6832b3603 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:54:33 +0000 Subject: [PATCH 66/93] Modified debug #defines --- src/private/pvoidvector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/private/pvoidvector.h b/src/private/pvoidvector.h index 010b47c0..f44b4bed 100644 --- a/src/private/pvoidvector.h +++ b/src/private/pvoidvector.h @@ -325,7 +325,7 @@ namespace etl template void assign(TIterator first, TIterator last) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DEBUG) difference_type count = std::distance(first, last); ETL_ASSERT(static_cast(count) <= MAX_SIZE, ETL_ERROR(vector_full)); #endif From 7634b5639b80770b69dedf86460ff79c1bb36ab4 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:54:58 +0000 Subject: [PATCH 67/93] Added as_const tests --- test/test_utility.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/test_utility.cpp b/test/test_utility.cpp index fad3bc26..046b12dd 100644 --- a/test/test_utility.cpp +++ b/test/test_utility.cpp @@ -30,6 +30,22 @@ SOFTWARE. #include "../src/utility.h" +namespace +{ + bool nonConstCalled; + bool constCalled; + + void TestText(std::string&) + { + nonConstCalled = true; + } + + void TestText(const std::string&) + { + constCalled = true; + } +} + namespace { SUITE(test_utility) @@ -57,5 +73,27 @@ namespace CHECK_EQUAL(2, b); CHECK_EQUAL(1, c); } + + //========================================================================= + TEST(test_as_const) + { + std::string text = "Hello World!"; + + nonConstCalled = false; + constCalled = false; + + TestText(text); + + CHECK(nonConstCalled); + CHECK(!constCalled); + + nonConstCalled = false; + constCalled = false; + + TestText(etl::as_const(text)); + + CHECK(!nonConstCalled); + CHECK(constCalled); + } }; } From 511c5b88a9c6d1d1196516c43592b92796bdd7e9 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:56:05 +0000 Subject: [PATCH 68/93] Changed "string.h" header to "cstring.h" --- test/test_string_char.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_string_char.cpp b/test/test_string_char.cpp index a715f42c..712a9efc 100644 --- a/test/test_string_char.cpp +++ b/test/test_string_char.cpp @@ -32,7 +32,7 @@ SOFTWARE. #include #include -#include "../src/string.h" +#include "../src/cstring.h" #undef min @@ -969,8 +969,8 @@ namespace Text append(insert_text.c_str()); // Whole string. - compare_text.append(insert_text, 0); - text.append(append, 0); + compare_text.append(insert_text, 0, std::string::npos); + text.append(append, 0, Text::npos); bool is_equal = Equal(compare_text, text); CHECK(is_equal); @@ -2067,7 +2067,7 @@ namespace CHECK_EQUAL(position1, position2); position2 = haystack.find(needle, position2 + 1); - CHECK_EQUAL(etl::istring::npos, position2); + CHECK_EQUAL(etl::string<50>::npos, position2); etl::string<50> pin(STR("pin")); position2 = haystack.find(pin); From 5cab8418339843c125109a68764552f781b50adf Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:56:26 +0000 Subject: [PATCH 69/93] Added tests for new classes --- test/test_smallest.cpp | 149 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 136 insertions(+), 13 deletions(-) diff --git a/test/test_smallest.cpp b/test/test_smallest.cpp index 26beb42c..232119b3 100644 --- a/test/test_smallest.cpp +++ b/test/test_smallest.cpp @@ -79,44 +79,167 @@ namespace } //************************************************************************* - TEST(test_smallest_size_for_bits) + TEST(test_smallest_uint_for_bits) { bool type; - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = std::is_same::type>::value; + CHECK(type); + } + + //************************************************************************* + TEST(test_smallest_int_for_bits) + { + bool type; + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + } + + //************************************************************************* + TEST(test_smallest_uint_for_value) + { + bool type; + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + } + + //************************************************************************* + TEST(test_smallest_int_for_value) + { + bool type; + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; + CHECK(type); + + type = std::is_same::type>::value; CHECK(type); } }; From b038e375cd2a8578eb766b7ae5ab7ce506976a09 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:56:53 +0000 Subject: [PATCH 70/93] Fixed GCC warnings --- test/test_priority_queue.cpp | 4 ++-- test/test_string_u16.cpp | 4 ++-- test/test_string_u32.cpp | 4 ++-- test/test_string_wchar_t.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test_priority_queue.cpp b/test/test_priority_queue.cpp index a911fa1f..f6ca449f 100644 --- a/test/test_priority_queue.cpp +++ b/test/test_priority_queue.cpp @@ -97,7 +97,7 @@ namespace priority_queue.push(2); priority_queue.push(3); - CHECK_EQUAL(3, priority_queue.size()); + CHECK_EQUAL(3U, priority_queue.size()); } //************************************************************************* @@ -108,7 +108,7 @@ namespace priority_queue.push(1); priority_queue.push(2); priority_queue.clear(); - CHECK_EQUAL(0, priority_queue.size()); + CHECK_EQUAL(0U, priority_queue.size()); } //************************************************************************* diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index 07bed379..0fc03b28 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -969,8 +969,8 @@ namespace Text append(insert_text.c_str()); // Whole string. - compare_text.append(insert_text, 0); - text.append(append, 0); + compare_text.append(insert_text, 0, std::u16string::npos); + text.append(append, 0, etl::iu16string::npos); bool is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index abd21bfc..366ee2aa 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -969,8 +969,8 @@ namespace Text append(insert_text.c_str()); // Whole string. - compare_text.append(insert_text, 0); - text.append(append, 0); + compare_text.append(insert_text, 0, std::u32string::npos); + text.append(append, 0, etl::iu32string::npos); bool is_equal = Equal(compare_text, text); CHECK(is_equal); diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index bd32385b..e60ab97b 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -969,8 +969,8 @@ namespace Text append(insert_text.c_str()); // Whole string. - compare_text.append(insert_text, 0); - text.append(append, 0); + compare_text.append(insert_text, 0, std::wstring::npos); + text.append(append, 0, etl::iwstring::npos); bool is_equal = Equal(compare_text, text); CHECK(is_equal); From dd60c3aa7c539ac856a50965bb73c1538ccd6447 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:57:04 +0000 Subject: [PATCH 71/93] Fixed GCC warnings --- test/test_unordered_map.cpp | 6 +++--- test/test_unordered_multimap.cpp | 10 +++++----- test/test_unordered_multiset.cpp | 10 +++++----- test/test_unordered_set.cpp | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/test_unordered_map.cpp b/test/test_unordered_map.cpp index 3d19f4f5..9f33b8d7 100644 --- a/test/test_unordered_map.cpp +++ b/test/test_unordered_map.cpp @@ -431,7 +431,7 @@ namespace size_t count = data.erase(K5); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); DataNDC::iterator idata = data.find(K5); CHECK(idata == data.end()); @@ -511,10 +511,10 @@ namespace DataNDC data(initial_data.begin(), initial_data.end()); size_t count = data.count(K5); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); count = data.count(K12); - CHECK_EQUAL(0, count); + CHECK_EQUAL(0U, count); } //************************************************************************* diff --git a/test/test_unordered_multimap.cpp b/test/test_unordered_multimap.cpp index d5ca8aa6..fe595ad4 100644 --- a/test/test_unordered_multimap.cpp +++ b/test/test_unordered_multimap.cpp @@ -369,14 +369,14 @@ namespace size_t count = data.erase(K10); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); DataNDC::iterator idata = data.find(K10); CHECK(idata == data.end()); count = data.erase(K11); - CHECK_EQUAL(3, count); + CHECK_EQUAL(3U, count); idata = data.find(K11); CHECK(idata == data.end()); @@ -456,13 +456,13 @@ namespace DataNDC data(equal_data.begin(), equal_data.end()); size_t count = data.count(K10); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); count = data.count(K11); - CHECK_EQUAL(3, count); + CHECK_EQUAL(3U, count); count = data.count(K1); - CHECK_EQUAL(0, count); + CHECK_EQUAL(0U, count); } //************************************************************************* diff --git a/test/test_unordered_multiset.cpp b/test/test_unordered_multiset.cpp index 0edf7a86..1800db01 100644 --- a/test/test_unordered_multiset.cpp +++ b/test/test_unordered_multiset.cpp @@ -294,14 +294,14 @@ namespace size_t count = data.erase(N0); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); DataNDC::iterator idata = data.find(N0); CHECK(idata == data.end()); count = data.erase(N1); - CHECK_EQUAL(3, count); + CHECK_EQUAL(3U, count); idata = data.find(N1); CHECK(idata == data.end()); @@ -386,13 +386,13 @@ namespace DataNDC data(equal_data.begin(), equal_data.end()); size_t count = data.count(N0); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); count = data.count(N1); - CHECK_EQUAL(3, count); + CHECK_EQUAL(3U, count); count = data.count(N10); - CHECK_EQUAL(0, count); + CHECK_EQUAL(0U, count); } //************************************************************************* diff --git a/test/test_unordered_set.cpp b/test/test_unordered_set.cpp index 1436c177..919a06f7 100644 --- a/test/test_unordered_set.cpp +++ b/test/test_unordered_set.cpp @@ -281,7 +281,7 @@ namespace size_t count = data.erase(N5); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); DataNDC::iterator idata = data.find(N5); CHECK(idata == data.end()); @@ -366,10 +366,10 @@ namespace DataNDC data(initial_data.begin(), initial_data.end()); size_t count = data.count(N5); - CHECK_EQUAL(1, count); + CHECK_EQUAL(1U, count); count = data.count(N12); - CHECK_EQUAL(0, count); + CHECK_EQUAL(0U, count); } //************************************************************************* From 62d03d7e104ea143c29c8331e2ec107f89943cf6 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:57:47 +0000 Subject: [PATCH 72/93] Changed tests for wchar_t. --- test/test_type_traits.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index 207fc468..db654ad6 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -425,7 +425,7 @@ namespace CHECK((std::is_same::type, std::make_signed::type>::value)); CHECK((std::is_same::type, std::make_signed::type>::value)); CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); + CHECK(std::is_signed::type>::value && (sizeof(wchar_t) == sizeof(etl::make_signed::type))); CHECK((std::is_same::type, std::make_signed::type>::value)); CHECK((std::is_same::type, std::make_signed::type>::value)); CHECK((std::is_same::type, std::make_signed::type>::value)); @@ -450,7 +450,7 @@ namespace CHECK((std::is_same::type, std::make_unsigned::type>::value)); CHECK((std::is_same::type, std::make_unsigned::type>::value)); CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); + CHECK(std::is_unsigned::type>::value && (sizeof(wchar_t) == sizeof(etl::make_unsigned::type))); CHECK((std::is_same::type, std::make_unsigned::type>::value)); CHECK((std::is_same::type, std::make_unsigned::type>::value)); CHECK((std::is_same::type, std::make_unsigned::type>::value)); From 1aa2592691863b9b89185ca9253403f81cff11fb Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:57:57 +0000 Subject: [PATCH 73/93] Fixed GCC warnings --- test/test_type_def.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_type_def.cpp b/test/test_type_def.cpp index c921293a..9d851909 100644 --- a/test/test_type_def.cpp +++ b/test/test_type_def.cpp @@ -116,7 +116,7 @@ namespace CHECK_EQUAL(i %= 23, t %= 23); t = type_t(0x1234); - CHECK_EQUAL(0x1234, t); + CHECK_EQUAL(0x1234U, t); } //========================================================================= From fbf7eaf085ba8df97b901090f073a94d52098757 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 12:58:09 +0000 Subject: [PATCH 74/93] Fixed GCC warnings --- test/test_pool.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_pool.cpp b/test/test_pool.cpp index afbbbff2..165c110e 100644 --- a/test/test_pool.cpp +++ b/test/test_pool.cpp @@ -36,6 +36,11 @@ SOFTWARE. #include "../src/pool.h" +#if defined(ETL_COMPILER_GCC) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif + typedef TestDataDC Test_Data; typedef TestDataNDC Test_Data2; @@ -145,7 +150,7 @@ namespace TEST(test_available) { etl::pool pool; - CHECK_EQUAL(4, pool.available()); + CHECK_EQUAL(4U, pool.available()); Test_Data* p; @@ -385,3 +390,7 @@ namespace } }; } + +#if defined(ETL_COMPILER_GCC) + #pragma GCC diagnostic pop +#endif From 0fb7a0e458547fc2d22d1174caf048532f69bc41 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:11:29 +0000 Subject: [PATCH 75/93] Fixed GCC warnings --- test/test_list.cpp | 4 +- test/test_maths.cpp | 120 ++++++++++++++++++++--------------------- test/test_observer.cpp | 12 ++--- test/test_optional.cpp | 2 +- 4 files changed, 69 insertions(+), 69 deletions(-) diff --git a/test/test_list.cpp b/test/test_list.cpp index 217e5ddc..77ca4200 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -270,7 +270,7 @@ namespace DataNDC data(sorted_data.begin(), sorted_data.end()); data.clear(); - CHECK_EQUAL(data.size(), 0); + CHECK_EQUAL(0U, data.size()); } //************************************************************************* @@ -678,7 +678,7 @@ namespace // Check that it is still in a valid state. data.push_back(ItemNDC("1")); CHECK(!data.empty()); - CHECK_EQUAL(1, data.size()); + CHECK_EQUAL(1U, data.size()); } //************************************************************************* diff --git a/test/test_maths.cpp b/test/test_maths.cpp index 2a4ac523..47f98fc3 100644 --- a/test/test_maths.cpp +++ b/test/test_maths.cpp @@ -281,71 +281,71 @@ namespace //************************************************************************* TEST(test_fibbonacci) { - CHECK_EQUAL(0, (size_t)etl::fibonacci<0>::value); - CHECK_EQUAL(1, (size_t)etl::fibonacci<1>::value); - CHECK_EQUAL(1, (size_t)etl::fibonacci<2>::value); - CHECK_EQUAL(2, (size_t)etl::fibonacci<3>::value); - CHECK_EQUAL(3, (size_t)etl::fibonacci<4>::value); - CHECK_EQUAL(5, (size_t)etl::fibonacci<5>::value); - CHECK_EQUAL(8, (size_t)etl::fibonacci<6>::value); - CHECK_EQUAL(13, (size_t)etl::fibonacci<7>::value); - CHECK_EQUAL(21, (size_t)etl::fibonacci<8>::value); - CHECK_EQUAL(34, (size_t)etl::fibonacci<9>::value); - CHECK_EQUAL(55, (size_t)etl::fibonacci<10>::value); - CHECK_EQUAL(89, (size_t)etl::fibonacci<11>::value); - CHECK_EQUAL(144, (size_t)etl::fibonacci<12>::value); - CHECK_EQUAL(233, (size_t)etl::fibonacci<13>::value); - CHECK_EQUAL(377, (size_t)etl::fibonacci<14>::value); - CHECK_EQUAL(610, (size_t)etl::fibonacci<15>::value); - CHECK_EQUAL(987, (size_t)etl::fibonacci<16>::value); - CHECK_EQUAL(1597, (size_t)etl::fibonacci<17>::value); - CHECK_EQUAL(2584, (size_t)etl::fibonacci<18>::value); - CHECK_EQUAL(4181, (size_t)etl::fibonacci<19>::value); - CHECK_EQUAL(6765, (size_t)etl::fibonacci<20>::value); - CHECK_EQUAL(10946, (size_t)etl::fibonacci<21>::value); - CHECK_EQUAL(17711, (size_t)etl::fibonacci<22>::value); - CHECK_EQUAL(28657, (size_t)etl::fibonacci<23>::value); - CHECK_EQUAL(46368, (size_t)etl::fibonacci<24>::value); - CHECK_EQUAL(75025, (size_t)etl::fibonacci<25>::value); - CHECK_EQUAL(121393, (size_t)etl::fibonacci<26>::value); - CHECK_EQUAL(196418, (size_t)etl::fibonacci<27>::value); - CHECK_EQUAL(317811, (size_t)etl::fibonacci<28>::value); - CHECK_EQUAL(514229, (size_t)etl::fibonacci<29>::value); - CHECK_EQUAL(832040, (size_t)etl::fibonacci<30>::value); - CHECK_EQUAL(1346269, (size_t)etl::fibonacci<31>::value); - CHECK_EQUAL(2178309, (size_t)etl::fibonacci<32>::value); - CHECK_EQUAL(3524578, (size_t)etl::fibonacci<33>::value); - CHECK_EQUAL(5702887, (size_t)etl::fibonacci<34>::value); - CHECK_EQUAL(9227465, (size_t)etl::fibonacci<35>::value); - CHECK_EQUAL(14930352, (size_t)etl::fibonacci<36>::value); - CHECK_EQUAL(24157817, (size_t)etl::fibonacci<37>::value); - CHECK_EQUAL(39088169, (size_t)etl::fibonacci<38>::value); - CHECK_EQUAL(63245986, (size_t)etl::fibonacci<39>::value); - CHECK_EQUAL(102334155, (size_t)etl::fibonacci<40>::value); - CHECK_EQUAL(165580141, (size_t)etl::fibonacci<41>::value); - CHECK_EQUAL(267914296, (size_t)etl::fibonacci<42>::value); - CHECK_EQUAL(433494437, (size_t)etl::fibonacci<43>::value); - CHECK_EQUAL(701408733, (size_t)etl::fibonacci<44>::value); - CHECK_EQUAL(1134903170, (size_t)etl::fibonacci<45>::value); - CHECK_EQUAL(1836311903, (size_t)etl::fibonacci<46>::value); + CHECK_EQUAL(0U, (size_t)etl::fibonacci<0>::value); + CHECK_EQUAL(1U, (size_t)etl::fibonacci<1>::value); + CHECK_EQUAL(1U, (size_t)etl::fibonacci<2>::value); + CHECK_EQUAL(2U, (size_t)etl::fibonacci<3>::value); + CHECK_EQUAL(3U, (size_t)etl::fibonacci<4>::value); + CHECK_EQUAL(5U, (size_t)etl::fibonacci<5>::value); + CHECK_EQUAL(8U, (size_t)etl::fibonacci<6>::value); + CHECK_EQUAL(13U, (size_t)etl::fibonacci<7>::value); + CHECK_EQUAL(21U, (size_t)etl::fibonacci<8>::value); + CHECK_EQUAL(34U, (size_t)etl::fibonacci<9>::value); + CHECK_EQUAL(55U, (size_t)etl::fibonacci<10>::value); + CHECK_EQUAL(89U, (size_t)etl::fibonacci<11>::value); + CHECK_EQUAL(144U, (size_t)etl::fibonacci<12>::value); + CHECK_EQUAL(233U, (size_t)etl::fibonacci<13>::value); + CHECK_EQUAL(377U, (size_t)etl::fibonacci<14>::value); + CHECK_EQUAL(610U, (size_t)etl::fibonacci<15>::value); + CHECK_EQUAL(987U, (size_t)etl::fibonacci<16>::value); + CHECK_EQUAL(1597U, (size_t)etl::fibonacci<17>::value); + CHECK_EQUAL(2584U, (size_t)etl::fibonacci<18>::value); + CHECK_EQUAL(4181U, (size_t)etl::fibonacci<19>::value); + CHECK_EQUAL(6765U, (size_t)etl::fibonacci<20>::value); + CHECK_EQUAL(10946U, (size_t)etl::fibonacci<21>::value); + CHECK_EQUAL(17711U, (size_t)etl::fibonacci<22>::value); + CHECK_EQUAL(28657U, (size_t)etl::fibonacci<23>::value); + CHECK_EQUAL(46368U, (size_t)etl::fibonacci<24>::value); + CHECK_EQUAL(75025U, (size_t)etl::fibonacci<25>::value); + CHECK_EQUAL(121393U, (size_t)etl::fibonacci<26>::value); + CHECK_EQUAL(196418U, (size_t)etl::fibonacci<27>::value); + CHECK_EQUAL(317811U, (size_t)etl::fibonacci<28>::value); + CHECK_EQUAL(514229U, (size_t)etl::fibonacci<29>::value); + CHECK_EQUAL(832040U, (size_t)etl::fibonacci<30>::value); + CHECK_EQUAL(1346269U, (size_t)etl::fibonacci<31>::value); + CHECK_EQUAL(2178309U, (size_t)etl::fibonacci<32>::value); + CHECK_EQUAL(3524578U, (size_t)etl::fibonacci<33>::value); + CHECK_EQUAL(5702887U, (size_t)etl::fibonacci<34>::value); + CHECK_EQUAL(9227465U, (size_t)etl::fibonacci<35>::value); + CHECK_EQUAL(14930352U, (size_t)etl::fibonacci<36>::value); + CHECK_EQUAL(24157817U, (size_t)etl::fibonacci<37>::value); + CHECK_EQUAL(39088169U, (size_t)etl::fibonacci<38>::value); + CHECK_EQUAL(63245986U, (size_t)etl::fibonacci<39>::value); + CHECK_EQUAL(102334155U, (size_t)etl::fibonacci<40>::value); + CHECK_EQUAL(165580141U, (size_t)etl::fibonacci<41>::value); + CHECK_EQUAL(267914296U, (size_t)etl::fibonacci<42>::value); + CHECK_EQUAL(433494437U, (size_t)etl::fibonacci<43>::value); + CHECK_EQUAL(701408733U, (size_t)etl::fibonacci<44>::value); + CHECK_EQUAL(1134903170U, (size_t)etl::fibonacci<45>::value); + CHECK_EQUAL(1836311903U, (size_t)etl::fibonacci<46>::value); CHECK_EQUAL(2971215073U, (size_t)etl::fibonacci<47>::value); } TEST(test_factorial) { - CHECK_EQUAL(1, (size_t)etl::factorial<0>::value); - CHECK_EQUAL(1, (size_t)etl::factorial<1>::value); - CHECK_EQUAL(2, (size_t)etl::factorial<2>::value); - CHECK_EQUAL(6, (size_t)etl::factorial<3>::value); - CHECK_EQUAL(24, (size_t)etl::factorial<4>::value); - CHECK_EQUAL(120, (size_t)etl::factorial<5>::value); - CHECK_EQUAL(720, (size_t)etl::factorial<6>::value); - CHECK_EQUAL(5040, (size_t)etl::factorial<7>::value); - CHECK_EQUAL(40320, (size_t)etl::factorial<8>::value); - CHECK_EQUAL(362880, (size_t)etl::factorial<9>::value); - CHECK_EQUAL(3628800, (size_t)etl::factorial<10>::value); - CHECK_EQUAL(39916800, (size_t)etl::factorial<11>::value); - CHECK_EQUAL(479001600, (size_t)etl::factorial<12>::value); + CHECK_EQUAL(1U, (size_t)etl::factorial<0>::value); + CHECK_EQUAL(1U, (size_t)etl::factorial<1>::value); + CHECK_EQUAL(2U, (size_t)etl::factorial<2>::value); + CHECK_EQUAL(6U, (size_t)etl::factorial<3>::value); + CHECK_EQUAL(24U, (size_t)etl::factorial<4>::value); + CHECK_EQUAL(120U, (size_t)etl::factorial<5>::value); + CHECK_EQUAL(720U, (size_t)etl::factorial<6>::value); + CHECK_EQUAL(5040U, (size_t)etl::factorial<7>::value); + CHECK_EQUAL(40320U, (size_t)etl::factorial<8>::value); + CHECK_EQUAL(362880U, (size_t)etl::factorial<9>::value); + CHECK_EQUAL(3628800U, (size_t)etl::factorial<10>::value); + CHECK_EQUAL(39916800U, (size_t)etl::factorial<11>::value); + CHECK_EQUAL(479001600U, (size_t)etl::factorial<12>::value); } }; } diff --git a/test/test_observer.cpp b/test/test_observer.cpp index a59e2a56..1c6853ad 100644 --- a/test/test_observer.cpp +++ b/test/test_observer.cpp @@ -125,7 +125,7 @@ public: //******************************************* // Notification1 is passed by value. //******************************************* - void notification(Notification1 data1) + void notification(Notification1 /*data1*/) { ++data1_count; } @@ -133,7 +133,7 @@ public: //******************************************* // Notification2 is passed by reference. //******************************************* - void notification(Notification2& data2) + void notification(Notification2& /*data2*/) { ++data2_count; } @@ -141,7 +141,7 @@ public: //******************************************* // Notification3 is passed by const reference. //******************************************* - void notification(const Notification3& data3) + void notification(const Notification3& /*data3*/) { ++data3_count; } @@ -170,7 +170,7 @@ public: //******************************************* // Notification1 is passed by value. //******************************************* - void notification(Notification1 data1) + void notification(Notification1 /*data1*/) { ++data1_count; } @@ -178,7 +178,7 @@ public: //******************************************* // Notification2 is passed by reference. //******************************************* - void notification(Notification2& data2) + void notification(Notification2& /*data2*/) { ++data2_count; } @@ -186,7 +186,7 @@ public: //******************************************* // Notification3 is passed by const reference. //******************************************* - void notification(const Notification3& data3) + void notification(const Notification3& /*data3*/) { ++data3_count; } diff --git a/test/test_optional.cpp b/test/test_optional.cpp index 222698c5..47b821e2 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -184,7 +184,7 @@ namespace CHECK(bool(container)); container.value().resize(5, Data("1")); - CHECK_EQUAL(5, container.value().size()); + CHECK_EQUAL(5U, container.value().size()); CHECK_EQUAL(Data("1"), container.value()[0]); CHECK_EQUAL(Data("1"), container.value()[1]); From d4a1c8a3808800d8d85d198e8c98fdeb24cbe30a Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:12:09 +0000 Subject: [PATCH 76/93] Changed Jenkins template class to individual 32 & 64 bit versions. --- test/test_jenkins.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/test/test_jenkins.cpp b/test/test_jenkins.cpp index 3bef5bf2..47b59b39 100644 --- a/test/test_jenkins.cpp +++ b/test/test_jenkins.cpp @@ -85,7 +85,7 @@ namespace { std::string data("123456789"); - uint32_t hash = etl::jenkins(data.begin(), data.end()); + uint32_t hash = etl::jenkins32(data.begin(), data.end()); uint32_t compare = jenkins32(data.begin(), data.end()); CHECK_EQUAL(compare, hash); @@ -96,7 +96,7 @@ namespace { std::string data("123456789"); - etl::jenkins jenkins_32_calculator; + etl::jenkins32 jenkins_32_calculator; for (size_t i = 0; i < data.size(); ++i) { @@ -114,7 +114,7 @@ namespace { std::string data("123456789"); - etl::jenkins jenkins_32_calculator; + etl::jenkins32 jenkins_32_calculator; jenkins_32_calculator.add(data.begin(), data.end()); @@ -132,9 +132,9 @@ namespace std::vector data2 = { 0x04030201, 0x08070605 }; std::vector data3 = { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 }; - uint32_t hash1 = etl::jenkins(data1.begin(), data1.end()); - uint32_t hash2 = etl::jenkins((uint8_t*)&data2[0], (uint8_t*)&data2[0] + (data2.size() * sizeof(uint32_t))); - uint32_t hash3 = etl::jenkins(data3.rbegin(), data3.rend()); + uint32_t hash1 = etl::jenkins32(data1.begin(), data1.end()); + uint32_t hash2 = etl::jenkins32((uint8_t*)&data2[0], (uint8_t*)&data2[0] + (data2.size() * sizeof(uint32_t))); + uint32_t hash3 = etl::jenkins32(data3.rbegin(), data3.rend()); CHECK_EQUAL(hash1, hash2); CHECK_EQUAL(hash1, hash3); @@ -146,7 +146,7 @@ namespace CHECK_EQUAL(compare2, hash2); uint64_t compare3 = jenkins32(data3.rbegin(), data3.rend()); - CHECK_EQUAL(compare2, hash3); + CHECK_EQUAL(compare3, hash3); } //************************************************************************* @@ -154,9 +154,10 @@ namespace { std::string data("123456789"); - etl::jenkins j32; + etl::jenkins32 j32; j32.add(data.begin(), data.end()); - uint32_t hash = j32; + + j32.value(); CHECK_THROW(j32.add(0), etl::hash_finalised); } @@ -166,7 +167,7 @@ namespace { std::string data("123456789"); - uint64_t hash = etl::jenkins(data.begin(), data.end()); + uint64_t hash = etl::jenkins64(data.begin(), data.end()); uint64_t compare = jenkins64(data.begin(), data.end()); CHECK_EQUAL(compare, hash); @@ -177,7 +178,7 @@ namespace { std::string data("123456789"); - etl::jenkins jenkins_64_calculator; + etl::jenkins64 jenkins_64_calculator; for (size_t i = 0; i < data.size(); ++i) { @@ -195,7 +196,7 @@ namespace { std::string data("123456789"); - etl::jenkins jenkins_64_calculator; + etl::jenkins64 jenkins_64_calculator; jenkins_64_calculator.add(data.begin(), data.end()); @@ -213,9 +214,9 @@ namespace std::vector data2 = { 0x04030201, 0x08070605 }; std::vector data3 = { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 }; - uint64_t hash1 = etl::jenkins(data1.begin(), data1.end()); - uint64_t hash2 = etl::jenkins((uint8_t*)&data2[0], (uint8_t*)&data2[0] + (data2.size() * sizeof(uint32_t))); - uint64_t hash3 = etl::jenkins(data3.rbegin(), data3.rend()); + uint64_t hash1 = etl::jenkins64(data1.begin(), data1.end()); + uint64_t hash2 = etl::jenkins64((uint8_t*)&data2[0], (uint8_t*)&data2[0] + (data2.size() * sizeof(uint32_t))); + uint64_t hash3 = etl::jenkins64(data3.rbegin(), data3.rend()); CHECK_EQUAL(hash1, hash2); CHECK_EQUAL(hash1, hash3); @@ -226,7 +227,7 @@ namespace CHECK_EQUAL(compare2, hash2); uint64_t compare3 = jenkins64(data3.rbegin(), data3.rend()); - CHECK_EQUAL(compare2, hash3); + CHECK_EQUAL(compare3, hash3); } }; } From b4f0855410132d39eaa7c28fa4a4ec5aa2c7d7a2 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:12:22 +0000 Subject: [PATCH 77/93] Fixed GCC warnings --- test/test_io_port.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_io_port.cpp b/test/test_io_port.cpp index 62487683..656ce1a3 100644 --- a/test/test_io_port.cpp +++ b/test/test_io_port.cpp @@ -32,7 +32,12 @@ SOFTWARE. #include -#pragma warning(disable:4101) // Unused variable. +#if defined(ETL_COMPILER_GCC) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-variable" +#else + #pragma warning(disable:4101) // Unused variable. +#endif template struct serial_port @@ -113,3 +118,7 @@ namespace } }; } + +#if defined(ETL_COMPILER_GCC) + #pragma GCC diagnostic pop +#endif From 093b29a48c99f87b8df0fca3534794d48ce50fe7 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:12:37 +0000 Subject: [PATCH 78/93] Removed support for auto and checked links. --- test/test_intrusive_forward_list.cpp | 278 +++-- test/test_intrusive_links.cpp | 1514 ++++++++++++++------------ test/test_intrusive_list.cpp | 102 +- test/test_intrusive_stack.cpp | 72 +- 4 files changed, 1003 insertions(+), 963 deletions(-) diff --git a/test/test_intrusive_forward_list.cpp b/test/test_intrusive_forward_list.cpp index 46ce13b7..4c962b37 100644 --- a/test/test_intrusive_forward_list.cpp +++ b/test/test_intrusive_forward_list.cpp @@ -45,8 +45,8 @@ typedef TestDataNDC ItemNDC; namespace { - typedef etl::forward_link<0, etl::link_option::CHECKED> FirstLink; - typedef etl::forward_link<1> SecondLink; + typedef etl::forward_link<0> FirstLink; + typedef etl::bidirectional_link<1> SecondLink; //*************************************************************************** class ItemDCNode : public FirstLink, public SecondLink @@ -259,12 +259,6 @@ namespace ////************************************************************************* TEST_FIXTURE(SetupFixture, test_two_lists_different) { - std::list compare0; - std::list compare1; - - DataNDC0 data0; - DataNDC1 data1; - ItemNDCNode node0("0"); ItemNDCNode node1("1"); ItemNDCNode node2("2"); @@ -274,43 +268,51 @@ namespace ItemNDCNode node6("6"); ItemNDCNode node7("7"); - compare0.push_front(node0); - compare0.push_front(node1); - compare0.push_front(node2); - compare0.push_front(node4); - compare0.push_front(node6); - compare0.push_front(node7); - - data0.push_front(node0); - data0.push_front(node1); - data0.push_front(node2); - data0.push_front(node4); - data0.push_front(node6); - data0.push_front(node7); + { + std::list compare0; + std::list compare1; - are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); - CHECK(are_equal); - CHECK_EQUAL(6, data0.size()); - CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + DataNDC0 data0; + DataNDC1 data1; - compare1.push_front(node0); - compare1.push_front(node1); - compare1.push_front(node3); - compare1.push_front(node4); - compare1.push_front(node5); - compare1.push_front(node7); + compare0.push_front(node0); + compare0.push_front(node1); + compare0.push_front(node2); + compare0.push_front(node4); + compare0.push_front(node6); + compare0.push_front(node7); - data1.push_front(node0); - data1.push_front(node1); - data1.push_front(node3); - data1.push_front(node4); - data1.push_front(node5); - data1.push_front(node7); + compare1.push_front(node0); + compare1.push_front(node1); + compare1.push_front(node3); + compare1.push_front(node4); + compare1.push_front(node5); + compare1.push_front(node7); - are_equal = std::equal(data1.begin(), data1.end(), compare1.begin()); - CHECK(are_equal); - CHECK_EQUAL(6, data1.size()); - CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); + data0.push_front(node0); + data0.push_front(node1); + data0.push_front(node2); + data0.push_front(node4); + data0.push_front(node6); + data0.push_front(node7); + + are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); + CHECK(are_equal); + CHECK_EQUAL(6U, data0.size()); + CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + + data1.push_front(node0); + data1.push_front(node1); + data1.push_front(node3); + data1.push_front(node4); + data1.push_front(node5); + data1.push_front(node7); + + are_equal = std::equal(data1.begin(), data1.end(), compare1.begin()); + CHECK(are_equal); + CHECK_EQUAL(6U, data1.size()); + CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); + } } //************************************************************************* @@ -336,13 +338,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); offset = 0; @@ -352,22 +354,18 @@ namespace i_compare_data = compare_data.begin(); std::advance(i_compare_data, offset); - std::forward_list temp(data0.begin(), data0.end()); - data0.insert_after(i_data, INSERT_VALUE2); compare_data.insert_after(i_compare_data, INSERT_VALUE2); - temp.assign(data0.begin(), data0.end()); - are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -389,7 +387,7 @@ namespace are_equal = std::equal(data1.begin(), data1.end(), test1.begin()); CHECK(are_equal); CHECK_EQUAL(test1.size(), data1.size()); - CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(test1.size(), size_t(std::distance(data1.begin(), data1.end()))); compare.assign(test1.begin(), test1.end()); data0.assign(test1.begin(), test1.end()); @@ -411,15 +409,12 @@ namespace are_equal = std::equal(data1.begin(), data1.end(), test1.begin()); CHECK(are_equal); CHECK_EQUAL(test1.size(), data1.size()); - CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(test1.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_front) { - std::list compare_data; - DataNDC0 data0; - ItemNDCNode node1("1"); ItemNDCNode node2("2"); ItemNDCNode node3("3"); @@ -427,32 +422,34 @@ namespace ItemNDCNode node5("5"); ItemNDCNode node6("6"); - compare_data.push_front(node1); - compare_data.push_front(node2); - compare_data.push_front(node3); - compare_data.push_front(node4); - compare_data.push_front(node5); - compare_data.push_front(node6); + { + std::list compare_data; + DataNDC0 data0; - CHECK_NO_THROW(data0.push_front(node1)); - CHECK_NO_THROW(data0.push_front(node2)); - CHECK_NO_THROW(data0.push_front(node3)); - CHECK_NO_THROW(data0.push_front(node4)); - CHECK_NO_THROW(data0.push_front(node5)); - CHECK_NO_THROW(data0.push_front(node6)); + compare_data.push_front(node1); + compare_data.push_front(node2); + compare_data.push_front(node3); + compare_data.push_front(node4); + compare_data.push_front(node5); + compare_data.push_front(node6); - are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); - CHECK(are_equal); - CHECK_EQUAL(6, data0.size()); - CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + CHECK_NO_THROW(data0.push_front(node1)); + CHECK_NO_THROW(data0.push_front(node2)); + CHECK_NO_THROW(data0.push_front(node3)); + CHECK_NO_THROW(data0.push_front(node4)); + CHECK_NO_THROW(data0.push_front(node5)); + CHECK_NO_THROW(data0.push_front(node6)); + + are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); + CHECK(are_equal); + CHECK_EQUAL(6U, data0.size()); + CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + } } //************************************************************************* TEST_FIXTURE(SetupFixture, test_push_front_pop_front) { - DataNDC0 data0; - DataNDC1 data1; - ItemNDCNode node1("1"); ItemNDCNode node2("2"); ItemNDCNode node3("3"); @@ -460,43 +457,48 @@ namespace ItemNDCNode node5("5"); ItemNDCNode node6("6"); - data0.push_front(node1); - data0.push_front(node2); - data0.push_front(node3); - data0.push_front(node4); - data0.push_front(node5); - data0.push_front(node6); + { + DataNDC0 data0; + DataNDC1 data1; - data1.push_front(node1); - data1.push_front(node2); - data1.push_front(node3); - data1.push_front(node4); - data1.push_front(node5); - data1.push_front(node6); + data0.push_front(node1); + data0.push_front(node2); + data0.push_front(node3); + data0.push_front(node4); + data0.push_front(node5); + data0.push_front(node6); - CHECK_EQUAL(6, data0.size()); - CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); - CHECK(!data0.empty()); + data1.push_front(node1); + data1.push_front(node2); + data1.push_front(node3); + data1.push_front(node4); + data1.push_front(node5); + data1.push_front(node6); - data0.pop_front(); - data0.pop_front(); - data0.pop_front(); - data0.pop_front(); - data0.pop_front(); + CHECK_EQUAL(6U, data0.size()); + CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); + CHECK(!data0.empty()); - CHECK_EQUAL(1, data0.size()); - CHECK_EQUAL(1, std::distance(data0.begin(), data0.end())); - CHECK(!data0.empty()); + data0.pop_front(); + data0.pop_front(); + data0.pop_front(); + data0.pop_front(); + data0.pop_front(); - data0.pop_front(); + CHECK_EQUAL(1U, data0.size()); + CHECK_EQUAL(1, std::distance(data0.begin(), data0.end())); + CHECK(!data0.empty()); - CHECK_EQUAL(0, data0.size()); - CHECK_EQUAL(0, std::distance(data0.begin(), data0.end())); - CHECK(data0.empty()); + data0.pop_front(); - CHECK_EQUAL(6, data1.size()); - CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); - CHECK(!data1.empty()); + CHECK_EQUAL(0U, data0.size()); + CHECK_EQUAL(0, std::distance(data0.begin(), data0.end())); + CHECK(data0.empty()); + + CHECK_EQUAL(6U, data1.size()); + CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); + CHECK(!data1.empty()); + } } //************************************************************************* @@ -526,13 +528,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); are_equal = *i_data == *i_compare_data; CHECK(are_equal); @@ -547,13 +549,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); are_equal = *i_data == *i_compare_data; CHECK(are_equal); @@ -586,13 +588,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -616,13 +618,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -655,13 +657,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), unique_data.begin()); CHECK(are_equal); CHECK_EQUAL(unique_data.size(), data0.size()); - CHECK_EQUAL(unique_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(unique_data.size(), size_t(std::distance(data0.begin(), data0.end()))); // data1 should not have changed. are_equal = std::equal(data1.begin(), data1.end(), non_unique_data.begin()); CHECK(are_equal); CHECK_EQUAL(non_unique_data.size(), data1.size()); - CHECK_EQUAL(non_unique_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(non_unique_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -677,13 +679,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -699,13 +701,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size()); CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end())); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -776,8 +778,8 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare1.begin(), compare1.end())), data1.size()); } //************************************************************************* @@ -790,18 +792,14 @@ namespace DataNDC0::iterator idata_destination = data0.begin(); std::advance(idata_destination, 3); - std::forward_list compare0(data0.begin(), data0.end()); - - std::forward_list::iterator icompare_destination = compare0.begin(); - std::advance(icompare_destination, 3); + std::forward_list compare0(sorted_data2.begin(), sorted_data2.end()); data0.splice_after(idata_destination, data0); - compare0.splice_after(icompare_destination, compare0); are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); } //************************************************************************* @@ -839,8 +837,8 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare1.begin(), compare1.end())), data1.size()); } //************************************************************************* @@ -859,7 +857,7 @@ namespace DataNDC0::iterator idata_end = data0.begin(); std::advance(idata_end, 7); - std::forward_list compare0(data0.begin(), data0.end()); + std::forward_list compare0(sorted_data2.begin(), sorted_data2.end()); std::forward_list::iterator icompare_destination = compare0.begin(); std::advance(icompare_destination, 2); @@ -872,11 +870,11 @@ namespace data0.splice_after(idata_destination, data0, idata_begin, idata_end); compare0.splice_after(icompare_destination, compare0, icompare_begin, icompare_end); - + are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); } //************************************************************************* @@ -896,8 +894,8 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare1.begin(), compare1.end())), data1.size()); } //************************************************************************* @@ -917,8 +915,8 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - CHECK_EQUAL(std::distance(compare2.begin(), compare2.end()), data2.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare2.begin(), compare2.end())), data2.size()); } //************************************************************************* @@ -938,8 +936,8 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - CHECK_EQUAL(std::distance(compare3.begin(), compare3.end()), data3.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare3.begin(), compare3.end())), data3.size()); } //************************************************************************* @@ -959,8 +957,8 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - CHECK_EQUAL(std::distance(compare4.begin(), compare4.end()), data4.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare4.begin(), compare4.end())), data4.size()); } //************************************************************************* @@ -986,8 +984,8 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(std::distance(compare0.begin(), compare0.end()), data0.size()); - CHECK_EQUAL(std::distance(compare1.begin(), compare1.end()), data1.size()); + CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size()); + CHECK_EQUAL(size_t(std::distance(compare1.begin(), compare1.end())), data1.size()); } }; } diff --git a/test/test_intrusive_links.cpp b/test/test_intrusive_links.cpp index 9351497b..299df532 100644 --- a/test/test_intrusive_links.cpp +++ b/test/test_intrusive_links.cpp @@ -38,11 +38,10 @@ namespace //******************************************************* // Forward //******************************************************* - typedef etl::forward_link<0> FirstFLink; - typedef etl::forward_link<1> SecondFLink; - typedef etl::forward_link<2, etl::link_option::CHECKED> ThirdFLinkChecked; + typedef etl::forward_link<0> FLink0; + typedef etl::forward_link<1> FLink1; - struct FData : public FirstFLink, public SecondFLink, public ThirdFLinkChecked + struct FData : public FLink0, public FLink1 { FData(int value) : value(value) @@ -55,12 +54,10 @@ namespace //******************************************************* // Bidirectional //******************************************************* - typedef etl::bidirectional_link<0, etl::link_option::AUTO> FirstBLinkAuto; - typedef etl::bidirectional_link<0, etl::link_option::CHECKED> FirstBLinkChecked; - typedef etl::bidirectional_link<0> FirstBLink; - typedef etl::bidirectional_link<1> SecondBLink; + typedef etl::bidirectional_link<0> BLink0; + typedef etl::bidirectional_link<1> BLink1; - struct BData : public FirstBLink, public SecondBLink + struct BData : public BLink0, public BLink1 { BData(int value) : value(value) @@ -70,34 +67,14 @@ namespace int value; }; - struct BDataAuto : public FirstBLinkAuto, public SecondBLink - { - BDataAuto(int value) - : value(value) - { - } - - int value; - }; - - struct BDataChecked : public FirstBLinkChecked - { - BDataChecked(int value) - : value(value) - { - } - - int value; - }; - //******************************************************* // Tree //******************************************************* - typedef etl::tree_link<0> FirstTLink; - typedef etl::tree_link<1> SecondTLink; - typedef etl::tree_link<2> ThirdTLink; + typedef etl::tree_link<0> TLink0; + typedef etl::tree_link<1> TLink1; + typedef etl::tree_link<2> TLink2; - struct TData : public FirstTLink, public SecondTLink + struct TData : public TLink0, public TLink1 { TData(int value) : value(value) @@ -110,7 +87,7 @@ namespace //******************************************************* // Mixed //******************************************************* - struct MData : public FirstFLink, public SecondBLink, public ThirdTLink + struct MData : public FLink0, public BLink1, public TLink2 { MData(int value) : value(value) @@ -121,7 +98,7 @@ namespace }; SUITE(test_forward_list) - { + { //************************************************************************* TEST(test_link_forward_link) { @@ -130,54 +107,54 @@ namespace FData data2(2); FData data3(3); - data0.FirstFLink::clear(); - etl::link(data0, data1); - CHECK(data0.FirstFLink::etl_next == &data1); + data0.FLink0::clear(); + etl::link(data0, data1); + CHECK(data0.FLink0::etl_next == &data1); - data0.FirstFLink::clear(); - etl::link(&data0, data1); - CHECK(data0.FirstFLink::etl_next == &data1); + data0.FLink0::clear(); + etl::link(&data0, data1); + CHECK(data0.FLink0::etl_next == &data1); - data0.FirstFLink::clear(); - etl::link(data0, &data1); - CHECK(data0.FirstFLink::etl_next == &data1); + data0.FLink0::clear(); + etl::link(data0, &data1); + CHECK(data0.FLink0::etl_next == &data1); - data0.FirstFLink::clear(); - etl::link(&data0, &data1); - CHECK(data0.FirstFLink::etl_next == &data1); + data0.FLink0::clear(); + etl::link(&data0, &data1); + CHECK(data0.FLink0::etl_next == &data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); - etl::link(data3, data2); - etl::link(data2, data1); - etl::link(data1, data0); - etl::link(data0, nullptr); + etl::link(data3, data2); + etl::link(data2, data1); + etl::link(data1, data0); + etl::link(data0, nullptr); - CHECK(data1.FirstFLink::etl_next == &data2); - CHECK(data2.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == nullptr); + CHECK(data1.FLink0::etl_next == &data2); + CHECK(data2.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == nullptr); - CHECK(data3.SecondFLink::etl_next == &data2); - CHECK(data2.SecondFLink::etl_next == &data1); - CHECK(data1.SecondFLink::etl_next == &data0); - CHECK(data0.SecondFLink::etl_next == nullptr); + CHECK(data3.FLink1::etl_next == &data2); + CHECK(data2.FLink1::etl_next == &data1); + CHECK(data1.FLink1::etl_next == &data0); + CHECK(data0.FLink1::etl_next == nullptr); FData* pdata; - pdata = static_cast(data0.FirstFLink::etl_next); + pdata = static_cast(data0.FLink0::etl_next); CHECK_EQUAL(1, pdata->value); - pdata = static_cast(pdata->FirstFLink::etl_next); + pdata = static_cast(pdata->FLink0::etl_next); CHECK_EQUAL(2, pdata->value); - pdata = static_cast(pdata->FirstFLink::etl_next); + pdata = static_cast(pdata->FLink0::etl_next); CHECK_EQUAL(3, pdata->value); - pdata = static_cast(data3.SecondFLink::etl_next); + pdata = static_cast(data3.FLink1::etl_next); CHECK_EQUAL(2, pdata->value); - pdata = static_cast(pdata->SecondFLink::etl_next); + pdata = static_cast(pdata->FLink1::etl_next); CHECK_EQUAL(1, pdata->value); - pdata = static_cast(pdata->SecondFLink::etl_next); + pdata = static_cast(pdata->FLink1::etl_next); CHECK_EQUAL(0, pdata->value); } @@ -189,35 +166,35 @@ namespace FData data2(2); FData data3(3); - data0.FirstFLink::clear(); - etl::link_splice(data0, data1); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == nullptr); + data0.FLink0::clear(); + etl::link_splice(data0, data1); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == nullptr); - data0.FirstFLink::clear(); - etl::link_splice(data0, &data1); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == nullptr); + data0.FLink0::clear(); + etl::link_splice(data0, &data1); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == nullptr); - data0.FirstFLink::clear(); - etl::link_splice(&data0, data1); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == nullptr); + data0.FLink0::clear(); + etl::link_splice(&data0, data1); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == nullptr); - data0.FirstFLink::clear(); - etl::link_splice(&data0, &data1); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == nullptr); + data0.FLink0::clear(); + etl::link_splice(&data0, &data1); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == nullptr); - data0.FirstFLink::clear(); - etl::link_splice(data0, data3); - etl::link_splice(data0, data1); - etl::link_splice(data1, data2); + data0.FLink0::clear(); + etl::link_splice(data0, data3); + etl::link_splice(data0, data1); + etl::link_splice(data1, data2); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == &data2); - CHECK(data2.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == &data2); + CHECK(data2.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == nullptr); } //************************************************************************* @@ -233,65 +210,65 @@ namespace FData data7(7); // First range. - data0.FirstFLink::clear(); - etl::link_splice(data0, data1); - etl::link_splice(data1, data6); - etl::link_splice(data6, data7); + data0.FLink0::clear(); + etl::link_splice(data0, data1); + etl::link_splice(data1, data6); + etl::link_splice(data6, data7); // Second range. - data2.FirstFLink::clear(); - etl::link_splice(data2, data3); - etl::link_splice(data3, data4); - etl::link_splice(data4, data5); + data2.FLink0::clear(); + etl::link_splice(data2, data3); + etl::link_splice(data3, data4); + etl::link_splice(data4, data5); - etl::link_splice(data1, data2, data5); + etl::link_splice(data1, data2, data5); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == &data2); - CHECK(data2.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == &data4); - CHECK(data4.FirstFLink::etl_next == &data5); - CHECK(data5.FirstFLink::etl_next == &data6); - CHECK(data6.FirstFLink::etl_next == &data7); - CHECK(data7.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == &data2); + CHECK(data2.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == &data4); + CHECK(data4.FLink0::etl_next == &data5); + CHECK(data5.FLink0::etl_next == &data6); + CHECK(data6.FLink0::etl_next == &data7); + CHECK(data7.FLink0::etl_next == nullptr); // Do it again with a pointer. // First range. - data0.FirstFLink::clear(); - etl::link_splice(data0, data1); - etl::link_splice(data1, data6); - etl::link_splice(data6, data7); + data0.FLink0::clear(); + etl::link_splice(data0, data1); + etl::link_splice(data1, data6); + etl::link_splice(data6, data7); // Second range. - data2.FirstFLink::clear(); - etl::link_splice(data2, data3); - etl::link_splice(data3, data4); - etl::link_splice(data4, data5); + data2.FLink0::clear(); + etl::link_splice(data2, data3); + etl::link_splice(data3, data4); + etl::link_splice(data4, data5); - etl::link_splice(&data1, data2, data5); + etl::link_splice(&data1, data2, data5); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == &data2); - CHECK(data2.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == &data4); - CHECK(data4.FirstFLink::etl_next == &data5); - CHECK(data5.FirstFLink::etl_next == &data6); - CHECK(data6.FirstFLink::etl_next == &data7); - CHECK(data7.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == &data2); + CHECK(data2.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == &data4); + CHECK(data4.FLink0::etl_next == &data5); + CHECK(data5.FLink0::etl_next == &data6); + CHECK(data6.FLink0::etl_next == &data7); + CHECK(data7.FLink0::etl_next == nullptr); // Do it again with a nullptr pointer. // Second range. - data2.FirstFLink::clear(); - etl::link_splice(data2, data3); - etl::link_splice(data3, data4); - etl::link_splice(data4, data5); + data2.FLink0::clear(); + etl::link_splice(data2, data3); + etl::link_splice(data3, data4); + etl::link_splice(data4, data5); - etl::link_splice(nullptr, data2, data5); + etl::link_splice(nullptr, data2, data5); - CHECK(data2.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == &data4); - CHECK(data4.FirstFLink::etl_next == &data5); - CHECK(data5.FirstFLink::etl_next == nullptr); + CHECK(data2.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == &data4); + CHECK(data4.FLink0::etl_next == &data5); + CHECK(data5.FLink0::etl_next == nullptr); } @@ -303,63 +280,51 @@ namespace FData data2(2); FData data3(3); - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + etl::link(data0, data1); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); - etl::link(data3, data2); - etl::link(data2, data1); - etl::link(data1, data0); - etl::link(data0, nullptr); + etl::link(data3, data2); + etl::link(data2, data1); + etl::link(data1, data0); + etl::link(data0, nullptr); - etl::unlink_after(data1); - data2.FirstFLink::clear(); + etl::unlink_after(data1); + data2.FLink0::clear(); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == &data3); - CHECK(data2.FirstFLink::etl_next == nullptr); - CHECK(data3.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == &data3); + CHECK(data2.FLink0::etl_next == nullptr); + CHECK(data3.FLink0::etl_next == nullptr); - CHECK(data3.SecondFLink::etl_next == &data2); - CHECK(data2.SecondFLink::etl_next == &data1); - CHECK(data1.SecondFLink::etl_next == &data0); - CHECK(data0.SecondFLink::etl_next == nullptr); + CHECK(data3.FLink1::etl_next == &data2); + CHECK(data2.FLink1::etl_next == &data1); + CHECK(data1.FLink1::etl_next == &data0); + CHECK(data0.FLink1::etl_next == nullptr); - etl::unlink_after(data2); - data1.SecondFLink::clear(); + etl::unlink_after(data2); + data1.FLink1::clear(); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == nullptr); - CHECK(data3.SecondFLink::etl_next == &data2); - CHECK(data2.SecondFLink::etl_next == &data0); - CHECK(data1.SecondFLink::etl_next == nullptr); - CHECK(data0.SecondFLink::etl_next == nullptr); + CHECK(data3.FLink1::etl_next == &data2); + CHECK(data2.FLink1::etl_next == &data0); + CHECK(data1.FLink1::etl_next == nullptr); + CHECK(data0.FLink1::etl_next == nullptr); - etl::unlink_after(data3); - etl::unlink_after(data0); + etl::unlink_after(data3); + etl::unlink_after(data0); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == nullptr); - CHECK(data3.SecondFLink::etl_next == &data2); - CHECK(data2.SecondFLink::etl_next == &data0); - CHECK(data0.SecondFLink::etl_next == nullptr); - - // Check auto link. - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); - - etl::unlink_after(data1); - - CHECK(data0.ThirdFLinkChecked::etl_next == &data1); - CHECK(data1.ThirdFLinkChecked::etl_next == &data3); - CHECK(data3.ThirdFLinkChecked::etl_next == nullptr); + CHECK(data3.FLink1::etl_next == &data2); + CHECK(data2.FLink1::etl_next == &data0); + CHECK(data0.FLink1::etl_next == nullptr); } //************************************************************************* @@ -370,29 +335,29 @@ namespace FData data2(2); FData data3(3); - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + etl::link(data0, data1); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); - etl::link(data3, data2); - etl::link(data2, data1); - etl::link(data1, data0); - etl::link(data0, nullptr); + etl::link(data3, data2); + etl::link(data2, data1); + etl::link(data1, data0); + etl::link(data0, nullptr); - etl::unlink_after(data0, data2); - data1.FirstFLink::clear(); - data2.FirstFLink::clear(); + etl::unlink_after(data0, data2); + data1.FLink0::clear(); + data2.FLink0::clear(); - CHECK(data0.FirstFLink::etl_next == &data3); - CHECK(data1.FirstFLink::etl_next == nullptr); - CHECK(data2.FirstFLink::etl_next == nullptr); - CHECK(data3.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data3); + CHECK(data1.FLink0::etl_next == nullptr); + CHECK(data2.FLink0::etl_next == nullptr); + CHECK(data3.FLink0::etl_next == nullptr); - CHECK(data3.SecondFLink::etl_next == &data2); - CHECK(data2.SecondFLink::etl_next == &data1); - CHECK(data1.SecondFLink::etl_next == &data0); - CHECK(data0.SecondFLink::etl_next == nullptr); + CHECK(data3.FLink1::etl_next == &data2); + CHECK(data2.FLink1::etl_next == &data1); + CHECK(data1.FLink1::etl_next == &data0); + CHECK(data0.FLink1::etl_next == nullptr); } //************************************************************************* @@ -400,134 +365,131 @@ namespace { FData data0(0); - etl::link(data0, data0); + etl::link(data0, data0); - CHECK(data0.FirstFLink::etl_next == &data0); + CHECK(data0.FLink0::etl_next == &data0); - etl::unlink_after(data0); + etl::unlink_after(data0); - CHECK(data0.FirstFLink::etl_next == &data0); + CHECK(data0.FLink0::etl_next == &data0); } //************************************************************************* TEST(test_link_bidirectional_link) { - // FirstBLinkAuto is auto-unlink, SecondBLink is not. + BData data0(0); + BData data1(1); + BData data2(2); + BData data3(3); - BDataAuto* data0 = new BDataAuto(0); - BDataAuto* data1 = new BDataAuto(1); - BDataAuto* data2 = new BDataAuto(2); - BDataAuto* data3 = new BDataAuto(3); + etl::link(nullptr, data0); - etl::link(nullptr, data0); + data1.BLink0::clear(); + etl::link(data0, data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); - data1->FirstBLinkAuto::clear(); - etl::link(*data0, *data1); - CHECK(data0->FirstBLinkAuto::etl_next == data1); - CHECK(data1->FirstBLinkAuto::etl_previous == data0); - - data1->FirstBLinkAuto::clear(); - etl::link(*data0, data1); - CHECK(data0->FirstBLinkAuto::etl_next == data1); - CHECK(data1->FirstBLinkAuto::etl_previous == data0); + data1.BLink0::clear(); + etl::link(data0, data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); - data1->FirstBLinkAuto::clear(); - etl::link(data0, *data1); - CHECK(data0->FirstBLinkAuto::etl_next == data1); - CHECK(data1->FirstBLinkAuto::etl_previous == data0); + data1.BLink0::clear(); + etl::link(data0, data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); - data1->FirstBLinkAuto::clear(); - etl::link(data0, data1); - CHECK(data0->FirstBLinkAuto::etl_next == data1); - CHECK(data1->FirstBLinkAuto::etl_previous == data0); + data1.BLink0::clear(); + etl::link(data0, data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); - CHECK(data0->FirstBLinkAuto::etl_previous == nullptr); - CHECK(data1->FirstBLinkAuto::etl_previous == data0); - CHECK(data1->FirstBLinkAuto::etl_next == data2); - CHECK(data2->FirstBLinkAuto::etl_previous == data1); - CHECK(data2->FirstBLinkAuto::etl_next == data3); - CHECK(data3->FirstBLinkAuto::etl_previous == data2); - CHECK(data3->FirstBLinkAuto::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == &data2); + CHECK(data2.BLink0::etl_previous == &data1); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == nullptr); - etl::link(nullptr, data3); - etl::link(data3, data2); - etl::link(data2, data1); - etl::link(data1, data0); - etl::link(data0, nullptr); + etl::link(nullptr, data3); + etl::link(data3, data2); + etl::link(data2, data1); + etl::link(data1, data0); + etl::link(data0, nullptr); - CHECK(data3->SecondBLink::etl_previous == nullptr); - CHECK(data3->SecondBLink::etl_next == data2); - CHECK(data2->SecondBLink::etl_previous == data3); - CHECK(data2->SecondBLink::etl_next == data1); - CHECK(data1->SecondBLink::etl_previous == data2); - CHECK(data1->SecondBLink::etl_next == data0); - CHECK(data0->SecondBLink::etl_previous == data1); - CHECK(data0->SecondBLink::etl_next == nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data2); + CHECK(data2.BLink1::etl_previous == &data3); + CHECK(data2.BLink1::etl_next == &data1); + CHECK(data1.BLink1::etl_previous == &data2); + CHECK(data1.BLink1::etl_next == &data0); + CHECK(data0.BLink1::etl_previous == &data1); + CHECK(data0.BLink1::etl_next == nullptr); - BDataAuto* pdataauto; BData* pdata; - pdataauto = static_cast(data0->FirstBLinkAuto::etl_next); - CHECK_EQUAL(1, pdataauto->value); - pdataauto = static_cast(pdataauto->FirstBLinkAuto::etl_next); - CHECK_EQUAL(2, pdataauto->value); - pdataauto = static_cast(pdataauto->FirstBLinkAuto::etl_next); - CHECK_EQUAL(3, pdataauto->value); - - pdataauto = static_cast(data3->FirstBLinkAuto::etl_previous); - CHECK_EQUAL(2, pdataauto->value); - pdataauto = static_cast(pdataauto->FirstBLinkAuto::etl_previous); - CHECK_EQUAL(1, pdataauto->value); - pdataauto = static_cast(pdataauto->FirstBLinkAuto::etl_previous); - CHECK_EQUAL(0, pdataauto->value); - - pdata = static_cast(data3->SecondBLink::etl_next); - CHECK_EQUAL(2, pdata->value); - pdata = static_cast(pdata->SecondBLink::etl_next); + pdata = static_cast(data0.BLink0::etl_next); CHECK_EQUAL(1, pdata->value); - pdata = static_cast(pdata->SecondBLink::etl_next); - CHECK_EQUAL(0, pdata->value); - - pdata = static_cast(data0->SecondBLink::etl_previous); - CHECK_EQUAL(1, pdata->value); - pdata = static_cast(pdata->SecondBLink::etl_previous); + pdata = static_cast(pdata->BLink0::etl_next); CHECK_EQUAL(2, pdata->value); - pdata = static_cast(pdata->SecondBLink::etl_previous); + pdata = static_cast(pdata->BLink0::etl_next); CHECK_EQUAL(3, pdata->value); - delete data1; - CHECK(data0->FirstBLinkAuto::etl_next == data2); - CHECK(data2->FirstBLinkAuto::etl_previous == data0); + pdata = static_cast(data3.BLink0::etl_previous); + CHECK_EQUAL(2, pdata->value); + pdata = static_cast(pdata->BLink0::etl_previous); + CHECK_EQUAL(1, pdata->value); + pdata = static_cast(pdata->BLink0::etl_previous); + CHECK_EQUAL(0, pdata->value); - CHECK(data3->SecondBLink::etl_previous == nullptr); - CHECK(data3->SecondBLink::etl_next == data2); - CHECK(data2->SecondBLink::etl_previous == data3); - CHECK(data2->SecondBLink::etl_next != nullptr); - CHECK(data0->SecondBLink::etl_previous != nullptr); - CHECK(data0->SecondBLink::etl_next == nullptr); + pdata = static_cast(data3.BLink1::etl_next); + CHECK_EQUAL(2, pdata->value); + pdata = static_cast(pdata->BLink1::etl_next); + CHECK_EQUAL(1, pdata->value); + pdata = static_cast(pdata->BLink1::etl_next); + CHECK_EQUAL(0, pdata->value); - delete data0; - CHECK(data2->FirstBLinkAuto::etl_next == data3); - CHECK(data2->FirstBLinkAuto::etl_previous == nullptr); - CHECK(data3->FirstBLinkAuto::etl_previous == data2); - - CHECK(data3->SecondBLink::etl_previous == nullptr); - CHECK(data3->SecondBLink::etl_next == data2); - CHECK(data2->SecondBLink::etl_previous == data3); - CHECK(data2->SecondBLink::etl_next != nullptr); + pdata = static_cast(data0.BLink1::etl_previous); + CHECK_EQUAL(1, pdata->value); + pdata = static_cast(pdata->BLink1::etl_previous); + CHECK_EQUAL(2, pdata->value); + pdata = static_cast(pdata->BLink1::etl_previous); + CHECK_EQUAL(3, pdata->value); - delete data3; - CHECK(data2->FirstBLinkAuto::etl_next == nullptr); - CHECK(data2->FirstBLinkAuto::etl_previous == nullptr); + data1.BLink0::unlink(); + CHECK(data0.BLink0::etl_next == &data2); + CHECK(data2.BLink0::etl_previous == &data0); - CHECK(data2->SecondBLink::etl_next != nullptr); - CHECK(data2->SecondBLink::etl_previous != nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data2); + CHECK(data2.BLink1::etl_previous == &data3); + CHECK(data2.BLink1::etl_next != nullptr); + CHECK(data0.BLink1::etl_previous != nullptr); + CHECK(data0.BLink1::etl_next == nullptr); - delete data2; + data0.BLink0::unlink(); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data2.BLink0::etl_previous == nullptr); + CHECK(data3.BLink0::etl_previous == &data2); + + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data2); + CHECK(data2.BLink1::etl_previous == &data3); + CHECK(data2.BLink1::etl_next != nullptr); + + data3.BLink0::unlink(); + CHECK(data2.BLink0::etl_next == nullptr); + CHECK(data2.BLink0::etl_previous == nullptr); + + CHECK(data2.BLink1::etl_next != nullptr); + CHECK(data2.BLink1::etl_previous != nullptr); + + data2.BLink0::unlink(); } //************************************************************************* @@ -538,52 +500,52 @@ namespace BData data2(2); BData data3(3); - data0.FirstBLink::clear(); - etl::link_splice(nullptr, data0); + data0.BLink0::clear(); + etl::link_splice(nullptr, data0); - etl::link_splice(data0, data1); - CHECK(data0.FirstBLink::etl_next == &data1); - CHECK(data1.FirstBLink::etl_previous == &data0); - CHECK(data1.FirstBLink::etl_next == nullptr); + etl::link_splice(data0, data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == nullptr); - data0.FirstBLink::clear(); - etl::link_splice(nullptr, data0); + data0.BLink0::clear(); + etl::link_splice(nullptr, data0); - etl::link_splice(data0, &data1); - CHECK(data0.FirstBLink::etl_next == &data1); - CHECK(data1.FirstBLink::etl_previous == &data0); - CHECK(data1.FirstBLink::etl_next == nullptr); + etl::link_splice(data0, &data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == nullptr); - data0.FirstBLink::clear(); - etl::link_splice(nullptr, data0); + data0.BLink0::clear(); + etl::link_splice(nullptr, data0); - etl::link_splice(&data0, data1); - CHECK(data0.FirstBLink::etl_next == &data1); - CHECK(data1.FirstBLink::etl_previous == &data0); - CHECK(data1.FirstBLink::etl_next == nullptr); + etl::link_splice(&data0, data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == nullptr); - data0.FirstBLink::clear(); - etl::link_splice(nullptr, data0); + data0.BLink0::clear(); + etl::link_splice(nullptr, data0); - etl::link_splice(&data0, &data1); - CHECK(data0.FirstBLink::etl_next == &data1); - CHECK(data1.FirstBLink::etl_previous == &data0); - CHECK(data1.FirstBLink::etl_next == nullptr); + etl::link_splice(&data0, &data1); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == nullptr); - data0.FirstBLink::clear(); - etl::link_splice(nullptr, data0); - etl::link_splice(data0, data3); - etl::link_splice(data0, data1); - etl::link_splice(data1, data2); + data0.BLink0::clear(); + etl::link_splice(nullptr, data0); + etl::link_splice(data0, data3); + etl::link_splice(data0, data1); + etl::link_splice(data1, data2); - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == &data1); - CHECK(data1.FirstBLink::etl_previous == &data0); - CHECK(data1.FirstBLink::etl_next == &data2); - CHECK(data2.FirstBLink::etl_previous == &data1); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == &data2); + CHECK(data2.BLink0::etl_previous == &data1); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == nullptr); } //************************************************************************* @@ -599,110 +561,90 @@ namespace BData data7(7); // Build the first range. - data0.FirstBLink::clear(); - etl::link_splice(nullptr, data0); - etl::link_splice(data0, data1); - etl::link_splice(data1, data6); - etl::link_splice(data6, data7); + data0.BLink0::clear(); + etl::link_splice(nullptr, data0); + etl::link_splice(data0, data1); + etl::link_splice(data1, data6); + etl::link_splice(data6, data7); // Build the second range. - data2.FirstBLink::clear(); - etl::link_splice(nullptr, data2); - etl::link_splice(data2, data3); - etl::link_splice(data3, data4); - etl::link_splice(data4, data5); + data2.BLink0::clear(); + etl::link_splice(nullptr, data2); + etl::link_splice(data2, data3); + etl::link_splice(data3, data4); + etl::link_splice(data4, data5); - etl::link_splice(data1, data2, data5); - - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == &data1); - CHECK(data1.FirstBLink::etl_previous == &data0); - CHECK(data1.FirstBLink::etl_next == &data2); - CHECK(data2.FirstBLink::etl_previous == &data1); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == &data4); - CHECK(data4.FirstBLink::etl_previous == &data3); - CHECK(data4.FirstBLink::etl_next == &data5); - CHECK(data5.FirstBLink::etl_previous == &data4); - CHECK(data5.FirstBLink::etl_next == &data6); - CHECK(data6.FirstBLink::etl_previous == &data5); - CHECK(data6.FirstBLink::etl_next == &data7); - CHECK(data7.FirstBLink::etl_previous == &data6); - CHECK(data7.FirstBLink::etl_next == nullptr); + etl::link_splice(data1, data2, data5); + + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == &data2); + CHECK(data2.BLink0::etl_previous == &data1); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == &data4); + CHECK(data4.BLink0::etl_previous == &data3); + CHECK(data4.BLink0::etl_next == &data5); + CHECK(data5.BLink0::etl_previous == &data4); + CHECK(data5.BLink0::etl_next == &data6); + CHECK(data6.BLink0::etl_previous == &data5); + CHECK(data6.BLink0::etl_next == &data7); + CHECK(data7.BLink0::etl_previous == &data6); + CHECK(data7.BLink0::etl_next == nullptr); // Do it again with a pointer parameter. // Build the first range. - data0.FirstBLink::clear(); - etl::link_splice(nullptr, data0); - etl::link_splice(data0, data1); - etl::link_splice(data1, data6); - etl::link_splice(data6, data7); + data0.BLink0::clear(); + etl::link_splice(nullptr, data0); + etl::link_splice(data0, data1); + etl::link_splice(data1, data6); + etl::link_splice(data6, data7); // Build the second range. - data2.FirstBLink::clear(); - etl::link_splice(nullptr, data2); - etl::link_splice(data2, data3); - etl::link_splice(data3, data4); - etl::link_splice(data4, data5); + data2.BLink0::clear(); + etl::link_splice(nullptr, data2); + etl::link_splice(data2, data3); + etl::link_splice(data3, data4); + etl::link_splice(data4, data5); - etl::link_splice(&data1, data2, data5); + etl::link_splice(&data1, data2, data5); - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == &data1); - CHECK(data1.FirstBLink::etl_previous == &data0); - CHECK(data1.FirstBLink::etl_next == &data2); - CHECK(data2.FirstBLink::etl_previous == &data1); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == &data4); - CHECK(data4.FirstBLink::etl_previous == &data3); - CHECK(data4.FirstBLink::etl_next == &data5); - CHECK(data5.FirstBLink::etl_previous == &data4); - CHECK(data5.FirstBLink::etl_next == &data6); - CHECK(data6.FirstBLink::etl_previous == &data5); - CHECK(data6.FirstBLink::etl_next == &data7); - CHECK(data7.FirstBLink::etl_previous == &data6); - CHECK(data7.FirstBLink::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == &data1); + CHECK(data1.BLink0::etl_previous == &data0); + CHECK(data1.BLink0::etl_next == &data2); + CHECK(data2.BLink0::etl_previous == &data1); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == &data4); + CHECK(data4.BLink0::etl_previous == &data3); + CHECK(data4.BLink0::etl_next == &data5); + CHECK(data5.BLink0::etl_previous == &data4); + CHECK(data5.BLink0::etl_next == &data6); + CHECK(data6.BLink0::etl_previous == &data5); + CHECK(data6.BLink0::etl_next == &data7); + CHECK(data7.BLink0::etl_previous == &data6); + CHECK(data7.BLink0::etl_next == nullptr); // Do it again with a nullptr parameter. // Build the range. - data2.FirstBLink::clear(); - etl::link_splice(nullptr, data2); - etl::link_splice(data2, data3); - etl::link_splice(data3, data4); - etl::link_splice(data4, data5); + data2.BLink0::clear(); + etl::link_splice(nullptr, data2); + etl::link_splice(data2, data3); + etl::link_splice(data3, data4); + etl::link_splice(data4, data5); - etl::link_splice(nullptr, data2, data5); + etl::link_splice(nullptr, data2, data5); - CHECK(data2.FirstBLink::etl_previous == nullptr); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == &data4); - CHECK(data4.FirstBLink::etl_previous == &data3); - CHECK(data4.FirstBLink::etl_next == &data5); - CHECK(data5.FirstBLink::etl_previous == &data4); - CHECK(data5.FirstBLink::etl_next == nullptr); - } - - //************************************************************************* - TEST(test_link_bidirectional_link_checked) - { - // FirstBLinkAuto is auto-unlink - - BDataChecked* data0 = new BDataChecked(0); - BDataChecked* data1 = new BDataChecked(1); - BDataChecked* data2 = new BDataChecked(2); - BDataChecked* data3 = new BDataChecked(3); - - etl::link(nullptr, data0); - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); - - data2->FirstBLinkChecked::clear(); - CHECK_NO_THROW(delete data2); + CHECK(data2.BLink0::etl_previous == nullptr); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == &data4); + CHECK(data4.BLink0::etl_previous == &data3); + CHECK(data4.BLink0::etl_next == &data5); + CHECK(data5.BLink0::etl_previous == &data4); + CHECK(data5.BLink0::etl_next == nullptr); } //************************************************************************* @@ -713,101 +655,101 @@ namespace BData data2(2); BData data3(3); - etl::link(nullptr, data0); - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + etl::link(nullptr, data0); + etl::link(data0, data1); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); - etl::link(nullptr, data3); - etl::link(data3, data2); - etl::link(data2, data1); - etl::link(data1, data0); - etl::link(data0, nullptr); + etl::link(nullptr, data3); + etl::link(data3, data2); + etl::link(data2, data1); + etl::link(data1, data0); + etl::link(data0, nullptr); - etl::unlink(data1); - data1.FirstBLink::clear(); + etl::unlink(data1); + data1.BLink0::clear(); - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == &data2); - CHECK(data1.FirstBLink::etl_previous == nullptr); - CHECK(data1.FirstBLink::etl_next == nullptr); - CHECK(data2.FirstBLink::etl_previous == &data0); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == &data2); + CHECK(data1.BLink0::etl_previous == nullptr); + CHECK(data1.BLink0::etl_next == nullptr); + CHECK(data2.BLink0::etl_previous == &data0); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == nullptr); - CHECK(data3.SecondBLink::etl_previous == nullptr); - CHECK(data3.SecondBLink::etl_next == &data2); - CHECK(data2.SecondBLink::etl_previous == &data3); - CHECK(data2.SecondBLink::etl_next == &data1); - CHECK(data1.SecondBLink::etl_previous == &data2); - CHECK(data1.SecondBLink::etl_next == &data0); - CHECK(data0.SecondBLink::etl_previous == &data1); - CHECK(data0.SecondBLink::etl_next == nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data2); + CHECK(data2.BLink1::etl_previous == &data3); + CHECK(data2.BLink1::etl_next == &data1); + CHECK(data1.BLink1::etl_previous == &data2); + CHECK(data1.BLink1::etl_next == &data0); + CHECK(data0.BLink1::etl_previous == &data1); + CHECK(data0.BLink1::etl_next == nullptr); - etl::unlink(data2); - data2.SecondBLink::clear(); + etl::unlink(data2); + data2.BLink1::clear(); - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == &data2); - CHECK(data1.FirstBLink::etl_previous == nullptr); - CHECK(data1.FirstBLink::etl_next == nullptr); - CHECK(data2.FirstBLink::etl_previous == &data0); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == &data2); + CHECK(data1.BLink0::etl_previous == nullptr); + CHECK(data1.BLink0::etl_next == nullptr); + CHECK(data2.BLink0::etl_previous == &data0); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == nullptr); - CHECK(data3.SecondBLink::etl_previous == nullptr); - CHECK(data3.SecondBLink::etl_next == &data1); - CHECK(data2.SecondBLink::etl_previous == nullptr); - CHECK(data2.SecondBLink::etl_next == nullptr); - CHECK(data1.SecondBLink::etl_previous == &data3); - CHECK(data1.SecondBLink::etl_next == &data0); - CHECK(data0.SecondBLink::etl_previous == &data1); - CHECK(data0.SecondBLink::etl_next == nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data1); + CHECK(data2.BLink1::etl_previous == nullptr); + CHECK(data2.BLink1::etl_next == nullptr); + CHECK(data1.BLink1::etl_previous == &data3); + CHECK(data1.BLink1::etl_next == &data0); + CHECK(data0.BLink1::etl_previous == &data1); + CHECK(data0.BLink1::etl_next == nullptr); - etl::unlink(data0); - data0.FirstBLink::clear(); + etl::unlink(data0); + data0.BLink0::clear(); - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == nullptr); - CHECK(data1.FirstBLink::etl_previous == nullptr); - CHECK(data1.FirstBLink::etl_next == nullptr); - CHECK(data2.FirstBLink::etl_previous == nullptr); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == nullptr); + CHECK(data1.BLink0::etl_previous == nullptr); + CHECK(data1.BLink0::etl_next == nullptr); + CHECK(data2.BLink0::etl_previous == nullptr); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == nullptr); - CHECK(data3.SecondBLink::etl_previous == nullptr); - CHECK(data3.SecondBLink::etl_next == &data1); - CHECK(data2.SecondBLink::etl_previous == nullptr); - CHECK(data2.SecondBLink::etl_next == nullptr); - CHECK(data1.SecondBLink::etl_previous == &data3); - CHECK(data1.SecondBLink::etl_next == &data0); - CHECK(data0.SecondBLink::etl_previous == &data1); - CHECK(data0.SecondBLink::etl_next == nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data1); + CHECK(data2.BLink1::etl_previous == nullptr); + CHECK(data2.BLink1::etl_next == nullptr); + CHECK(data1.BLink1::etl_previous == &data3); + CHECK(data1.BLink1::etl_next == &data0); + CHECK(data0.BLink1::etl_previous == &data1); + CHECK(data0.BLink1::etl_next == nullptr); - etl::unlink(data3); - data3.SecondBLink::clear(); + etl::unlink(data3); + data3.BLink1::clear(); - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == nullptr); - CHECK(data1.FirstBLink::etl_previous == nullptr); - CHECK(data1.FirstBLink::etl_next == nullptr); - CHECK(data2.FirstBLink::etl_previous == nullptr); - CHECK(data2.FirstBLink::etl_next == &data3); - CHECK(data3.FirstBLink::etl_previous == &data2); - CHECK(data3.FirstBLink::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == nullptr); + CHECK(data1.BLink0::etl_previous == nullptr); + CHECK(data1.BLink0::etl_next == nullptr); + CHECK(data2.BLink0::etl_previous == nullptr); + CHECK(data2.BLink0::etl_next == &data3); + CHECK(data3.BLink0::etl_previous == &data2); + CHECK(data3.BLink0::etl_next == nullptr); - CHECK(data3.SecondBLink::etl_previous == nullptr); - CHECK(data3.SecondBLink::etl_next == nullptr); - CHECK(data2.SecondBLink::etl_previous == nullptr); - CHECK(data2.SecondBLink::etl_next == nullptr); - CHECK(data1.SecondBLink::etl_previous == nullptr); - CHECK(data1.SecondBLink::etl_next == &data0); - CHECK(data0.SecondBLink::etl_previous == &data1); - CHECK(data0.SecondBLink::etl_next == nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == nullptr); + CHECK(data2.BLink1::etl_previous == nullptr); + CHECK(data2.BLink1::etl_next == nullptr); + CHECK(data1.BLink1::etl_previous == nullptr); + CHECK(data1.BLink1::etl_next == &data0); + CHECK(data0.BLink1::etl_previous == &data1); + CHECK(data0.BLink1::etl_next == nullptr); } //************************************************************************* @@ -818,55 +760,55 @@ namespace BData data2(2); BData data3(3); - etl::link(nullptr, data0); - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + etl::link(nullptr, data0); + etl::link(data0, data1); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); - etl::link(nullptr, data3); - etl::link(data3, data2); - etl::link(data2, data1); - etl::link(data1, data0); - etl::link(data0, nullptr); + etl::link(nullptr, data3); + etl::link(data3, data2); + etl::link(data2, data1); + etl::link(data1, data0); + etl::link(data0, nullptr); - etl::unlink(data1, data2); - data1.FirstBLink::clear(); - data2.FirstBLink::clear(); + etl::unlink(data1, data2); + data1.BLink0::clear(); + data2.BLink0::clear(); - CHECK(data0.FirstBLink::etl_previous == nullptr); - CHECK(data0.FirstBLink::etl_next == &data3); - CHECK(data1.FirstBLink::etl_previous == nullptr); - CHECK(data1.FirstBLink::etl_next == nullptr); - CHECK(data2.FirstBLink::etl_previous == nullptr); - CHECK(data2.FirstBLink::etl_next == nullptr); - CHECK(data3.FirstBLink::etl_previous == &data0); - CHECK(data3.FirstBLink::etl_next == nullptr); + CHECK(data0.BLink0::etl_previous == nullptr); + CHECK(data0.BLink0::etl_next == &data3); + CHECK(data1.BLink0::etl_previous == nullptr); + CHECK(data1.BLink0::etl_next == nullptr); + CHECK(data2.BLink0::etl_previous == nullptr); + CHECK(data2.BLink0::etl_next == nullptr); + CHECK(data3.BLink0::etl_previous == &data0); + CHECK(data3.BLink0::etl_next == nullptr); - CHECK(data3.SecondBLink::etl_previous == nullptr); - CHECK(data3.SecondBLink::etl_next == &data2); - CHECK(data2.SecondBLink::etl_previous == &data3); - CHECK(data2.SecondBLink::etl_next == &data1); - CHECK(data1.SecondBLink::etl_previous == &data2); - CHECK(data1.SecondBLink::etl_next == &data0); - CHECK(data0.SecondBLink::etl_previous == &data1); - CHECK(data0.SecondBLink::etl_next == nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data2); + CHECK(data2.BLink1::etl_previous == &data3); + CHECK(data2.BLink1::etl_next == &data1); + CHECK(data1.BLink1::etl_previous == &data2); + CHECK(data1.BLink1::etl_next == &data0); + CHECK(data0.BLink1::etl_previous == &data1); + CHECK(data0.BLink1::etl_next == nullptr); } - + //************************************************************************* TEST(test_self_link_bidirectional_link) { BData data0(0); - etl::link(data0, data0); + etl::link(data0, data0); - CHECK(data0.FirstBLink::etl_previous == &data0); - CHECK(data0.FirstBLink::etl_next == &data0); + CHECK(data0.BLink0::etl_previous == &data0); + CHECK(data0.BLink0::etl_next == &data0); - etl::unlink(data0); + etl::unlink(data0); - CHECK(data0.FirstBLink::etl_previous == &data0); - CHECK(data0.FirstBLink::etl_next == &data0); + CHECK(data0.BLink0::etl_previous == &data0); + CHECK(data0.BLink0::etl_next == &data0); } //************************************************************************* @@ -881,114 +823,114 @@ namespace TData data6(6); // First link - data0.FirstTLink::clear(); - etl::link_left(data0, data1); - etl::link_right(data0, data2); - CHECK(data0.FirstTLink::etl_left == &data1); - CHECK(data0.FirstTLink::etl_right == &data2); - CHECK(data1.FirstTLink::etl_parent == &data0); - CHECK(data2.FirstTLink::etl_parent == &data0); + data0.TLink0::clear(); + etl::link_left(data0, data1); + etl::link_right(data0, data2); + CHECK(data0.TLink0::etl_left == &data1); + CHECK(data0.TLink0::etl_right == &data2); + CHECK(data1.TLink0::etl_parent == &data0); + CHECK(data2.TLink0::etl_parent == &data0); - data0.FirstTLink::clear(); - etl::link_left(&data0, data1); - etl::link_right(&data0, data2); - CHECK(data0.FirstTLink::etl_left == &data1); - CHECK(data0.FirstTLink::etl_right == &data2); - CHECK(data1.FirstTLink::etl_parent == &data0); - CHECK(data2.FirstTLink::etl_parent == &data0); + data0.TLink0::clear(); + etl::link_left(&data0, data1); + etl::link_right(&data0, data2); + CHECK(data0.TLink0::etl_left == &data1); + CHECK(data0.TLink0::etl_right == &data2); + CHECK(data1.TLink0::etl_parent == &data0); + CHECK(data2.TLink0::etl_parent == &data0); - data0.FirstTLink::clear(); - etl::link_left(data0, &data1); - etl::link_right(data0, &data2); - CHECK(data0.FirstTLink::etl_left == &data1); - CHECK(data0.FirstTLink::etl_right == &data2); - CHECK(data1.FirstTLink::etl_parent == &data0); - CHECK(data2.FirstTLink::etl_parent == &data0); + data0.TLink0::clear(); + etl::link_left(data0, &data1); + etl::link_right(data0, &data2); + CHECK(data0.TLink0::etl_left == &data1); + CHECK(data0.TLink0::etl_right == &data2); + CHECK(data1.TLink0::etl_parent == &data0); + CHECK(data2.TLink0::etl_parent == &data0); - data0.FirstTLink::clear(); - etl::link_left(&data0, &data1); - etl::link_right(&data0, &data2); + data0.TLink0::clear(); + etl::link_left(&data0, &data1); + etl::link_right(&data0, &data2); - etl::link_left(data1, data3); - etl::link_right(data1, data4); - etl::link_left(data3, nullptr); - etl::link_right(data3, nullptr); - etl::link_left(data4, nullptr); - etl::link_right(data4, nullptr); + etl::link_left(data1, data3); + etl::link_right(data1, data4); + etl::link_left(data3, nullptr); + etl::link_right(data3, nullptr); + etl::link_left(data4, nullptr); + etl::link_right(data4, nullptr); - etl::link_left(data2, data5); - etl::link_right(data2, data6); - etl::link_left(data5, nullptr); - etl::link_right(data5, nullptr); - etl::link_left(data6, nullptr); - etl::link_right(data6, nullptr); + etl::link_left(data2, data5); + etl::link_right(data2, data6); + etl::link_left(data5, nullptr); + etl::link_right(data5, nullptr); + etl::link_left(data6, nullptr); + etl::link_right(data6, nullptr); // Second link - data0.SecondTLink::clear(); - etl::link_left(&data6, &data4); - etl::link_right(&data6, &data5); + data0.TLink1::clear(); + etl::link_left(&data6, &data4); + etl::link_right(&data6, &data5); - etl::link_left(data4, data0); - etl::link_right(data4, data1); - etl::link_left(data0, nullptr); - etl::link_right(data0, nullptr); - etl::link_left(data1, nullptr); - etl::link_right(data1, nullptr); + etl::link_left(data4, data0); + etl::link_right(data4, data1); + etl::link_left(data0, nullptr); + etl::link_right(data0, nullptr); + etl::link_left(data1, nullptr); + etl::link_right(data1, nullptr); - etl::link_left(data5, data2); - etl::link_right(data5, data3); - etl::link_left(data2, nullptr); - etl::link_right(data2, nullptr); - etl::link_left(data3, nullptr); - etl::link_right(data3, nullptr); + etl::link_left(data5, data2); + etl::link_right(data5, data3); + etl::link_left(data2, nullptr); + etl::link_right(data2, nullptr); + etl::link_left(data3, nullptr); + etl::link_right(data3, nullptr); // Check first - CHECK(data0.FirstTLink::etl_left == &data1); - CHECK(data0.FirstTLink::etl_right == &data2); - CHECK(data1.FirstTLink::etl_parent == &data0); - CHECK(data2.FirstTLink::etl_parent == &data0); + CHECK(data0.TLink0::etl_left == &data1); + CHECK(data0.TLink0::etl_right == &data2); + CHECK(data1.TLink0::etl_parent == &data0); + CHECK(data2.TLink0::etl_parent == &data0); - CHECK(data1.FirstTLink::etl_left == &data3); - CHECK(data1.FirstTLink::etl_right == &data4); - CHECK(data3.FirstTLink::etl_parent == &data1); - CHECK(data3.FirstTLink::etl_left == nullptr); - CHECK(data3.FirstTLink::etl_right == nullptr); - CHECK(data4.FirstTLink::etl_parent == &data1); - CHECK(data4.FirstTLink::etl_left == nullptr); - CHECK(data4.FirstTLink::etl_right == nullptr); + CHECK(data1.TLink0::etl_left == &data3); + CHECK(data1.TLink0::etl_right == &data4); + CHECK(data3.TLink0::etl_parent == &data1); + CHECK(data3.TLink0::etl_left == nullptr); + CHECK(data3.TLink0::etl_right == nullptr); + CHECK(data4.TLink0::etl_parent == &data1); + CHECK(data4.TLink0::etl_left == nullptr); + CHECK(data4.TLink0::etl_right == nullptr); - CHECK(data2.FirstTLink::etl_left == &data5); - CHECK(data2.FirstTLink::etl_right == &data6); - CHECK(data5.FirstTLink::etl_parent == &data2); - CHECK(data5.FirstTLink::etl_left == nullptr); - CHECK(data5.FirstTLink::etl_right == nullptr); - CHECK(data6.FirstTLink::etl_parent == &data2); - CHECK(data6.FirstTLink::etl_left == nullptr); - CHECK(data6.FirstTLink::etl_right == nullptr); + CHECK(data2.TLink0::etl_left == &data5); + CHECK(data2.TLink0::etl_right == &data6); + CHECK(data5.TLink0::etl_parent == &data2); + CHECK(data5.TLink0::etl_left == nullptr); + CHECK(data5.TLink0::etl_right == nullptr); + CHECK(data6.TLink0::etl_parent == &data2); + CHECK(data6.TLink0::etl_left == nullptr); + CHECK(data6.TLink0::etl_right == nullptr); // Check second - CHECK(data6.SecondTLink::etl_left == &data4); - CHECK(data6.SecondTLink::etl_right == &data5); - CHECK(data4.SecondTLink::etl_parent == &data6); - CHECK(data5.SecondTLink::etl_parent == &data6); - - CHECK(data4.SecondTLink::etl_left == &data0); - CHECK(data4.SecondTLink::etl_right == &data1); - CHECK(data0.SecondTLink::etl_parent == &data4); - CHECK(data0.SecondTLink::etl_left == nullptr); - CHECK(data0.SecondTLink::etl_right == nullptr); - CHECK(data1.SecondTLink::etl_parent == &data4); - CHECK(data1.SecondTLink::etl_left == nullptr); - CHECK(data1.SecondTLink::etl_right == nullptr); + CHECK(data6.TLink1::etl_left == &data4); + CHECK(data6.TLink1::etl_right == &data5); + CHECK(data4.TLink1::etl_parent == &data6); + CHECK(data5.TLink1::etl_parent == &data6); - CHECK(data5.SecondTLink::etl_left == &data2); - CHECK(data5.SecondTLink::etl_right == &data3); - CHECK(data2.SecondTLink::etl_parent == &data5); - CHECK(data2.SecondTLink::etl_left == nullptr); - CHECK(data2.SecondTLink::etl_right == nullptr); - CHECK(data3.SecondTLink::etl_parent == &data5); - CHECK(data3.SecondTLink::etl_left == nullptr); - CHECK(data3.SecondTLink::etl_right == nullptr); + CHECK(data4.TLink1::etl_left == &data0); + CHECK(data4.TLink1::etl_right == &data1); + CHECK(data0.TLink1::etl_parent == &data4); + CHECK(data0.TLink1::etl_left == nullptr); + CHECK(data0.TLink1::etl_right == nullptr); + CHECK(data1.TLink1::etl_parent == &data4); + CHECK(data1.TLink1::etl_left == nullptr); + CHECK(data1.TLink1::etl_right == nullptr); + + CHECK(data5.TLink1::etl_left == &data2); + CHECK(data5.TLink1::etl_right == &data3); + CHECK(data2.TLink1::etl_parent == &data5); + CHECK(data2.TLink1::etl_left == nullptr); + CHECK(data2.TLink1::etl_right == nullptr); + CHECK(data3.TLink1::etl_parent == &data5); + CHECK(data3.TLink1::etl_left == nullptr); + CHECK(data3.TLink1::etl_right == nullptr); } //************************************************************************* @@ -996,51 +938,51 @@ namespace { // Forward link FData fdata(0); - - fdata.FirstFLink::clear(); - fdata.SecondFLink::clear(); - CHECK(!fdata.FirstFLink::is_linked()); - CHECK(!fdata.SecondFLink::is_linked()); - etl::link(fdata, fdata); - CHECK(fdata.FirstFLink::is_linked()); - CHECK(!fdata.SecondFLink::is_linked()); + fdata.FLink0::clear(); + fdata.FLink1::clear(); + CHECK(!fdata.FLink0::is_linked()); + CHECK(!fdata.FLink1::is_linked()); - etl::link(fdata, fdata); - CHECK(fdata.FirstFLink::is_linked()); - CHECK(fdata.SecondFLink::is_linked()); + etl::link(fdata, fdata); + CHECK(fdata.FLink0::is_linked()); + CHECK(!fdata.FLink1::is_linked()); + + etl::link(fdata, fdata); + CHECK(fdata.FLink0::is_linked()); + CHECK(fdata.FLink1::is_linked()); // Bidirectional link BData bdata(0); - bdata.FirstBLink::clear(); - bdata.SecondBLink::clear(); - CHECK(!bdata.FirstBLink::is_linked()); - CHECK(!bdata.SecondBLink::is_linked()); + bdata.BLink0::clear(); + bdata.BLink1::clear(); + CHECK(!bdata.BLink0::is_linked()); + CHECK(!bdata.BLink1::is_linked()); - etl::link(bdata, bdata); - CHECK(bdata.FirstBLink::is_linked()); - CHECK(!bdata.SecondBLink::is_linked()); + etl::link(bdata, bdata); + CHECK(bdata.BLink0::is_linked()); + CHECK(!bdata.BLink1::is_linked()); - etl::link(bdata, bdata); - CHECK(bdata.FirstBLink::is_linked()); - CHECK(bdata.SecondBLink::is_linked()); + etl::link(bdata, bdata); + CHECK(bdata.BLink0::is_linked()); + CHECK(bdata.BLink1::is_linked()); // Tree link TData tdata(0); - tdata.FirstTLink::clear(); - tdata.SecondTLink::clear(); - CHECK(!tdata.FirstTLink::is_linked()); - CHECK(!tdata.SecondTLink::is_linked()); + tdata.TLink0::clear(); + tdata.TLink1::clear(); + CHECK(!tdata.TLink0::is_linked()); + CHECK(!tdata.TLink1::is_linked()); - etl::link_left(tdata, tdata); - CHECK(tdata.FirstTLink::is_linked()); - CHECK(!tdata.SecondTLink::is_linked()); + etl::link_left(tdata, tdata); + CHECK(tdata.TLink0::is_linked()); + CHECK(!tdata.TLink1::is_linked()); - etl::link_right(tdata, tdata); - CHECK(tdata.FirstTLink::is_linked()); - CHECK(tdata.SecondTLink::is_linked()); + etl::link_right(tdata, tdata); + CHECK(tdata.TLink0::is_linked()); + CHECK(tdata.TLink1::is_linked()); } //************************************************************************* @@ -1055,72 +997,198 @@ namespace MData data6(6); // Forward - data0.FirstFLink::clear(); - etl::link(data0, data1); - etl::link(data1, data2); - etl::link(data2, data3); - etl::link(data3, nullptr); + data0.FLink0::clear(); + etl::link(data0, data1); + etl::link(data1, data2); + etl::link(data2, data3); + etl::link(data3, nullptr); // Bidirectional - etl::link(nullptr, data3); - etl::link(data3, data2); - etl::link(data2, data1); - etl::link(data1, data0); - etl::link(data0, nullptr); + etl::link(nullptr, data3); + etl::link(data3, data2); + etl::link(data2, data1); + etl::link(data1, data0); + etl::link(data0, nullptr); // Tree - data0.ThirdTLink::clear(); - etl::link_left(data0, data1); - etl::link_right(data0, data2); - etl::link_left(data1, data3); - etl::link_right(data1, data4); - etl::link_left(data3, nullptr); - etl::link_right(data3, nullptr); - etl::link_left(data4, nullptr); - etl::link_right(data4, nullptr); - etl::link_left(data2, data5); - etl::link_right(data2, data6); - etl::link_left(data5, nullptr); - etl::link_right(data5, nullptr); - etl::link_left(data6, nullptr); - etl::link_right(data6, nullptr); + data0.TLink2::clear(); + etl::link_left(data0, data1); + etl::link_right(data0, data2); + etl::link_left(data1, data3); + etl::link_right(data1, data4); + etl::link_left(data3, nullptr); + etl::link_right(data3, nullptr); + etl::link_left(data4, nullptr); + etl::link_right(data4, nullptr); + etl::link_left(data2, data5); + etl::link_right(data2, data6); + etl::link_left(data5, nullptr); + etl::link_right(data5, nullptr); + etl::link_left(data6, nullptr); + etl::link_right(data6, nullptr); - CHECK(data0.FirstFLink::etl_next == &data1); - CHECK(data1.FirstFLink::etl_next == &data2); - CHECK(data2.FirstFLink::etl_next == &data3); - CHECK(data3.FirstFLink::etl_next == nullptr); + CHECK(data0.FLink0::etl_next == &data1); + CHECK(data1.FLink0::etl_next == &data2); + CHECK(data2.FLink0::etl_next == &data3); + CHECK(data3.FLink0::etl_next == nullptr); - CHECK(data3.SecondBLink::etl_previous == nullptr); - CHECK(data3.SecondBLink::etl_next == &data2); - CHECK(data2.SecondBLink::etl_previous == &data3); - CHECK(data2.SecondBLink::etl_next == &data1); - CHECK(data1.SecondBLink::etl_previous == &data2); - CHECK(data1.SecondBLink::etl_next == &data0); - CHECK(data0.SecondBLink::etl_previous == &data1); - CHECK(data0.SecondBLink::etl_next == nullptr); + CHECK(data3.BLink1::etl_previous == nullptr); + CHECK(data3.BLink1::etl_next == &data2); + CHECK(data2.BLink1::etl_previous == &data3); + CHECK(data2.BLink1::etl_next == &data1); + CHECK(data1.BLink1::etl_previous == &data2); + CHECK(data1.BLink1::etl_next == &data0); + CHECK(data0.BLink1::etl_previous == &data1); + CHECK(data0.BLink1::etl_next == nullptr); - CHECK(data0.ThirdTLink::etl_left == &data1); - CHECK(data0.ThirdTLink::etl_right == &data2); - CHECK(data1.ThirdTLink::etl_parent == &data0); - CHECK(data2.ThirdTLink::etl_parent == &data0); + CHECK(data0.TLink2::etl_left == &data1); + CHECK(data0.TLink2::etl_right == &data2); + CHECK(data1.TLink2::etl_parent == &data0); + CHECK(data2.TLink2::etl_parent == &data0); - CHECK(data1.ThirdTLink::etl_left == &data3); - CHECK(data1.ThirdTLink::etl_right == &data4); - CHECK(data3.ThirdTLink::etl_parent == &data1); - CHECK(data3.ThirdTLink::etl_left == nullptr); - CHECK(data3.ThirdTLink::etl_right == nullptr); - CHECK(data4.ThirdTLink::etl_parent == &data1); - CHECK(data4.ThirdTLink::etl_left == nullptr); - CHECK(data4.ThirdTLink::etl_right == nullptr); + CHECK(data1.TLink2::etl_left == &data3); + CHECK(data1.TLink2::etl_right == &data4); + CHECK(data3.TLink2::etl_parent == &data1); + CHECK(data3.TLink2::etl_left == nullptr); + CHECK(data3.TLink2::etl_right == nullptr); + CHECK(data4.TLink2::etl_parent == &data1); + CHECK(data4.TLink2::etl_left == nullptr); + CHECK(data4.TLink2::etl_right == nullptr); - CHECK(data2.ThirdTLink::etl_left == &data5); - CHECK(data2.ThirdTLink::etl_right == &data6); - CHECK(data5.ThirdTLink::etl_parent == &data2); - CHECK(data5.ThirdTLink::etl_left == nullptr); - CHECK(data5.ThirdTLink::etl_right == nullptr); - CHECK(data6.ThirdTLink::etl_parent == &data2); - CHECK(data6.ThirdTLink::etl_left == nullptr); - CHECK(data6.ThirdTLink::etl_right == nullptr); + CHECK(data2.TLink2::etl_left == &data5); + CHECK(data2.TLink2::etl_right == &data6); + CHECK(data5.TLink2::etl_parent == &data2); + CHECK(data5.TLink2::etl_left == nullptr); + CHECK(data5.TLink2::etl_right == nullptr); + CHECK(data6.TLink2::etl_parent == &data2); + CHECK(data6.TLink2::etl_left == nullptr); + CHECK(data6.TLink2::etl_right == nullptr); + } + + //************************************************************************* + TEST(test_tree_link_rotate_left) + { + TLink0 r; + TLink0 a; + TLink0 b; + TLink0 c; + TLink0 d; + TLink0 e; + + r.clear(); + c.clear(); + d.clear(); + e.clear(); + etl::link_left(r, b); + etl::link_right(b, a); + etl::link_left(b, d); + etl::link_right(a, c); + etl::link_left(a, e); + + etl::link_rotate_left(b, a); + + CHECK(a.etl_parent == &r); + CHECK(b.etl_parent == &a); + CHECK(e.etl_parent == &b); + CHECK(d.etl_parent == &b); + CHECK(c.etl_parent == &a); + CHECK(a.etl_left == &b); + CHECK(a.etl_right == &c); + CHECK(b.etl_left == &d); + CHECK(b.etl_right == &e); + } + + //************************************************************************* + TEST(test_tree_link_rotate_left_nullptr) + { + TLink0 r; + TLink0 a; + TLink0 b; + TLink0 c; + TLink0 d; + + r.clear(); + a.clear(); + c.clear(); + d.clear(); + etl::link_left(r, b); + etl::link_right(b, a); + etl::link_left(b, d); + etl::link_right(a, c); + + etl::link_rotate_left(b, a); + + CHECK(a.etl_parent == &r); + CHECK(b.etl_parent == &a); + CHECK(d.etl_parent == &b); + CHECK(c.etl_parent == &a); + CHECK(a.etl_left == &b); + CHECK(a.etl_right == &c); + CHECK(b.etl_left == &d); + CHECK(b.etl_right == nullptr); + } + + //************************************************************************* + TEST(test_tree_link_rotate_right) + { + TLink0 r; + TLink0 a; + TLink0 b; + TLink0 c; + TLink0 d; + TLink0 e; + + r.clear(); + c.clear(); + d.clear(); + e.clear(); + etl::link_left(r, a); + etl::link_left(a, b); + etl::link_left(b, d); + etl::link_right(a, c); + etl::link_right(b, e); + + etl::link_rotate_right(a, b); + + CHECK(b.etl_parent == &r); + CHECK(d.etl_parent == &b); + CHECK(a.etl_parent == &b); + CHECK(e.etl_parent == &a); + CHECK(c.etl_parent == &a); + CHECK(b.etl_left == &d); + CHECK(b.etl_right == &a); + CHECK(a.etl_left == &e); + CHECK(a.etl_right == &c); + } + + //************************************************************************* + TEST(test_tree_link_rotate_right_nullptr) + { + TLink0 r; + TLink0 a; + TLink0 b; + TLink0 c; + TLink0 d; + + r.clear(); + b.clear(); + c.clear(); + d.clear(); + etl::link_left(r, a); + etl::link_left(a, b); + etl::link_left(b, d); + etl::link_right(a, c); + + etl::link_rotate_right(a, b); + + CHECK(b.etl_parent == &r); + CHECK(d.etl_parent == &b); + CHECK(a.etl_parent == &b); + CHECK(c.etl_parent == &a); + CHECK(b.etl_left == &d); + CHECK(b.etl_right == &a); + CHECK(a.etl_left == nullptr); + CHECK(a.etl_right == &c); } }; } diff --git a/test/test_intrusive_list.cpp b/test/test_intrusive_list.cpp index d7c16ff8..34b3ca54 100644 --- a/test/test_intrusive_list.cpp +++ b/test/test_intrusive_list.cpp @@ -84,25 +84,25 @@ namespace }; //*************************************************************************** - bool operator ==(const ItemDCNode& lhs, const ItemDCNode& rhs) - { - return lhs.data == rhs.data; - } +// bool operator ==(const ItemDCNode& lhs, const ItemDCNode& rhs) +// { +// return lhs.data == rhs.data; +// } bool operator ==(const ItemNDCNode& lhs, const ItemNDCNode& rhs) { return lhs.data == rhs.data; } - bool operator !=(const ItemDCNode& lhs, const ItemDCNode& rhs) - { - return lhs.data != rhs.data; - } +// bool operator !=(const ItemDCNode& lhs, const ItemDCNode& rhs) +// { +// return lhs.data != rhs.data; +// } - bool operator !=(const ItemNDCNode& lhs, const ItemNDCNode& rhs) - { - return lhs.data != rhs.data; - } +// bool operator !=(const ItemNDCNode& lhs, const ItemNDCNode& rhs) +// { +// return lhs.data != rhs.data; +// } std::ostream& operator << (std::ostream& os, const ItemNDCNode& node) { @@ -136,10 +136,10 @@ namespace typedef std::vector InitialDataNDC; } -namespace -{ +namespace +{ SUITE(test_intrusive_list) - { + { InitialDataNDC unsorted_data; InitialDataNDC sorted_data; InitialDataNDC sorted_data2; @@ -151,7 +151,7 @@ namespace InitialDataNDC merge_data2; InitialDataNDC merge_data3; InitialDataNDC merge_data4; - + //************************************************************************* struct SetupFixture { @@ -200,11 +200,11 @@ namespace DataNDC0 data0; CHECK(data0.begin() == data0.end()); - + DataNDC0::const_iterator begin = data0.begin(); DataNDC0::const_iterator end = data0.end(); CHECK(begin == end); - + CHECK(data0.cbegin() == data0.cend()); } @@ -224,7 +224,7 @@ namespace TEST_FIXTURE(SetupFixture, test_const_iterator) { bool are_equal; - + DataNDC0 data0(sorted_data.begin(), sorted_data.end()); are_equal = std::equal(data0.cbegin(), data0.cend(), sorted_data.begin()); @@ -282,7 +282,7 @@ namespace std::list compare0; std::list compare1; - + DataNDC0 data0; DataNDC1 data1; @@ -301,7 +301,7 @@ namespace compare0.push_front(node4); compare0.push_front(node6); compare0.push_front(node7); - + data0.push_front(node0); data0.push_front(node1); data0.push_front(node2); @@ -311,7 +311,7 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); - CHECK_EQUAL(6, data0.size()); + CHECK_EQUAL(6U, data0.size()); CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); compare1.push_front(node0); @@ -330,7 +330,7 @@ namespace are_equal = std::equal(data1.begin(), data1.end(), compare1.begin()); CHECK(are_equal); - CHECK_EQUAL(6, data1.size()); + CHECK_EQUAL(6U, data1.size()); CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); } @@ -360,12 +360,12 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); offset = 0; @@ -385,12 +385,12 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -414,7 +414,7 @@ namespace are_equal = std::equal(data1.begin(), data1.end(), test1.begin()); CHECK(are_equal); CHECK_EQUAL(test1.size(), data1.size()); - CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(test1.size(), size_t(std::distance(data1.begin(), data1.end()))); compare.assign(test1.begin(), test1.end()); data0.assign(test1.begin(), test1.end()); @@ -437,7 +437,7 @@ namespace are_equal = std::equal(data1.begin(), data1.end(), test1.begin()); CHECK(are_equal); CHECK_EQUAL(test1.size(), data1.size()); - CHECK_EQUAL(test1.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(test1.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -471,7 +471,7 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); - CHECK_EQUAL(6, data0.size()); + CHECK_EQUAL(6U, data0.size()); CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); } @@ -502,7 +502,7 @@ namespace data1.push_front(node5); data1.push_front(node6); - CHECK_EQUAL(6, data0.size()); + CHECK_EQUAL(6U, data0.size()); CHECK_EQUAL(6, std::distance(data0.begin(), data0.end())); CHECK(!data0.empty()); @@ -512,17 +512,17 @@ namespace data0.pop_front(); data0.pop_front(); - CHECK_EQUAL(1, data0.size()); + CHECK_EQUAL(1U, data0.size()); CHECK_EQUAL(1, std::distance(data0.begin(), data0.end())); CHECK(!data0.empty()); data0.pop_front(); - CHECK_EQUAL(0, data0.size()); + CHECK_EQUAL(0U, data0.size()); CHECK_EQUAL(0, std::distance(data0.begin(), data0.end())); CHECK(data0.empty()); - CHECK_EQUAL(6, data1.size()); + CHECK_EQUAL(6U, data1.size()); CHECK_EQUAL(6, std::distance(data1.begin(), data1.end())); CHECK(!data1.empty()); } @@ -557,12 +557,12 @@ namespace CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); are_equal = *i_data == *i_compare_data; CHECK(are_equal); @@ -578,12 +578,12 @@ namespace CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); are_equal = *i_data == *i_compare_data; CHECK(are_equal); @@ -619,12 +619,12 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -651,12 +651,12 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin()); CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -691,13 +691,13 @@ namespace are_equal = std::equal(data0.begin(), data0.end(), unique_data.begin()); CHECK(are_equal); CHECK_EQUAL(unique_data.size(), data0.size()); - CHECK_EQUAL(unique_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(unique_data.size(), size_t(std::distance(data0.begin(), data0.end()))); // data1 should not have changed. are_equal = std::equal(data1.begin(), data1.end(), non_unique_data.begin()); CHECK(are_equal); CHECK_EQUAL(non_unique_data.size(), data1.size()); - CHECK_EQUAL(non_unique_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(non_unique_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -717,12 +717,12 @@ namespace CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -742,12 +742,12 @@ namespace CHECK(are_equal); CHECK_EQUAL(compare_data.size(), data0.size()); - CHECK_EQUAL(compare_data.size(), std::distance(data0.begin(), data0.end())); + CHECK_EQUAL(compare_data.size(), size_t(std::distance(data0.begin(), data0.end()))); are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin()); CHECK(are_equal); CHECK_EQUAL(sorted_data.size(), data1.size()); - CHECK_EQUAL(sorted_data.size(), std::distance(data1.begin(), data1.end())); + CHECK_EQUAL(sorted_data.size(), size_t(std::distance(data1.begin(), data1.end()))); } //************************************************************************* @@ -899,13 +899,9 @@ namespace DataNDC0::iterator idata_destination = data0.begin(); std::advance(idata_destination, 3); - std::list compare0(data0.begin(), data0.end()); - - std::list::iterator icompare_destination = compare0.begin(); - std::advance(icompare_destination, 3); + std::list compare0(sorted_data2.begin(), sorted_data2.end()); data0.splice(idata_destination, data0); - compare0.splice(icompare_destination, compare0); are_equal = std::equal(data0.begin(), data0.end(), compare0.begin()); CHECK(are_equal); diff --git a/test/test_intrusive_stack.cpp b/test/test_intrusive_stack.cpp index cec894da..da4da4ba 100644 --- a/test/test_intrusive_stack.cpp +++ b/test/test_intrusive_stack.cpp @@ -35,19 +35,10 @@ SOFTWARE. namespace { - enum - { - DEFAULT, - AUTO, - CHECKED - }; + typedef etl::forward_link<0> link0; + typedef etl::bidirectional_link<1> link1; - etl::forward_link link; - - typedef etl::forward_link default_link; - typedef etl::forward_link checked_link; - - struct Data : public default_link, public checked_link + struct Data : public link0, public link1 { Data(int i) : i(i) @@ -79,25 +70,25 @@ namespace //************************************************************************* TEST(test_constructor) { - etl::intrusive_stack stackD; - etl::intrusive_stack stackC; + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; CHECK(stackD.empty()); CHECK(stackC.empty()); - CHECK_EQUAL(0, stackD.size()); - CHECK_EQUAL(0, stackC.size()); + CHECK_EQUAL(0U, stackD.size()); + CHECK_EQUAL(0U, stackC.size()); } //************************************************************************* TEST(test_empty) { - etl::intrusive_stack stackD; - etl::intrusive_stack stackC; - Data data1(1); Data data2(2); + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + CHECK(stackD.empty()); CHECK(stackC.empty()); @@ -106,21 +97,18 @@ namespace CHECK(!stackD.empty()); CHECK(!stackC.empty()); - - data1.checked_link::clear(); - data2.checked_link::clear(); } //************************************************************************* TEST(test_size) { - etl::intrusive_stack stackD; - etl::intrusive_stack stackC; - Data data1(1); Data data2(2); Data data3(3); + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + stackD.push(data1); stackD.push(data2); stackD.push(data3); @@ -130,21 +118,18 @@ namespace CHECK_EQUAL(3U, stackD.size()); CHECK_EQUAL(2U, stackC.size()); - - data1.checked_link::clear(); - data2.checked_link::clear(); } //************************************************************************* TEST(test_clear) { - etl::intrusive_stack stackD; - etl::intrusive_stack stackC; - Data data1(1); Data data2(2); Data data3(3); + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + stackD.push(data1); stackD.push(data2); stackD.push(data3); @@ -162,13 +147,13 @@ namespace //************************************************************************* TEST(test_push) { - etl::intrusive_stack stackD; - etl::intrusive_stack stackC; - Data data1(1); Data data2(2); Data data3(3); + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + stackD.push(data1); CHECK_EQUAL(stackD.top(), data1); @@ -183,22 +168,18 @@ namespace stackC.push(data2); CHECK_EQUAL(stackC.top(), data2); - - data1.checked_link::clear(); - data2.checked_link::clear(); } - //************************************************************************* TEST(test_pop) { - etl::intrusive_stack stackD; - etl::intrusive_stack stackC; - Data data1(1); Data data2(2); Data data3(3); + etl::intrusive_stack stackD; + etl::intrusive_stack stackC; + stackD.push(data1); stackD.push(data2); stackD.push(data3); @@ -219,21 +200,18 @@ namespace CHECK_EQUAL(stackC.top(), data1); stackC.pop(); CHECK(stackC.empty()); - - data1.checked_link::clear(); - data2.checked_link::clear(); } //************************************************************************* TEST(test_top_const) { - etl::intrusive_stack stackD; - const etl::intrusive_stack& stackDR = stackD; - Data data1(1); Data data2(2); Data data3(3); + etl::intrusive_stack stackD; + const etl::intrusive_stack& stackDR = stackD; + stackD.push(data1); stackD.push(data2); stackD.push(data3); From 4036d5db3cf4634ccd7052f7fdf4829a86c8da53 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:15:47 +0000 Subject: [PATCH 79/93] Removed redundant include --- src/intrusive_forward_list.h | 1 - src/intrusive_list.h | 1 - src/intrusive_queue.h | 1 - src/intrusive_stack.h | 1 - 4 files changed, 4 deletions(-) diff --git a/src/intrusive_forward_list.h b/src/intrusive_forward_list.h index 8acd26ed..43f07e05 100644 --- a/src/intrusive_forward_list.h +++ b/src/intrusive_forward_list.h @@ -48,7 +48,6 @@ SOFTWARE. #include "error_handler.h" #include "intrusive_links.h" #include "algorithm.h" -#include "private/counter_type.h" #undef ETL_FILE #define ETL_FILE "20" diff --git a/src/intrusive_list.h b/src/intrusive_list.h index 981a8d80..298c0ab3 100644 --- a/src/intrusive_list.h +++ b/src/intrusive_list.h @@ -49,7 +49,6 @@ SOFTWARE. #include "intrusive_links.h" #include "static_assert.h" #include "algorithm.h" -#include "private/counter_type.h" #undef ETL_FILE #define ETL_FILE "21" diff --git a/src/intrusive_queue.h b/src/intrusive_queue.h index efd77e41..e48111b9 100644 --- a/src/intrusive_queue.h +++ b/src/intrusive_queue.h @@ -36,7 +36,6 @@ SOFTWARE. #include "type_traits.h" #include "error_handler.h" #include "intrusive_links.h" -#include "private/counter_type.h" #define ETL_FILE "29" diff --git a/src/intrusive_stack.h b/src/intrusive_stack.h index ffa61e72..cb358609 100644 --- a/src/intrusive_stack.h +++ b/src/intrusive_stack.h @@ -36,7 +36,6 @@ SOFTWARE. #include "type_traits.h" #include "error_handler.h" #include "intrusive_links.h" -#include "private/counter_type.h" #define ETL_FILE "28" From 37f4dac47d1833dcde68da920bafa588ede1a4f3 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:17:45 +0000 Subject: [PATCH 80/93] Restored commented out tests --- test/test_instance_count.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/test_instance_count.cpp b/test/test_instance_count.cpp index 885963bc..5be67615 100644 --- a/test/test_instance_count.cpp +++ b/test/test_instance_count.cpp @@ -47,25 +47,25 @@ namespace struct Test2 : public etl::instance_count {}; - CHECK_EQUAL(0, Test1::get_instance_count()); - CHECK_EQUAL(0, Test2::get_instance_count()); + CHECK_EQUAL(0U, Test1::get_instance_count()); + CHECK_EQUAL(0U, Test2::get_instance_count()); - //Test1 test1a; - //CHECK_EQUAL(1, Test1::get_instance_count()); - //CHECK_EQUAL(0, Test2::get_instance_count()); + Test1 test1a; + CHECK_EQUAL(1U, Test1::get_instance_count()); + CHECK_EQUAL(0U, Test2::get_instance_count()); - //Test1 test1b; - //Test2 test2a; - //CHECK_EQUAL(2, Test1::get_instance_count()); - //CHECK_EQUAL(1, Test2::get_instance_count()); + Test1 test1b; + Test2 test2a; + CHECK_EQUAL(2U, Test1::get_instance_count()); + CHECK_EQUAL(1U, Test2::get_instance_count()); - //Test2* ptest2b = new Test2; - //CHECK_EQUAL(2, Test1::get_instance_count()); - //CHECK_EQUAL(2, Test2::get_instance_count()); + Test2* ptest2b = new Test2; + CHECK_EQUAL(2U, Test1::get_instance_count()); + CHECK_EQUAL(2U, Test2::get_instance_count()); - //delete ptest2b; - //CHECK_EQUAL(2, Test1::get_instance_count()); - //CHECK_EQUAL(1, Test2::get_instance_count()); + delete ptest2b; + CHECK_EQUAL(2U, Test1::get_instance_count()); + CHECK_EQUAL(1U, Test2::get_instance_count()); } }; -} \ No newline at end of file +} From 9e9fa45f1342d40d43e1ed11acec2b617af1f0e2 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:18:05 +0000 Subject: [PATCH 81/93] Fixed GCC warnings --- test/test_fnv_1.cpp | 24 ++++++++++++------------ test/test_forward_list.cpp | 4 ++-- test/test_hash.cpp | 36 ++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/test/test_fnv_1.cpp b/test/test_fnv_1.cpp index 33b6ed67..8f8d4ccf 100644 --- a/test/test_fnv_1.cpp +++ b/test/test_fnv_1.cpp @@ -46,7 +46,7 @@ namespace uint32_t hash = etl::fnv_1_32(data.begin(), data.end()); - CHECK_EQUAL(0x24148816, hash); + CHECK_EQUAL(0x24148816U, hash); } //************************************************************************* @@ -63,7 +63,7 @@ namespace uint32_t hash = fnv_1_32_calculator.value(); - CHECK_EQUAL(0x24148816, hash); + CHECK_EQUAL(0x24148816U, hash); } //************************************************************************* @@ -77,7 +77,7 @@ namespace uint32_t hash = fnv_1_32_calculator.value(); - CHECK_EQUAL(0x24148816, hash); + CHECK_EQUAL(0x24148816U, hash); } //************************************************************************* @@ -102,7 +102,7 @@ namespace uint32_t hash = etl::fnv_1a_32(data.begin(), data.end()); - CHECK_EQUAL(0xBB86B11C, hash); + CHECK_EQUAL(0xBB86B11CU, hash); } //************************************************************************* @@ -119,7 +119,7 @@ namespace uint32_t hash = fnv_1a_32_calculator.value(); - CHECK_EQUAL(0xBB86B11C, hash); + CHECK_EQUAL(0xBB86B11CU, hash); } //************************************************************************* @@ -133,7 +133,7 @@ namespace uint32_t hash = fnv_1a_32_calculator.value(); - CHECK_EQUAL(0xBB86B11C, hash); + CHECK_EQUAL(0xBB86B11CU, hash); } //************************************************************************* @@ -158,7 +158,7 @@ namespace uint64_t hash = etl::fnv_1_64(data.begin(), data.end()); - CHECK_EQUAL(0xA72FFC362BF916D6, hash); + CHECK_EQUAL(0xA72FFC362BF916D6U, hash); } //************************************************************************* @@ -175,7 +175,7 @@ namespace uint64_t hash = fnv_1_64_calculator; - CHECK_EQUAL(0xA72FFC362BF916D6, hash); + CHECK_EQUAL(0xA72FFC362BF916D6U, hash); } //************************************************************************* @@ -189,7 +189,7 @@ namespace uint64_t hash = fnv_1_64_calculator.value(); - CHECK_EQUAL(0xA72FFC362BF916D6, hash); + CHECK_EQUAL(0xA72FFC362BF916D6U, hash); } //************************************************************************* @@ -214,7 +214,7 @@ namespace uint64_t hash = etl::fnv_1a_64(data.begin(), data.end()); - CHECK_EQUAL(0x06D5573923C6CDFC, hash); + CHECK_EQUAL(0x06D5573923C6CDFCU, hash); } //************************************************************************* @@ -231,7 +231,7 @@ namespace uint64_t hash = fnv_1a_64_calculator; - CHECK_EQUAL(0x06D5573923C6CDFC, hash); + CHECK_EQUAL(0x06D5573923C6CDFCU, hash); } //************************************************************************* @@ -245,7 +245,7 @@ namespace uint64_t hash = fnv_1a_64_calculator.value(); - CHECK_EQUAL(0x06D5573923C6CDFC, hash); + CHECK_EQUAL(0x06D5573923C6CDFCU, hash); } //************************************************************************* diff --git a/test/test_forward_list.cpp b/test/test_forward_list.cpp index 45d35805..44911f72 100644 --- a/test/test_forward_list.cpp +++ b/test/test_forward_list.cpp @@ -423,7 +423,7 @@ namespace CHECK_NO_THROW(data.push_front(ItemNDC("5"))); CHECK_NO_THROW(data.push_front(ItemNDC("6"))); - CHECK_EQUAL(6, data.size()); + CHECK_EQUAL(6U, data.size()); CHECK_EQUAL(6, std::distance(data.begin(), data.end())); are_equal = std::equal(data.begin(), data.end(), compare_data.begin()); @@ -457,7 +457,7 @@ namespace CHECK_NO_THROW(data.push_front()); data.front() = ItemNDC("6"); - CHECK_EQUAL(6, data.size()); + CHECK_EQUAL(6U, data.size()); CHECK_EQUAL(6, std::distance(data.begin(), data.end())); are_equal = std::equal(data.begin(), data.end(), compare_data.begin()); diff --git a/test/test_hash.cpp b/test/test_hash.cpp index 53e50d70..d8e42e6b 100644 --- a/test/test_hash.cpp +++ b/test/test_hash.cpp @@ -43,10 +43,10 @@ namespace TEST(test_hash_bool) { size_t hash = etl::hash()(false); - CHECK_EQUAL(0, hash); + CHECK_EQUAL(0U, hash); hash = etl::hash()(true); - CHECK_EQUAL(1, hash); + CHECK_EQUAL(1U, hash); } //************************************************************************* @@ -54,7 +54,7 @@ namespace { size_t hash = etl::hash()((char)(0x5A)); - CHECK_EQUAL(0x5A, hash); + CHECK_EQUAL(0x5AU, hash); } //************************************************************************* @@ -62,7 +62,7 @@ namespace { size_t hash = etl::hash()((signed char)(0x5A)); - CHECK_EQUAL(0x5A, hash); + CHECK_EQUAL(0x5AU, hash); } //************************************************************************* @@ -70,7 +70,7 @@ namespace { size_t hash = etl::hash()((unsigned char)(0x5A)); - CHECK_EQUAL(0x5A, hash); + CHECK_EQUAL(0x5AU, hash); } //************************************************************************* @@ -78,7 +78,7 @@ namespace { size_t hash = etl::hash()((short)(0x5AA5)); - CHECK_EQUAL(0x5AA5, hash); + CHECK_EQUAL(0x5AA5U, hash); } //************************************************************************* @@ -86,7 +86,7 @@ namespace { size_t hash = etl::hash()((unsigned short)(0x5AA5)); - CHECK_EQUAL(0x5AA5, hash); + CHECK_EQUAL(0x5AA5U, hash); } //************************************************************************* @@ -94,7 +94,7 @@ namespace { size_t hash = etl::hash()((int)(0x5AA555AA)); - CHECK_EQUAL(0x5AA555AA, hash); + CHECK_EQUAL(0x5AA555AAU, hash); } //************************************************************************* @@ -102,7 +102,7 @@ namespace { size_t hash = etl::hash()((unsigned int)(0x5AA555AA)); - CHECK_EQUAL(0x5AA555AA, hash); + CHECK_EQUAL(0x5AA555AAU, hash); } //************************************************************************* @@ -110,7 +110,7 @@ namespace { size_t hash = etl::hash()((long)(0x5AA555AA)); - CHECK_EQUAL(0x5AA555AA, hash); + CHECK_EQUAL(0x5AA555AAU, hash); } //************************************************************************* @@ -118,7 +118,7 @@ namespace { size_t hash = etl::hash()((unsigned long)(0x5AA555AA)); - CHECK_EQUAL(0x5AA555AA, hash); + CHECK_EQUAL(0x5AA555AAU, hash); } //************************************************************************* @@ -127,9 +127,9 @@ namespace size_t hash = etl::hash()((long long)(0x5AA555AA3CC333CC)); if (sizeof(size_t) == sizeof(long long)) - CHECK_EQUAL(0x5AA555AA3CC333CC, hash); + CHECK_EQUAL(0x5AA555AA3CC333CCU, hash); else - CHECK_EQUAL(0xEC6A8D69, hash); + CHECK_EQUAL(0xEC6A8D69U, hash); } //************************************************************************* @@ -138,9 +138,9 @@ namespace size_t hash = etl::hash()((unsigned long long)(0x5AA555AA3CC333CC)); if (sizeof(size_t) == sizeof(unsigned long long)) - CHECK_EQUAL(0x5AA555AA3CC333CC, hash); + CHECK_EQUAL(0x5AA555AA3CC333CCU, hash); else - CHECK_EQUAL(0xEC6A8D69, hash); + CHECK_EQUAL(0xEC6A8D69U, hash); } //************************************************************************* @@ -148,7 +148,7 @@ namespace { size_t hash = etl::hash()((float)(1.2345)); - CHECK_EQUAL(0X3F9E0419, hash); + CHECK_EQUAL(0X3F9E0419U, hash); } //************************************************************************* @@ -157,9 +157,9 @@ namespace size_t hash = etl::hash()((double)(1.2345)); if (sizeof(size_t) == sizeof(double)) - CHECK_EQUAL(0X3FF3C083126E978D, hash); + CHECK_EQUAL(0X3FF3C083126E978DU, hash); else - CHECK_EQUAL(0x86FBF224, hash); + CHECK_EQUAL(0x86FBF224U, hash); } //************************************************************************* From a27ac63149208806a75ce3f62232c03e1012677d Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:18:26 +0000 Subject: [PATCH 82/93] Removed redundant code --- test/test_exception.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/test/test_exception.cpp b/test/test_exception.cpp index 9d1854cc..c99816b4 100644 --- a/test/test_exception.cpp +++ b/test/test_exception.cpp @@ -40,10 +40,6 @@ namespace { etl::exception e("An exception", "Some file", 123); - std::string what(e.what()); - std::string file(e.file_name()); - int line(e.line_number()); - CHECK_EQUAL(std::string("An exception"), std::string(e.what())); CHECK_EQUAL(std::string("Some file"), std::string(e.file_name())); CHECK_EQUAL(123, e.line_number()); @@ -60,14 +56,10 @@ namespace } catch (etl::exception& c) { - std::string what(c.what()); - std::string file(c.file_name()); - int line(c.line_number()); - CHECK_EQUAL(std::string("An exception"), std::string(c.what())); CHECK_EQUAL(std::string("Some file"), std::string(c.file_name())); CHECK_EQUAL(123, c.line_number()); } } }; -} \ No newline at end of file +} From 0179e7123d0db759b5a008d511f5bb7d718ba94c Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:19:37 +0000 Subject: [PATCH 83/93] Changed string length calls. --- test/test_bloom_filter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_bloom_filter.cpp b/test/test_bloom_filter.cpp index 46341f12..eed634bb 100644 --- a/test/test_bloom_filter.cpp +++ b/test/test_bloom_filter.cpp @@ -28,8 +28,8 @@ SOFTWARE. #include -#include #include +#include #include "../src/bloom_filter.h" @@ -38,13 +38,15 @@ SOFTWARE. #include "../src/crc16_ccitt.h" #include "../src/crc32.h" +#include "../src/char_traits.h" + struct hash1_t { typedef const char* argument_type; size_t operator ()(argument_type text) const { - return etl::fnv_1a_32(text, text + strlen(text)); + return etl::fnv_1a_32(text, text + etl::char_traits::length(text)); } }; @@ -54,7 +56,7 @@ struct hash2_t size_t operator ()(argument_type text) const { - return etl::crc32(text, text + strlen(text)); + return etl::crc32(text, text + etl::char_traits::length(text)); } }; @@ -64,7 +66,7 @@ struct hash3_t size_t operator ()(argument_type text) const { - return etl::crc16(text, text + strlen(text)) | (etl::crc16_ccitt(text, text + strlen(text)) << 16); + return etl::crc16(text, text + etl::char_traits::length(text)) | (etl::crc16_ccitt(text, text + etl::char_traits::length(text)) << 16); } }; @@ -106,7 +108,7 @@ namespace CHECK(!any_exist); size_t usage = bloom.usage(); - CHECK(usage >= 0); + CHECK(usage > 0); CHECK(usage < 100); size_t count = bloom.count(); @@ -145,7 +147,6 @@ namespace CHECK(!any_exist); size_t usage = bloom.usage(); - CHECK(usage >= 0); CHECK(usage < 100); size_t count = bloom.count(); @@ -184,7 +185,6 @@ namespace CHECK(!any_exist); size_t usage = bloom.usage(); - CHECK(usage >= 0); CHECK(usage < 100); size_t count = bloom.count(); From 912cb40d0cf57b27e9197edd609d020e5b98b265 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:20:27 +0000 Subject: [PATCH 84/93] Fixed GCC warnings Removed redundant code --- test/test_bitset.cpp | 52 +++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/test/test_bitset.cpp b/test/test_bitset.cpp index a0ce46a4..6a863299 100644 --- a/test/test_bitset.cpp +++ b/test/test_bitset.cpp @@ -432,6 +432,8 @@ namespace bool bc = ~compare[3]; bool bd = ~data[3]; + CHECK_EQUAL(bc, bd); + for (size_t i = 0; i < data.size(); ++i) { CHECK_EQUAL(compare.test(i), data.test(i)); @@ -593,7 +595,7 @@ namespace etl::bitset<60> data2(0x23456789); etl::bitset<60> data3(0x12345678 & 0x23456789); - etl::bitset<60>& rdata = data2 &= data1; + data2 &= data1; CHECK(data2 == data3); } @@ -616,7 +618,7 @@ namespace etl::bitset<60> data2(0x23456789); etl::bitset<60> data3(0x12345678 | 0x23456789); - etl::bitset<60>& rdata = data2 |= data1; + data2 |= data1; CHECK(data2 == data3); } @@ -639,7 +641,7 @@ namespace etl::bitset<60> data2(0x23456789); etl::bitset<60> data3(0x12345678 ^ 0x23456789); - etl::bitset<60>& rdata = data2 ^= data1; + data2 ^= data1; CHECK(data2 == data3); } @@ -723,32 +725,32 @@ namespace etl::bitset<6> data; data.set("000000"); - CHECK_EQUAL(0, data.find_first(false)); + CHECK_EQUAL(0U, data.find_first(false)); CHECK_EQUAL(etl::ibitset::npos, data.find_first(true)); data.set("111111"); CHECK_EQUAL(etl::ibitset::npos, data.find_first(false)); - CHECK_EQUAL(0, data.find_first(true)); + CHECK_EQUAL(0U, data.find_first(true)); data.set("000001"); - CHECK_EQUAL(1, data.find_first(false)); - CHECK_EQUAL(0, data.find_first(true)); + CHECK_EQUAL(1U, data.find_first(false)); + CHECK_EQUAL(0U, data.find_first(true)); data.set("100000"); - CHECK_EQUAL(0, data.find_first(false)); - CHECK_EQUAL(5, data.find_first(true)); + CHECK_EQUAL(0U, data.find_first(false)); + CHECK_EQUAL(5U, data.find_first(true)); data.set("100001"); - CHECK_EQUAL(1, data.find_first(false)); - CHECK_EQUAL(0, data.find_first(true)); + CHECK_EQUAL(1U, data.find_first(false)); + CHECK_EQUAL(0U, data.find_first(true)); data.set("001110"); - CHECK_EQUAL(0, data.find_first(false)); - CHECK_EQUAL(1, data.find_first(true)); + CHECK_EQUAL(0U, data.find_first(false)); + CHECK_EQUAL(1U, data.find_first(true)); data.set("110001"); - CHECK_EQUAL(1, data.find_first(false)); - CHECK_EQUAL(0, data.find_first(true)); + CHECK_EQUAL(1U, data.find_first(false)); + CHECK_EQUAL(0U, data.find_first(true)); } //************************************************************************* @@ -757,24 +759,24 @@ namespace etl::bitset<6> data; data.set("000000"); - CHECK_EQUAL(0, data.find_next(false, 0)); - CHECK_EQUAL(1, data.find_next(false, 1)); + CHECK_EQUAL(0U, data.find_next(false, 0)); + CHECK_EQUAL(1U, data.find_next(false, 1)); CHECK_EQUAL(etl::ibitset::npos, data.find_next(true, 2)); data.set("111111"); - CHECK_EQUAL(0, data.find_next(true, 0)); - CHECK_EQUAL(1, data.find_next(true, 1)); + CHECK_EQUAL(0U, data.find_next(true, 0)); + CHECK_EQUAL(1U, data.find_next(true, 1)); CHECK_EQUAL(etl::ibitset::npos, data.find_next(false, 2)); data.set("001110"); - CHECK_EQUAL(0, data.find_next(false, 0)); - CHECK_EQUAL(1, data.find_next(true, 0)); - CHECK_EQUAL(4, data.find_next(false, 1)); + CHECK_EQUAL(0U, data.find_next(false, 0)); + CHECK_EQUAL(1U, data.find_next(true, 0)); + CHECK_EQUAL(4U, data.find_next(false, 1)); data.set("110001"); - CHECK_EQUAL(0, data.find_next(true, 0)); - CHECK_EQUAL(1, data.find_next(false, 0)); - CHECK_EQUAL(4, data.find_next(true, 1)); + CHECK_EQUAL(0U, data.find_next(true, 0)); + CHECK_EQUAL(1U, data.find_next(false, 0)); + CHECK_EQUAL(4U, data.find_next(true, 1)); } From ff9cfa724bf8dbe4b391a9c027106bc9de1c92de Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:20:40 +0000 Subject: [PATCH 85/93] Fixed GCC warnings --- test/test_alignment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_alignment.cpp b/test/test_alignment.cpp index ed90a952..f3b28b42 100644 --- a/test/test_alignment.cpp +++ b/test/test_alignment.cpp @@ -36,7 +36,7 @@ SOFTWARE. #include #include -void f(int a) +void f(int) { } From 36a018019b9ca3dd44146db8731b1a4b62466710 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:20:58 +0000 Subject: [PATCH 86/93] Tabs to spaces --- test/data.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/data.h b/test/data.h index c256cc4f..bc5db259 100644 --- a/test/data.h +++ b/test/data.h @@ -40,7 +40,7 @@ class TestDataDC public: TestDataDC() - : value(T()) + : value(T()) { } @@ -90,7 +90,7 @@ class TestDataNDC public: TestDataNDC() - : value(T()) + : value(T()) {} TestDataNDC(const T& value) From 5f3e05b8fc147d78b3ef779b29ddb47a8b56f6ed Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:21:20 +0000 Subject: [PATCH 87/93] Updated project files --- test/codeblocks/ETL.cbp | 30 +- test/codeblocks/ETL.depend | 2616 +++++++++++++++++++++++++++---- test/codeblocks/ETL.layout | 672 ++++---- test/vs2015/etl.vcxproj | 18 +- test/vs2015/etl.vcxproj.filters | 18 +- 5 files changed, 2771 insertions(+), 583 deletions(-) diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index 7f58fb61..d8bab481 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -19,6 +19,9 @@ + + + @@ -84,6 +87,8 @@ + + @@ -100,6 +105,7 @@ + @@ -114,6 +120,7 @@ + @@ -132,8 +139,10 @@ + + @@ -172,6 +181,8 @@ + + @@ -183,6 +194,7 @@ + @@ -202,6 +214,7 @@ + @@ -215,14 +228,19 @@ + + + + + @@ -239,6 +257,7 @@ + @@ -259,6 +278,8 @@ + + @@ -278,13 +299,20 @@ + + + + + + + diff --git a/test/codeblocks/ETL.depend b/test/codeblocks/ETL.depend index 22211a47..e5a50fcf 100644 --- a/test/codeblocks/ETL.depend +++ b/test/codeblocks/ETL.depend @@ -2,7 +2,7 @@ 1424729709 source:u:\users\john\documents\programming\github\etl\crc16.cpp -1427746630 +1481841066 1424729709 source:u:\users\john\documents\programming\github\etl\crc16_ccitt.cpp @@ -19,12 +19,12 @@ 1424729709 source:u:\users\john\documents\programming\github\etl\test\main.cpp -1414173716 +/UnitTest++.h> +1452692153 +/UnitTest++.h> 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\unittest++.h "UnitTestPP.h" -1414845610 P.h" +1447740690 P.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\unittestpp.h "Config.h" @@ -34,7 +34,7 @@ "TimeConstraint.h" "ReportAssert.h" -1414845610 ert.h" +1447740690 ert.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\config.h @@ -48,7 +48,7 @@ "MemoryOutStream.h" "Posix/SignalTranslator.h" -1414845610 nalTranslator.h" +1447740690 nalTranslator.h" 1416833496 u:\users\john\documents\programming\github\unittest-cpp\unittest++\testsuite.h @@ -69,7 +69,7 @@ 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\testdetails.h "HelperMacros.h" -1414845610 ros.h" +1447740690 ros.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\helpermacros.h "Config.h" @@ -88,7 +88,7 @@ "HelperMacros.h" -1427741862 > +1482076051 > 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\currenttest.h "HelperMacros.h" @@ -112,26 +112,26 @@ "CurrentTest.h" "ReportAssertImpl.h" -1414927690 ertImpl.h" +1447740690 ertImpl.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\checks.h "Config.h" "TestResults.h" "MemoryOutStream.h" -1414845610 Stream.h" +1447740690 Stream.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\testrunner.h "Test.h" "TestList.h" "CurrentTest.h" -1414845610 st.h" +1447740690 st.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\test.h "TestDetails.h" -1414845610 ls.h" +1447740690 ls.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\testlist.h "HelperMacros.h" @@ -145,18 +145,18 @@ "Posix/TimeHelpers.h" "Win32/TimeHelpers.h" -1414845610 eHelpers.h" +1447740690 eHelpers.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\posix\timehelpers.h -1414845610 h> +1447740690 h> 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\win32\timehelpers.h "../Config.h" "../HelperMacros.h" -1414845610 Macros.h" +1447740690 Macros.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassert.h "HelperMacros.h" @@ -169,7 +169,7 @@ "../integral_limits.h" -1424729709 al_limits.h" +1452516033 al_limits.h" 1424729709 u:\users\john\documents\programming\github\etl\array.h @@ -182,9 +182,9 @@ "static_assert.h" "error_handler.h" -1424729709 dler.h" +1482748240 dler.h" -1427741862 .h" +1481309504 .h" 1424729709 u:\users\john\documents\programming\github\etl\exception.h @@ -193,7 +193,7 @@ "../container.h" -1414586788 ner.h" +1452516033 ner.h" 1424729709 u:\users\john\documents\programming\github\etl\container.h @@ -213,7 +213,7 @@ "../crc64_ecma.h" "../endian.h" -1414929413 ecma.h" +1452701006 ecma.h" 1424729709 u:\users\john\documents\programming\github\etl\crc8_ccitt.h @@ -261,7 +261,7 @@ "../cyclic_value.h" -1415139747 _value.h" +1452516033 _value.h" 1424729709 u:\users\john\documents\programming\github\etl\cyclic_value.h @@ -307,7 +307,7 @@ "nullptr.h" -1424729709 " +1481841437 " 1424729709 u:\users\john\documents\programming\github\etl\nullptr.h @@ -320,7 +320,7 @@ "../enum_type.h" -1414345217 ype.h" +1452516033 ype.h" 1424729709 u:\users\john\documents\programming\github\etl\enum_type.h @@ -329,13 +329,13 @@ "../exception.h" -1424729709 ion.h" +1452516033 ion.h" 1424729709 source:u:\users\john\documents\programming\github\etl\test\test_function.cpp "../function.h" -1414347748 on.h" +1452516033 on.h" 1424729709 u:\users\john\documents\programming\github\etl\function.h @@ -344,12 +344,12 @@ "../largest.h" -1424729709 ts> +1452516033 ts> 1424729709 u:\users\john\documents\programming\github\etl\largest.h "type_traits.h" -1424729709 ts.h" +1482075058 ts.h" 1424729709 source:u:\users\john\documents\programming\github\etl\test\test_list.cpp @@ -383,7 +383,7 @@ -1415009648 +/ReportAssertImpl.h> +1452516033 +/ReportAssertImpl.h> 1424729709 u:\users\john\documents\programming\github\etl\list.h @@ -452,7 +452,7 @@ "../observer.h" -1415136649 er.h" +1452696227 er.h" 1424729709 u:\users\john\documents\programming\github\etl\observer.h @@ -492,7 +492,7 @@ "../queue.h" -1424729709 h" +1482098369 h" 1427740329 u:\users\john\documents\programming\github\etl\queue.h @@ -557,14 +557,14 @@ "../visitor.h" -1414764632 r.h" +1452516033 r.h" 1424729709 u:\users\john\documents\programming\github\etl\visitor.h 1414849210 source:u:\users\john\documents\programming\github\unittest-cpp\unittest++\assertexception.cpp "AssertException.h" -1414845610 eption.h" +1447740690 eption.h" 1414849210 source:u:\users\john\documents\programming\github\unittest-cpp\unittest++\checks.cpp "Checks.h" @@ -577,7 +577,7 @@ 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\compositetestreporter.h "TestReporter.h" -1414845610 ter.h" +1482076051 ter.h" 1414849210 u:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporter.h "HelperMacros.h" @@ -879,7 +879,7 @@ 1414845610 source:/mnt/hgfs/W7 My Documents/Programming/GitHub/unittest-cpp/UnitTest++/Posix/SignalTranslator.cpp "SignalTranslator.h" -1414845610 nslator.h" +1447740690 nslator.h" 1414845610 source:/mnt/hgfs/W7 My Documents/Programming/GitHub/unittest-cpp/UnitTest++/Posix/TimeHelpers.cpp "TimeHelpers.h" @@ -1099,7 +1099,7 @@ "integral_limits.h" -1427740329 limits.h" +1482653105 limits.h" 1424729709 source:u:\users\john\documents\programming\github\etl\test\test_forward_list.cpp @@ -1129,7 +1129,7 @@ "type_traits.h" "parameter_type.h" -1427740329 _type.h" +1479511690 _type.h" 1424729709 u:\users\john\documents\programming\github\etl\forward_list_base.h @@ -1152,7 +1152,7 @@ "type_traits.h" "static_assert.h" -1427740329 sert.h" +1481309477 sert.h" 1424729709 u:\users\john\documents\programming\github\etl\parameter_type.h "type_traits.h" @@ -1175,7 +1175,7 @@ "../fibonacci.h" "../factorial.h" -1424729709 ial.h" +1452700712 ial.h" 1427741862 source:u:\users\john\documents\programming\github\etl\test\test_pool.cpp @@ -1409,7 +1409,7 @@ "../fixed_iterator.h" -1424729709 iterator.h" +1452516033 iterator.h" 1424729709 u:\users\john\documents\programming\github\etl\fixed_iterator.h @@ -1445,7 +1445,7 @@ "data.h" "../flat_map.h" -1424729709 ap.h" +1452516120 ap.h" 1427740329 u:\users\john\documents\programming\github\etl\flat_map.h @@ -1484,7 +1484,7 @@ "data.h" "../flat_set.h" -1424729709 et.h" +1452516033 et.h" 1427740329 u:\users\john\documents\programming\github\etl\flat_set.h @@ -2621,80 +2621,80 @@ 1424726109 /mnt/hgfs/Programming/GitHub/etl/visitor.h -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\assertexception.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\assertexception.cpp "AssertException.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\assertexception.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\assertexception.h "Config.h" "HelperMacros.h" -1457468069 d:\users\john\documents\programming\github\unittest-cpp\unittest++\config.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\config.h -1457468069 d:\users\john\documents\programming\github\unittest-cpp\unittest++\helpermacros.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\helpermacros.h "Config.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\checks.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\checks.cpp "Checks.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\checks.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\checks.h "Config.h" "TestResults.h" "MemoryOutStream.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testresults.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testresults.h "HelperMacros.h" -1417970069 d:\users\john\documents\programming\github\unittest-cpp\unittest++\memoryoutstream.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\memoryoutstream.h "Config.h" "HelperMacros.h" -1417970061 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\compositetestreporter.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\compositetestreporter.cpp "CompositeTestReporter.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\compositetestreporter.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\compositetestreporter.h "TestReporter.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporter.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporter.h "HelperMacros.h" -1417970067 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\currenttest.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\currenttest.cpp "CurrentTest.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\currenttest.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\currenttest.h "HelperMacros.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestreporter.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestreporter.cpp "Config.h" "DeferredTestReporter.h" "TestDetails.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestreporter.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestreporter.h "Config.h" "TestReporter.h" "DeferredTestResult.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestresult.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestresult.h "Config.h" "HelperMacros.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testdetails.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testdetails.h "HelperMacros.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestresult.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\deferredtestresult.cpp "Config.h" "DeferredTestResult.h" -1457468069 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\memoryoutstream.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\memoryoutstream.cpp "MemoryOutStream.h" @@ -2702,7 +2702,7 @@ 1417875047 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\posix\signaltranslator.cpp "SignalTranslator.h" -1417871449 d:\users\john\documents\programming\github\unittest-cpp\unittest++\posix\signaltranslator.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\posix\signaltranslator.h @@ -2710,10 +2710,10 @@ "TimeHelpers.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\posix\timehelpers.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\posix\timehelpers.h -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassert.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassert.cpp "ReportAssert.h" "ReportAssertImpl.h" "AssertException.h" @@ -2722,15 +2722,15 @@ "TestDetails.h" "ReportAssertImpl.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassert.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassert.h "HelperMacros.h" -1457468069 d:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassertimpl.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassertimpl.h "Config.h" "HelperMacros.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\test.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\test.cpp "Config.h" "Test.h" "TestList.h" @@ -2740,51 +2740,52 @@ "ExecuteTest.h" "Posix/SignalTranslator.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\test.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\test.h "TestDetails.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testlist.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testlist.h "HelperMacros.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\executetest.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\executetest.h "Config.h" "ExceptionMacros.h" "TestDetails.h" "TestResults.h" "MemoryOutStream.h" "AssertException.h" + "RequiredCheckException.h" "CurrentTest.h" "ReportAssertImpl.h" "Posix/SignalTranslator.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\exceptionmacros.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\exceptionmacros.h "Config.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testdetails.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testdetails.cpp "TestDetails.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testlist.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testlist.cpp "TestList.h" "Test.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporter.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporter.cpp "TestReporter.h" -1457465178 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporterstdout.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporterstdout.cpp "TestReporterStdout.h" "TestDetails.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporterstdout.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testreporterstdout.h "TestReporter.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testresults.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testresults.cpp "TestResults.h" "TestReporter.h" "TestDetails.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testrunner.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\testrunner.cpp "TestRunner.h" "TestResults.h" "TestReporter.h" @@ -2793,38 +2794,39 @@ "MemoryOutStream.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testrunner.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testrunner.h "Test.h" "TestList.h" "CurrentTest.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\timehelpers.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\timehelpers.h "Config.h" "Posix/TimeHelpers.h" "Win32/TimeHelpers.h" -1456667834 d:\users\john\documents\programming\github\unittest-cpp\unittest++\win32\timehelpers.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\win32\timehelpers.h "../Config.h" "../HelperMacros.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\timeconstraint.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\timeconstraint.cpp "TimeConstraint.h" "TestResults.h" "MemoryOutStream.h" "CurrentTest.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\timeconstraint.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\timeconstraint.h "TimeHelpers.h" "HelperMacros.h" + "TestDetails.h" -1414845610 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\xmltestreporter.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\xmltestreporter.cpp "Config.h" "XmlTestReporter.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\xmltestreporter.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\xmltestreporter.h "Config.h" "DeferredTestReporter.h" @@ -2862,21 +2864,22 @@ 1450265856 d:\users\john\documents\programming\github\etl\nullptr.h -1450264056 source:d:\users\john\documents\programming\github\etl\test\main.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\main.cpp -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\unittest++.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\unittest++.h "UnitTestPP.h" -1414845610 d:\users\john\documents\programming\github\unittest-cpp\unittest++\unittestpp.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\unittestpp.h "Config.h" "TestMacros.h" "CheckMacros.h" + "RequireMacros.h" "TestRunner.h" "TimeConstraint.h" "ReportAssert.h" -1416829904 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testmacros.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testmacros.h "Config.h" "TestSuite.h" "ExceptionMacros.h" @@ -2886,19 +2889,20 @@ "MemoryOutStream.h" "Posix/SignalTranslator.h" -1416829896 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testsuite.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\testsuite.h -1414927690 d:\users\john\documents\programming\github\unittest-cpp\unittest++\checkmacros.h +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\checkmacros.h "HelperMacros.h" "ExceptionMacros.h" "Checks.h" "AssertException.h" + "RequiredCheckException.h" "MemoryOutStream.h" "TestDetails.h" "CurrentTest.h" "ReportAssertImpl.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_algorithm.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_algorithm.cpp "../src/algorithm.h" "../src/container.h" @@ -2923,7 +2927,7 @@ -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_alignment.cpp +1482624126 source:d:\users\john\documents\programming\github\etl\test\test_alignment.cpp "../src/alignment.h" "../src/type_traits.h" @@ -2939,7 +2943,7 @@ 1450265856 d:\users\john\documents\programming\github\etl\static_assert.h -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_array.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_array.cpp "../src/array.h" @@ -2947,6 +2951,8 @@ "../src/integral_limits.h" +1479511692 tegral_limits.h" + 1450265856 d:\users\john\documents\programming\github\etl\array.h @@ -2966,7 +2972,7 @@ "type_traits.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_binary.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_binary.cpp @@ -3029,22 +3035,27 @@ "exception.h" "error_handler.h" -1457468093 source:d:\users\john\documents\programming\github\etl\test\test_bitset.cpp +1482623861 source:d:\users\john\documents\programming\github\etl\test\test_bitset.cpp "../src/bitset.h" -1457378733 source:d:\users\john\documents\programming\github\etl\test\test_bloom_filter.cpp +1482623861 tset.h" + +1482612858 source:d:\users\john\documents\programming\github\etl\test\test_bloom_filter.cpp - + "../src/bloom_filter.h" "../src/fnv_1.h" "../src/crc16.h" "../src/crc16_ccitt.h" "../src/crc32.h" + "../src/char_traits.h" + +1482612858 ar_traits.h" 1450265856 d:\users\john\documents\programming\github\etl\bloom_filter.h "parameter_type.h" @@ -3073,7 +3084,7 @@ "static_assert.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_checksum.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_checksum.cpp @@ -3082,18 +3093,22 @@ "../src/checksum.h" "../src/endian.h" +1479511692 dian.h" + 1450265856 d:\users\john\documents\programming\github\etl\checksum.h "static_assert.h" "type_traits.h" "ihash.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_container.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_container.cpp "../src/container.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_crc.cpp +1479511691 ntainer.h" + +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_crc.cpp @@ -3106,6 +3121,8 @@ "../src/crc32.h" "../src/crc64_ecma.h" +1479511691 c64_ecma.h" + 1450265856 d:\users\john\documents\programming\github\etl\crc8_ccitt.h "static_assert.h" @@ -3121,17 +3138,19 @@ "static_assert.h" "type_traits.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_cyclic_value.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_cyclic_value.cpp "../src/cyclic_value.h" +1479511691 clic_value.h" + 1452794793 d:\users\john\documents\programming\github\etl\cyclic_value.h "static_assert.h" "exception.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_deque.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_deque.cpp "ExtraCheckMacros.h" "../src/deque.h" @@ -3142,7 +3161,7 @@ -1421962897 d:\users\john\documents\programming\github\etl\test\extracheckmacros.h +1479511691 d:\users\john\documents\programming\github\etl\test\extracheckmacros.h @@ -3175,20 +3194,22 @@ "exception.h" -1456432601 d:\users\john\documents\programming\github\etl\test\data.h +1482185150 d:\users\john\documents\programming\github\etl\test\data.h -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_endian.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_endian.cpp "../src/endian.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_enum_type.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_enum_type.cpp "../src/enum_type.h" -1457468158 source:d:\users\john\documents\programming\github\etl\test\test_error_handler.cpp +1479511691 um_type.h" + +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_error_handler.cpp @@ -3196,12 +3217,14 @@ "../src/error_handler.h" "../src/exception.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_exception.cpp +1482625380 ception.h" + +1482625380 source:d:\users\john\documents\programming\github\etl\test\test_exception.cpp "../src/exception.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_flat_map.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_flat_map.cpp @@ -3213,6 +3236,8 @@ "data.h" "../src/flat_map.h" +1479511691 at_map.h" + 1452796556 d:\users\john\documents\programming\github\etl\flat_map.h @@ -3263,7 +3288,7 @@ "alignment.h" "array.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_flat_set.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_flat_set.cpp @@ -3275,6 +3300,8 @@ "data.h" "../src/flat_set.h" +1479511691 at_set.h" + 1452796556 d:\users\john\documents\programming\github\etl\flat_set.h @@ -3300,7 +3327,7 @@ "ivector.h" "error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_fnv_1.cpp +1482623723 source:d:\users\john\documents\programming\github\etl\test\test_fnv_1.cpp @@ -3308,7 +3335,9 @@ "../src/fnv_1.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_forward_list.cpp +1482623723 v_1.h" + +1482625680 source:d:\users\john\documents\programming\github\etl\test\test_forward_list.cpp "ExtraCheckMacros.h" "data.h" @@ -3359,11 +3388,13 @@ "exception.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_function.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_function.cpp "../src/function.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_functional.cpp +1479511692 nction.h" + +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_functional.cpp "../src/functional.h" @@ -3372,7 +3403,7 @@ 1450265856 d:\users\john\documents\programming\github\etl\functional.h -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_hash.cpp +1482624624 source:d:\users\john\documents\programming\github\etl\test\test_hash.cpp @@ -3380,12 +3411,14 @@ "../src/hash.h" +1482624624 sh.h" + 1450265856 d:\users\john\documents\programming\github\etl\hash.h "fnv_1.h" "type_traits.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_instance_count.cpp +1482624916 source:d:\users\john\documents\programming\github\etl\test\test_instance_count.cpp "../src/instance_count.h" @@ -3394,14 +3427,14 @@ 1450265856 d:\users\john\documents\programming\github\etl\instance_count.h -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_integral_limits.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_integral_limits.cpp "../src/integral_limits.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_io_port.cpp +1482750186 source:d:\users\john\documents\programming\github\etl\test\test_io_port.cpp "../src/io_port.h" @@ -3411,7 +3444,7 @@ "nullptr.h" "parameter_type.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_largest.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_largest.cpp "../src/largest.h" @@ -3419,7 +3452,7 @@ 1450265856 d:\users\john\documents\programming\github\etl\largest.h "type_traits.h" -1457468249 source:d:\users\john\documents\programming\github\etl\test\test_list.cpp +1482625302 source:d:\users\john\documents\programming\github\etl\test\test_list.cpp "ExtraCheckMacros.h" "../src/list.h" @@ -3450,20 +3483,22 @@ "exception.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_maths.cpp +1482692728 source:d:\users\john\documents\programming\github\etl\test\test_maths.cpp "../src/log.h" "../src/power.h" "../src/fibonacci.h" "../src/factorial.h" +1482692728 ctorial.h" + 1450265856 d:\users\john\documents\programming\github\etl\fibonacci.h 1450265856 d:\users\john\documents\programming\github\etl\factorial.h -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_numeric.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_numeric.cpp "../src/numeric.h" @@ -3471,21 +3506,25 @@ 1450265856 d:\users\john\documents\programming\github\etl\numeric.h -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_observer.cpp +1482624916 source:d:\users\john\documents\programming\github\etl\test\test_observer.cpp "../src/observer.h" +1482624916 server.h" + 1450959449 d:\users\john\documents\programming\github\etl\observer.h "vector.h" "exception.h" "error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_queue.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_queue.cpp "../src/queue.h" +1479511692 eue.h" + 1450265856 d:\users\john\documents\programming\github\etl\queue.h @@ -3505,17 +3544,19 @@ "exception.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_smallest.cpp +1482654345 source:d:\users\john\documents\programming\github\etl\test\test_smallest.cpp "../src/smallest.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_stack.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_stack.cpp "data.h" "../src/stack.h" +1479511692 ack.h" + 1450265856 d:\users\john\documents\programming\github\etl\stack.h @@ -3536,29 +3577,35 @@ "exception.h" -1457027610 source:d:\users\john\documents\programming\github\etl\test\test_vector.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_vector.cpp "../src/vector.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_visitor.cpp +1479511692 ctor.h" + +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_visitor.cpp "../src/visitor.h" +1479511692 sitor.h" + 1450265856 d:\users\john\documents\programming\github\etl\visitor.h -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_fixed_iterator.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_fixed_iterator.cpp "../src/fixed_iterator.h" +1479511691 xed_iterator.h" + 1450265856 d:\users\john\documents\programming\github\etl\fixed_iterator.h -1457468069 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\win32\timehelpers.cpp +1482076051 source:d:\users\john\documents\programming\github\unittest-cpp\unittest++\win32\timehelpers.cpp "TimeHelpers.h" @@ -3567,6 +3614,8 @@ "../exception.h" "../error_handler.h" +1482614484 handler.h" + 1450265856 d:\users\john\documents\programming\github\etl\private\flat_map_base.h "../exception.h" @@ -3600,7 +3649,7 @@ "../exception.h" "../error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_map.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_map.cpp @@ -3611,6 +3660,8 @@ "../src/map.h" +1479511692 p.h" + 1452337350 d:\users\john\documents\programming\github\etl\map.h @@ -3635,7 +3686,7 @@ "../exception.h" "../error_handler.h" -1457464314 source:d:\users\john\documents\programming\github\etl\test\test_optional.cpp +1482624916 source:d:\users\john\documents\programming\github\etl\test\test_optional.cpp @@ -3649,7 +3700,7 @@ "exception.h" "error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_pool.cpp +1482750186 source:d:\users\john\documents\programming\github\etl\test\test_pool.cpp "ExtraCheckMacros.h" "data.h" @@ -3657,12 +3708,14 @@ "../src/pool.h" +1482750186 ol.h" + 1450265856 d:\users\john\documents\programming\github\etl\private\queue_base.h "../exception.h" "../error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_set.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_set.cpp @@ -3673,6 +3726,8 @@ "../src/set.h" +1479511692 t.h" + 1452337350 d:\users\john\documents\programming\github\etl\set.h @@ -3702,12 +3757,12 @@ "../exception.h" "../error_handler.h" -1457463236 source:d:\users\john\documents\programming\github\etl\test\test_type_traits.cpp +1482768991 source:d:\users\john\documents\programming\github\etl\test\test_type_traits.cpp "../src/type_traits.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_variant.cpp +1481841066 source:d:\users\john\documents\programming\github\etl\test\test_variant.cpp "ExtraCheckMacros.h" "../src/variant.h" @@ -4784,7 +4839,7 @@ 1452516033 /home/jwellbelove/Programming/etl/visitor.h -1457468232 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_forward_list.cpp +1482799048 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_forward_list.cpp "ExtraCheckMacros.h" "data.h" @@ -4805,48 +4860,55 @@ "type_traits.h" "intrusive_forward_list_link.h" +1453405528 _forward_list_link.h" + 1453324561 d:\users\john\documents\programming\github\etl\intrusive_forward_list_link.h "error_handler.h" "array.h" -1456669289 source:d:\users\john\documents\programming\github\etl\src\crc16.cpp +1479511689 source:d:\users\john\documents\programming\github\etl\src\crc16.cpp -1456669289 source:d:\users\john\documents\programming\github\etl\src\crc16_ccitt.cpp +1479511689 source:d:\users\john\documents\programming\github\etl\src\crc16_ccitt.cpp -1456669289 source:d:\users\john\documents\programming\github\etl\src\crc16_kermit.cpp +1479511689 source:d:\users\john\documents\programming\github\etl\src\crc16_kermit.cpp -1456669289 source:d:\users\john\documents\programming\github\etl\src\crc32.cpp +1479511689 source:d:\users\john\documents\programming\github\etl\src\crc32.cpp -1456669289 source:d:\users\john\documents\programming\github\etl\src\crc64_ecma.cpp +1479511689 source:d:\users\john\documents\programming\github\etl\src\crc64_ecma.cpp -1456669289 source:d:\users\john\documents\programming\github\etl\src\crc8_ccitt.cpp +1481309487 source:d:\users\john\documents\programming\github\etl\src\crc8_ccitt.cpp + "platform.h" + "static_assert.h" -1456669289 source:d:\users\john\documents\programming\github\etl\src\error_handler.cpp +1479511689 source:d:\users\john\documents\programming\github\etl\src\error_handler.cpp "error_handler.h" "nullptr.h" -1456669289 d:\users\john\documents\programming\github\etl\src\error_handler.h +1479511689 d:\users\john\documents\programming\github\etl\src\error_handler.h "exception.h" "function.h" -1456669289 d:\users\john\documents\programming\github\etl\src\exception.h +1481841065 d:\users\john\documents\programming\github\etl\src\exception.h -1456669289 d:\users\john\documents\programming\github\etl\src\function.h +1481841065 d:\users\john\documents\programming\github\etl\src\function.h -1457547753 d:\users\john\documents\programming\github\etl\src\nullptr.h +1481308917 d:\users\john\documents\programming\github\etl\src\nullptr.h "platform.h" + -1456669289 source:d:\users\john\documents\programming\github\etl\src\pearson.cpp +1481841066 source:d:\users\john\documents\programming\github\etl\src\pearson.cpp + "platform.h" + "static_assert.h" -1456669289 d:\users\john\documents\programming\github\etl\src\algorithm.h +1479511689 d:\users\john\documents\programming\github\etl\src\algorithm.h @@ -4854,24 +4916,24 @@ "type_traits.h" -1457559890 d:\users\john\documents\programming\github\etl\src\type_traits.h +1481841066 d:\users\john\documents\programming\github\etl\src\type_traits.h "platform.h" "nullptr.h" -1456669289 d:\users\john\documents\programming\github\etl\src\container.h +1482613987 d:\users\john\documents\programming\github\etl\src\container.h -1456669289 d:\users\john\documents\programming\github\etl\src\alignment.h +1481309570 d:\users\john\documents\programming\github\etl\src\alignment.h "type_traits.h" "static_assert.h" -1457463503 d:\users\john\documents\programming\github\etl\src\static_assert.h +1481841065 d:\users\john\documents\programming\github\etl\src\static_assert.h "platform.h" -1456669289 d:\users\john\documents\programming\github\etl\src\array.h +1479511689 d:\users\john\documents\programming\github\etl\src\array.h @@ -4882,15 +4944,16 @@ "static_assert.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\parameter_type.h +1479511690 d:\users\john\documents\programming\github\etl\src\parameter_type.h "type_traits.h" -1456669289 d:\users\john\documents\programming\github\etl\src\integral_limits.h +1479511690 d:\users\john\documents\programming\github\etl\src\integral_limits.h "type_traits.h" + "platform.h" -1457027659 d:\users\john\documents\programming\github\etl\src\binary.h +1481309537 d:\users\john\documents\programming\github\etl\src\binary.h "type_traits.h" @@ -4899,19 +4962,20 @@ "log.h" "power.h" "smallest.h" + "platform.h" -1456669289 d:\users\john\documents\programming\github\etl\src\log.h +1479511690 d:\users\john\documents\programming\github\etl\src\log.h -1456669289 d:\users\john\documents\programming\github\etl\src\power.h +1479511690 d:\users\john\documents\programming\github\etl\src\power.h "log.h" -1456669289 d:\users\john\documents\programming\github\etl\src\smallest.h +1482653105 d:\users\john\documents\programming\github\etl\src\smallest.h "integral_limits.h" -1457463503 d:\users\john\documents\programming\github\etl\src\bitset.h +1479511689 d:\users\john\documents\programming\github\etl\src\bitset.h @@ -4924,7 +4988,7 @@ "ibitset.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\ibitset.h +1481309224 d:\users\john\documents\programming\github\etl\src\ibitset.h @@ -4932,21 +4996,25 @@ "integral_limits.h" "binary.h" "algorithm.h" + "platform.h" -1457463503 d:\users\john\documents\programming\github\etl\src\fnv_1.h +1481841066 d:\users\john\documents\programming\github\etl\src\fnv_1.h "platform.h" "static_assert.h" "type_traits.h" "ihash.h" + "frame_check_sequence.h" -1456669289 d:\users\john\documents\programming\github\etl\src\ihash.h +1481872412 ck_sequence.h" + +1479511690 d:\users\john\documents\programming\github\etl\src\ihash.h "exception.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\bloom_filter.h +1479511689 d:\users\john\documents\programming\github\etl\src\bloom_filter.h "parameter_type.h" "bitset.h" "type_traits.h" @@ -4954,66 +5022,67 @@ "log.h" "power.h" -1457463503 d:\users\john\documents\programming\github\etl\src\crc16.h +1479511689 d:\users\john\documents\programming\github\etl\src\crc16.h "platform.h" "frame_check_sequence.h" -1456669289 d:\users\john\documents\programming\github\etl\src\frame_check_sequence.h +1481841065 d:\users\john\documents\programming\github\etl\src\frame_check_sequence.h + "platform.h" "static_assert.h" "type_traits.h" "binary.h" -1457463503 d:\users\john\documents\programming\github\etl\src\crc16_ccitt.h +1479511689 d:\users\john\documents\programming\github\etl\src\crc16_ccitt.h "platform.h" "frame_check_sequence.h" -1457463503 d:\users\john\documents\programming\github\etl\src\crc32.h +1479511689 d:\users\john\documents\programming\github\etl\src\crc32.h "platform.h" "frame_check_sequence.h" -1456953131 d:\users\john\documents\programming\github\etl\src\checksum.h +1479511689 d:\users\john\documents\programming\github\etl\src\checksum.h "binary.h" "frame_check_sequence.h" -1456669289 d:\users\john\documents\programming\github\etl\src\endian.h +1481309464 d:\users\john\documents\programming\github\etl\src\endian.h "enum_type.h" -1456669289 d:\users\john\documents\programming\github\etl\src\enum_type.h +1479511689 d:\users\john\documents\programming\github\etl\src\enum_type.h -1457463503 d:\users\john\documents\programming\github\etl\src\crc8_ccitt.h +1479511689 d:\users\john\documents\programming\github\etl\src\crc8_ccitt.h "platform.h" "frame_check_sequence.h" -1457463503 d:\users\john\documents\programming\github\etl\src\crc16_kermit.h +1479511689 d:\users\john\documents\programming\github\etl\src\crc16_kermit.h "platform.h" "frame_check_sequence.h" -1457463503 d:\users\john\documents\programming\github\etl\src\crc64_ecma.h +1479511689 d:\users\john\documents\programming\github\etl\src\crc64_ecma.h "platform.h" "frame_check_sequence.h" -1456669289 d:\users\john\documents\programming\github\etl\src\cyclic_value.h +1479511689 d:\users\john\documents\programming\github\etl\src\cyclic_value.h "static_assert.h" "exception.h" -1456669289 d:\users\john\documents\programming\github\etl\src\deque.h +1479511689 d:\users\john\documents\programming\github\etl\src\deque.h @@ -5023,7 +5092,7 @@ "alignment.h" "array.h" -1457468266 d:\users\john\documents\programming\github\etl\src\ideque.h +1482624126 d:\users\john\documents\programming\github\etl\src\ideque.h "algorithm.h" @@ -5032,22 +5101,22 @@ "parameter_type.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\deque_base.h +1479511690 d:\users\john\documents\programming\github\etl\src\private\deque_base.h "../exception.h" "../error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\fixed_iterator.h +1482624125 d:\users\john\documents\programming\github\etl\src\fixed_iterator.h -1456669289 d:\users\john\documents\programming\github\etl\src\flat_map.h +1479511690 d:\users\john\documents\programming\github\etl\src\flat_map.h "iflat_map.h" "vector.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iflat_map.h +1482748252 d:\users\john\documents\programming\github\etl\src\iflat_map.h @@ -5059,13 +5128,13 @@ "ivector.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\flat_map_base.h +1479511690 d:\users\john\documents\programming\github\etl\src\private\flat_map_base.h "../exception.h" "../ivector.h" "../error_handler.h" -1457595336 d:\users\john\documents\programming\github\etl\src\ivector.h +1482748239 d:\users\john\documents\programming\github\etl\src\ivector.h @@ -5076,13 +5145,16 @@ "type_traits.h" "parameter_type.h" "error_handler.h" + "private/ivectorpointer.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\vector_base.h +1482748239 vectorpointer.h" + +1479511691 d:\users\john\documents\programming\github\etl\src\private\vector_base.h "../exception.h" "../error_handler.h" -1456953131 d:\users\john\documents\programming\github\etl\src\vector.h +1481841065 d:\users\john\documents\programming\github\etl\src\vector.h @@ -5091,14 +5163,14 @@ "alignment.h" "array.h" -1456669289 d:\users\john\documents\programming\github\etl\src\flat_set.h +1479511690 d:\users\john\documents\programming\github\etl\src\flat_set.h "iflat_set.h" "vector.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iflat_set.h +1482748239 d:\users\john\documents\programming\github\etl\src\iflat_set.h @@ -5110,39 +5182,40 @@ "ivector.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\flat_set_base.h +1479511690 d:\users\john\documents\programming\github\etl\src\private\flat_set_base.h "../exception.h" "../ivector.h" "../error_handler.h" -1456953131 d:\users\john\documents\programming\github\etl\src\forward_list.h +1479511690 d:\users\john\documents\programming\github\etl\src\forward_list.h "pool.h" "iforward_list.h" "container.h" -1456669289 d:\users\john\documents\programming\github\etl\src\pool.h +1479511690 d:\users\john\documents\programming\github\etl\src\pool.h "alignment.h" "array.h" "bitset.h" "ipool.h" -1456669289 d:\users\john\documents\programming\github\etl\src\ipool.h +1481841065 d:\users\john\documents\programming\github\etl\src\ipool.h "private/pool_base.h" "nullptr.h" "ibitset.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\pool_base.h +1479511691 d:\users\john\documents\programming\github\etl\src\private\pool_base.h "../exception.h" "../error_handler.h" "../error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iforward_list.h +1482748239 d:\users\john\documents\programming\github\etl\src\iforward_list.h + "platform.h" @@ -5153,21 +5226,24 @@ "type_traits.h" "parameter_type.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\forward_list_base.h +1479511690 d:\users\john\documents\programming\github\etl\src\private\forward_list_base.h "../exception.h" "../error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\functional.h +1479511690 d:\users\john\documents\programming\github\etl\src\functional.h -1456669289 d:\users\john\documents\programming\github\etl\src\hash.h +1481841145 d:\users\john\documents\programming\github\etl\src\hash.h + "fnv_1.h" "type_traits.h" + "static_assert.h" -1456669289 d:\users\john\documents\programming\github\etl\src\instance_count.h +1479511690 d:\users\john\documents\programming\github\etl\src\instance_count.h -1456953131 d:\users\john\documents\programming\github\etl\src\intrusive_forward_list.h +1482748239 d:\users\john\documents\programming\github\etl\src\intrusive_forward_list.h + "platform.h" @@ -5178,29 +5254,33 @@ "error_handler.h" "intrusive_links.h" "algorithm.h" + "private/counter_type.h" -1457466644 d:\users\john\documents\programming\github\etl\src\intrusive_links.h +1482354421 ounter_type.h" + +1482357841 d:\users\john\documents\programming\github\etl\src\intrusive_links.h + "nullptr.h" "type_traits.h" "exception.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\io_port.h +1479511690 d:\users\john\documents\programming\github\etl\src\io_port.h "nullptr.h" "parameter_type.h" -1456669289 d:\users\john\documents\programming\github\etl\src\largest.h +1479511690 d:\users\john\documents\programming\github\etl\src\largest.h "type_traits.h" -1456953131 d:\users\john\documents\programming\github\etl\src\list.h +1479511690 d:\users\john\documents\programming\github\etl\src\list.h "ilist.h" "container.h" "pool.h" -1456669289 d:\users\john\documents\programming\github\etl\src\ilist.h +1482748239 d:\users\john\documents\programming\github\etl\src\ilist.h @@ -5210,13 +5290,14 @@ "type_traits.h" "parameter_type.h" "pool.h" + "platform.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\list_base.h +1479511691 d:\users\john\documents\programming\github\etl\src\private\list_base.h "../exception.h" "../error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\map.h +1479511690 d:\users\john\documents\programming\github\etl\src\map.h @@ -5224,7 +5305,7 @@ "container.h" "pool.h" -1456669289 d:\users\john\documents\programming\github\etl\src\imap.h +1479511690 d:\users\john\documents\programming\github\etl\src\imap.h @@ -5234,33 +5315,34 @@ "type_traits.h" "parameter_type.h" "pool.h" + "platform.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\map_base.h +1481841066 d:\users\john\documents\programming\github\etl\src\private\map_base.h "../exception.h" "../error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\fibonacci.h +1479511689 d:\users\john\documents\programming\github\etl\src\fibonacci.h -1456669289 d:\users\john\documents\programming\github\etl\src\factorial.h +1479511689 d:\users\john\documents\programming\github\etl\src\factorial.h -1456669289 d:\users\john\documents\programming\github\etl\src\numeric.h +1479511690 d:\users\john\documents\programming\github\etl\src\numeric.h -1456669289 d:\users\john\documents\programming\github\etl\src\observer.h +1479511690 d:\users\john\documents\programming\github\etl\src\observer.h "vector.h" "exception.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\optional.h +1482748239 d:\users\john\documents\programming\github\etl\src\optional.h "alignment.h" "type_traits.h" "exception.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\queue.h +1479511691 d:\users\john\documents\programming\github\etl\src\queue.h "iqueue.h" @@ -5268,19 +5350,19 @@ "alignment.h" "array.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iqueue.h +1481841066 d:\users\john\documents\programming\github\etl\src\iqueue.h "private/queue_base.h" "type_traits.h" "parameter_type.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\queue_base.h +1479511691 d:\users\john\documents\programming\github\etl\src\private\queue_base.h "../exception.h" "../error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\set.h +1479511691 d:\users\john\documents\programming\github\etl\src\set.h @@ -5288,7 +5370,7 @@ "container.h" "pool.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iset.h +1479511690 d:\users\john\documents\programming\github\etl\src\iset.h @@ -5298,13 +5380,14 @@ "type_traits.h" "parameter_type.h" "pool.h" + "platform.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\set_base.h +1482625676 d:\users\john\documents\programming\github\etl\src\private\set_base.h "../exception.h" "../error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\stack.h +1479511691 d:\users\john\documents\programming\github\etl\src\stack.h @@ -5313,19 +5396,19 @@ "alignment.h" "array.h" -1456669289 d:\users\john\documents\programming\github\etl\src\istack.h +1481841066 d:\users\john\documents\programming\github\etl\src\istack.h "private/stack_base.h" "type_traits.h" "parameter_type.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\stack_base.h +1479511691 d:\users\john\documents\programming\github\etl\src\private\stack_base.h "../exception.h" "../error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_unordered_map.cpp +1482624915 source:d:\users\john\documents\programming\github\etl\test\test_unordered_map.cpp @@ -5338,7 +5421,9 @@ "data.h" "../src/unordered_map.h" -1456669289 d:\users\john\documents\programming\github\etl\src\unordered_map.h +1482624915 ordered_map.h" + +1479511691 d:\users\john\documents\programming\github\etl\src\unordered_map.h @@ -5349,7 +5434,7 @@ "intrusive_forward_list.h" "hash.h" -1456953131 d:\users\john\documents\programming\github\etl\src\iunordered_map.h +1482748240 d:\users\john\documents\programming\github\etl\src\iunordered_map.h @@ -5366,7 +5451,7 @@ "exception.h" "error_handler.h" -1457463503 d:\users\john\documents\programming\github\etl\src\variant.h +1481841437 d:\users\john\documents\programming\github\etl\src\variant.h "platform.h" "array.h" @@ -5377,20 +5462,23 @@ "static_assert.h" "alignment.h" "error_handler.h" + "largest.h" -1456669289 d:\users\john\documents\programming\github\etl\src\visitor.h +1479511691 d:\users\john\documents\programming\github\etl\src\visitor.h -1457570381 d:\users\john\documents\programming\github\etl\src\platform.h +1482759320 d:\users\john\documents\programming\github\etl\src\platform.h + + -1457463956 source:d:\users\john\documents\programming\github\etl\test\murmurhash3.cpp - "MurmurHash3.h" +1481841065 source:d:\users\john\documents\programming\github\etl\test\murmurhash3.cpp + "murmurhash3.h" -1457464314 d:\users\john\documents\programming\github\etl\test\murmurhash3.h +1479511691 d:\users\john\documents\programming\github\etl\test\murmurhash3.h "../src/platform.h" -1457508036 source:d:\users\john\documents\programming\github\etl\test\test_bsd_checksum.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_bsd_checksum.cpp @@ -5398,7 +5486,9 @@ "../src/checksum.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_flat_multimap.cpp +1479511692 ecksum.h" + +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_flat_multimap.cpp @@ -5410,14 +5500,16 @@ "data.h" "../src/flat_multimap.h" -1456669289 d:\users\john\documents\programming\github\etl\src\flat_multimap.h +1479511691 at_multimap.h" + +1479511690 d:\users\john\documents\programming\github\etl\src\flat_multimap.h "iflat_multimap.h" "vector.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iflat_multimap.h +1482748239 d:\users\john\documents\programming\github\etl\src\iflat_multimap.h @@ -5429,13 +5521,13 @@ "ivector.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\flat_multimap_base.h +1479511690 d:\users\john\documents\programming\github\etl\src\private\flat_multimap_base.h "../exception.h" "../ivector.h" "../error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_flat_multiset.cpp +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_flat_multiset.cpp @@ -5447,14 +5539,16 @@ "data.h" "../src/flat_multiset.h" -1456669289 d:\users\john\documents\programming\github\etl\src\flat_multiset.h +1479511691 at_multiset.h" + +1479511690 d:\users\john\documents\programming\github\etl\src\flat_multiset.h "iflat_multiset.h" "vector.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iflat_multiset.h +1482748239 d:\users\john\documents\programming\github\etl\src\iflat_multiset.h @@ -5466,19 +5560,21 @@ "ivector.h" "error_handler.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\flat_multiset_base.h +1479511690 d:\users\john\documents\programming\github\etl\src\private\flat_multiset_base.h "../exception.h" "../ivector.h" "../error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_links.cpp +1482358550 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_links.cpp "ExtraCheckMacros.h" "data.h" "../src/intrusive_links.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_list.cpp +1482358550 trusive_links.h" + +1482840619 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_list.cpp "ExtraCheckMacros.h" "data.h" @@ -5489,7 +5585,8 @@ -1457547716 d:\users\john\documents\programming\github\etl\src\intrusive_list.h +1482748239 d:\users\john\documents\programming\github\etl\src\intrusive_list.h + "platform.h" @@ -5501,8 +5598,9 @@ "intrusive_links.h" "static_assert.h" "algorithm.h" + "private/counter_type.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_jenkins.cpp +1482624277 source:d:\users\john\documents\programming\github\etl\test\test_jenkins.cpp "murmurhash3.h" @@ -5512,7 +5610,7 @@ "../src/jenkins.h" "../src/endian.h" -1457463503 d:\users\john\documents\programming\github\etl\src\jenkins.h +1481872412 d:\users\john\documents\programming\github\etl\src\jenkins.h "platform.h" @@ -5520,8 +5618,9 @@ "type_traits.h" "error_handler.h" "ihash.h" + "frame_check_sequence.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_multimap.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_multimap.cpp @@ -5531,7 +5630,9 @@ "../src/multimap.h" -1456669289 d:\users\john\documents\programming\github\etl\src\multimap.h +1479511692 ltimap.h" + +1479511690 d:\users\john\documents\programming\github\etl\src\multimap.h @@ -5539,7 +5640,7 @@ "container.h" "pool.h" -1457548955 d:\users\john\documents\programming\github\etl\src\imultimap.h +1482098369 d:\users\john\documents\programming\github\etl\src\imultimap.h @@ -5549,13 +5650,14 @@ "type_traits.h" "parameter_type.h" "pool.h" + "platform.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\multimap_base.h +1481309650 d:\users\john\documents\programming\github\etl\src\private\multimap_base.h "../exception.h" "../error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_multiset.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_multiset.cpp @@ -5565,7 +5667,9 @@ "../src/multiset.h" -1457548976 d:\users\john\documents\programming\github\etl\src\multiset.h +1479511692 ltiset.h" + +1479511690 d:\users\john\documents\programming\github\etl\src\multiset.h @@ -5573,7 +5677,7 @@ "container.h" "pool.h" -1457548988 d:\users\john\documents\programming\github\etl\src\imultiset.h +1482098369 d:\users\john\documents\programming\github\etl\src\imultiset.h @@ -5583,13 +5687,14 @@ "type_traits.h" "parameter_type.h" "pool.h" + "platform.h" -1456669289 d:\users\john\documents\programming\github\etl\src\private\multiset_base.h +1481309628 d:\users\john\documents\programming\github\etl\src\private\multiset_base.h "../exception.h" "../error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_murmur3.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_murmur3.cpp "murmurhash3.h" @@ -5599,14 +5704,14 @@ "../src/murmur3.h" "../src/endian.h" -1457463503 d:\users\john\documents\programming\github\etl\src\murmur3.h +1479511690 d:\users\john\documents\programming\github\etl\src\murmur3.h "platform.h" "ihash.h" "binary.h" "error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_pearson.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_pearson.cpp @@ -5616,7 +5721,7 @@ "../src/pearson.h" "../src/endian.h" -1457549034 d:\users\john\documents\programming\github\etl\src\pearson.h +1481308892 d:\users\john\documents\programming\github\etl\src\pearson.h "platform.h" "static_assert.h" @@ -5626,19 +5731,21 @@ "array.h" "container.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_priority_queue.cpp +1482624474 source:d:\users\john\documents\programming\github\etl\test\test_priority_queue.cpp "../src/priority_queue.h" -1456669289 d:\users\john\documents\programming\github\etl\src\priority_queue.h +1482624474 iority_queue.h" + +1479511690 d:\users\john\documents\programming\github\etl\src\priority_queue.h "ipriority_queue.h" "container.h" "vector.h" -1456669289 d:\users\john\documents\programming\github\etl\src\ipriority_queue.h +1482748239 d:\users\john\documents\programming\github\etl\src\ipriority_queue.h "type_traits.h" @@ -5646,7 +5753,7 @@ "error_handler.h" "exception.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_unordered_multimap.cpp +1482625301 source:d:\users\john\documents\programming\github\etl\test\test_unordered_multimap.cpp @@ -5659,7 +5766,9 @@ "data.h" "../src/unordered_multimap.h" -1456669289 d:\users\john\documents\programming\github\etl\src\unordered_multimap.h +1482625301 ordered_multimap.h" + +1479511691 d:\users\john\documents\programming\github\etl\src\unordered_multimap.h @@ -5670,7 +5779,7 @@ "intrusive_forward_list.h" "hash.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iunordered_multimap.h +1482748240 d:\users\john\documents\programming\github\etl\src\iunordered_multimap.h @@ -5687,7 +5796,7 @@ "exception.h" "error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_unordered_multiset.cpp +1482625301 source:d:\users\john\documents\programming\github\etl\test\test_unordered_multiset.cpp @@ -5701,7 +5810,7 @@ "../src/unordered_multiset.h" "../src/checksum.h" -1456669289 d:\users\john\documents\programming\github\etl\src\unordered_multiset.h +1479511691 d:\users\john\documents\programming\github\etl\src\unordered_multiset.h @@ -5712,7 +5821,7 @@ "intrusive_forward_list.h" "hash.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iunordered_multiset.h +1482748239 d:\users\john\documents\programming\github\etl\src\iunordered_multiset.h @@ -5729,7 +5838,7 @@ "exception.h" "error_handler.h" -1457378530 source:d:\users\john\documents\programming\github\etl\test\test_unordered_set.cpp +1482624916 source:d:\users\john\documents\programming\github\etl\test\test_unordered_set.cpp @@ -5742,7 +5851,7 @@ "../src/unordered_set.h" "../src/checksum.h" -1456669289 d:\users\john\documents\programming\github\etl\src\unordered_set.h +1479511691 d:\users\john\documents\programming\github\etl\src\unordered_set.h @@ -5753,7 +5862,7 @@ "intrusive_forward_list.h" "hash.h" -1456669289 d:\users\john\documents\programming\github\etl\src\iunordered_set.h +1482748240 d:\users\john\documents\programming\github\etl\src\iunordered_set.h @@ -5770,7 +5879,7 @@ "exception.h" "error_handler.h" -1456669289 source:d:\users\john\documents\programming\github\etl\test\test_xor_checksum.cpp +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_xor_checksum.cpp @@ -5778,3 +5887,1970 @@ "../src/checksum.h" +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\requiredcheckexception.h + "Config.h" + "HelperMacros.h" + + +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\requiremacros.h + "RequiredCheckTestReporter.h" + +1482076051 heckTestReporter.h" + +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\requiredchecktestreporter.h + "HelperMacros.h" + "ThrowingTestReporter.h" + +1482076051 estReporter.h" + +1482076051 d:\users\john\documents\programming\github\unittest-cpp\unittest++\throwingtestreporter.h + "TestReporter.h" + +1481309504 d:\users\john\documents\programming\github\etl\src\char_traits.h + + "platform.h" + "stdint.h" + "algorithm.h" + +1481841066 d:\users\john\documents\programming\github\etl\src\private\ivectorpointer.h + "pvoidvector.h" + +1482079098 or.h" + +1482748239 d:\users\john\documents\programming\github\etl\src\private\pvoidvector.h + + + + + "../platform.h" + "../algorithm.h" + "vector_base.h" + "../type_traits.h" + "../error_handler.h" + +1482353821 d:\users\john\documents\programming\github\etl\src\private\counter_type.h + +1482079098 source:d:\users\john\documents\programming\github\etl\src\private\pvoidvector.cpp + "pvoidvector.h" + +1479511691 source:d:\users\john\documents\programming\github\etl\test\test_debounce.cpp + + "../src/debounce.h" + +1479511691 bounce.h" + +1481309477 d:\users\john\documents\programming\github\etl\src\debounce.h + + "static_assert.h" + +1482624916 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_queue.cpp + + "../src/intrusive_queue.h" + "../src/intrusive_links.h" + + +1482354421 d:\users\john\documents\programming\github\etl\src\intrusive_queue.h + + "type_traits.h" + "error_handler.h" + "intrusive_links.h" + "private/counter_type.h" + +1482624474 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_stack.cpp + + "../src/intrusive_stack.h" + "../src/intrusive_links.h" + + +1482354421 d:\users\john\documents\programming\github\etl\src\intrusive_stack.h + + "type_traits.h" + "error_handler.h" + "intrusive_links.h" + "private/counter_type.h" + +1482614415 source:d:\users\john\documents\programming\github\etl\test\test_string_char.cpp + + + + + "../src/cstring.h" + +1482181573 tring.h" + +1482614484 d:\users\john\documents\programming\github\etl\src\cstring.h + "platform.h" + "basic_string.h" + "ibasic_string.h" + "hash.h" + +1479511689 d:\users\john\documents\programming\github\etl\src\basic_string.h + + + + "ibasic_string.h" + "char_traits.h" + "container.h" + "alignment.h" + "array.h" + +1482748239 d:\users\john\documents\programming\github\etl\src\ibasic_string.h + + + + + + "private/string_base.h" + "platform.h" + "algorithm.h" + "type_traits.h" + "error_handler.h" + "algorithm.h" + "char_traits.h" + +1482614484 d:\users\john\documents\programming\github\etl\src\private\string_base.h + + "../platform.h" + "../integral_limits.h" + "../exception.h" + "../error_handler.h" + +1482099557 source:d:\users\john\documents\programming\github\etl\test\test_string_u16.cpp + + + + + "../src/u16string.h" + +1482099557 6string.h" + +1481841066 d:\users\john\documents\programming\github\etl\src\u16string.h + "platform.h" + "basic_string.h" + "hash.h" + +1482099666 source:d:\users\john\documents\programming\github\etl\test\test_string_u32.cpp + + + + + "../src/u32string.h" + +1482099666 2string.h" + +1481841066 d:\users\john\documents\programming\github\etl\src\u32string.h + "platform.h" + "basic_string.h" + "hash.h" + +1482181573 source:d:\users\john\documents\programming\github\etl\test\test_string_wchar_t.cpp + + + + + "../src/wstring.h" + +1481841066 d:\users\john\documents\programming\github\etl\src\wstring.h + "platform.h" + "basic_string.h" + "hash.h" + +1482624916 source:d:\users\john\documents\programming\github\etl\test\test_type_def.cpp + + + "../src/type_def.h" + +1482624916 pe_def.h" + +1481841066 d:\users\john\documents\programming\github\etl\src\type_def.h + +1482074959 source:d:\users\john\documents\programming\github\etl\test\test_utility.cpp + + "../src/utility.h" + +1482074959 ility.h" + +1482075058 d:\users\john\documents\programming\github\etl\src\utility.h + "type_traits.h" + +1479511692 source:d:\users\john\documents\programming\github\etl\test\test_vector_pointer.cpp + + + + + "../src/vector.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/AssertException.cpp + "AssertException.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/AssertException.h + "Config.h" + "HelperMacros.h" + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Config.h + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/HelperMacros.h + "Config.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Checks.cpp + "Checks.h" + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Checks.h + "Config.h" + "TestResults.h" + "MemoryOutStream.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestResults.h + "HelperMacros.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/MemoryOutStream.h + "Config.h" + "HelperMacros.h" + + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/CompositeTestReporter.cpp + "CompositeTestReporter.h" + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/CompositeTestReporter.h + "TestReporter.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestReporter.h + "HelperMacros.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/CurrentTest.cpp + "CurrentTest.h" + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/CurrentTest.h + "HelperMacros.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/DeferredTestReporter.cpp + "Config.h" + "DeferredTestReporter.h" + "TestDetails.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/DeferredTestReporter.h + "Config.h" + "TestReporter.h" + "DeferredTestResult.h" + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/DeferredTestResult.h + "Config.h" + "HelperMacros.h" + + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestDetails.h + "HelperMacros.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/DeferredTestResult.cpp + "Config.h" + "DeferredTestResult.h" + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/MemoryOutStream.cpp + "MemoryOutStream.h" + + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Posix/SignalTranslator.cpp + "SignalTranslator.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Posix/SignalTranslator.h + + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Posix/TimeHelpers.cpp + "TimeHelpers.h" + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Posix/TimeHelpers.h + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/ReportAssert.cpp + "ReportAssert.h" + "ReportAssertImpl.h" + "AssertException.h" + "CurrentTest.h" + "TestResults.h" + "TestDetails.h" + "ReportAssertImpl.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/ReportAssert.h + "HelperMacros.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/ReportAssertImpl.h + "Config.h" + "HelperMacros.h" + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/RequiredCheckException.cpp + "RequiredCheckException.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/RequiredCheckException.h + "Config.h" + "HelperMacros.h" + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/RequiredCheckTestReporter.cpp + "RequiredCheckTestReporter.h" + "CurrentTest.h" + "TestResults.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/RequiredCheckTestReporter.h + "HelperMacros.h" + "ThrowingTestReporter.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/ThrowingTestReporter.h + "TestReporter.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Test.cpp + "Config.h" + "Test.h" + "TestList.h" + "TestResults.h" + "AssertException.h" + "MemoryOutStream.h" + "ExecuteTest.h" + "Posix/SignalTranslator.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Test.h + "TestDetails.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestList.h + "HelperMacros.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/ExecuteTest.h + "Config.h" + "ExceptionMacros.h" + "TestDetails.h" + "TestResults.h" + "MemoryOutStream.h" + "AssertException.h" + "RequiredCheckException.h" + "CurrentTest.h" + "ReportAssertImpl.h" + "Posix/SignalTranslator.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/ExceptionMacros.h + "Config.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestDetails.cpp + "TestDetails.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestList.cpp + "TestList.h" + "Test.h" + + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestReporter.cpp + "TestReporter.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestReporterStdout.cpp + "TestReporterStdout.h" + + "TestDetails.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestReporterStdout.h + "TestReporter.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestResults.cpp + "TestResults.h" + "TestReporter.h" + "TestDetails.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestRunner.cpp + "TestRunner.h" + "TestResults.h" + "TestReporter.h" + "TestReporterStdout.h" + "TimeHelpers.h" + "MemoryOutStream.h" + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestRunner.h + "Test.h" + "TestList.h" + "CurrentTest.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TimeHelpers.h + "Config.h" + "Posix/TimeHelpers.h" + "Win32/TimeHelpers.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/Win32/TimeHelpers.h + "../Config.h" + "../HelperMacros.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/ThrowingTestReporter.cpp + "ThrowingTestReporter.h" + "RequiredCheckException.h" + "ReportAssertImpl.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TimeConstraint.cpp + "TimeConstraint.h" + "TestResults.h" + "MemoryOutStream.h" + "CurrentTest.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TimeConstraint.h + "TimeHelpers.h" + "HelperMacros.h" + "TestDetails.h" + +1482076051 source:/mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/XmlTestReporter.cpp + "Config.h" + "XmlTestReporter.h" + + + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/XmlTestReporter.h + "Config.h" + "DeferredTestReporter.h" + + +1479511689 source:/mnt/hgfs/Programming/GitHub/etl/src/crc16.cpp + + +1479511689 source:/mnt/hgfs/Programming/GitHub/etl/src/crc16_ccitt.cpp + + +1479511689 source:/mnt/hgfs/Programming/GitHub/etl/src/crc16_kermit.cpp + + +1479511689 source:/mnt/hgfs/Programming/GitHub/etl/src/crc32.cpp + + +1479511689 source:/mnt/hgfs/Programming/GitHub/etl/src/crc64_ecma.cpp + + +1481309487 source:/mnt/hgfs/Programming/GitHub/etl/src/crc8_ccitt.cpp + + "platform.h" + "static_assert.h" + +1482759320 /mnt/hgfs/Programming/GitHub/etl/src/platform.h + + + +1481841065 /mnt/hgfs/Programming/GitHub/etl/src/static_assert.h + "platform.h" + +1479511689 source:/mnt/hgfs/Programming/GitHub/etl/src/error_handler.cpp + "error_handler.h" + "nullptr.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/error_handler.h + + "exception.h" + "function.h" + +1481841065 /mnt/hgfs/Programming/GitHub/etl/src/exception.h + +1481841065 /mnt/hgfs/Programming/GitHub/etl/src/function.h + +1481308917 /mnt/hgfs/Programming/GitHub/etl/src/nullptr.h + "platform.h" + + +1481841066 source:/mnt/hgfs/Programming/GitHub/etl/src/pearson.cpp + + "platform.h" + "static_assert.h" + +1482079098 source:/mnt/hgfs/Programming/GitHub/etl/src/private/pvoidvector.cpp + "pvoidvector.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/private/pvoidvector.h + + + + + "../platform.h" + "../algorithm.h" + "vector_base.h" + "../type_traits.h" + "../error_handler.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/algorithm.h + + + + + + "type_traits.h" + +1482922140 /mnt/hgfs/Programming/GitHub/etl/src/type_traits.h + + "platform.h" + "nullptr.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/private/vector_base.h + + "../exception.h" + "../error_handler.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/main.cpp + + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/UnitTest++.h + "UnitTestPP.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/UnitTestPP.h + "Config.h" + "TestMacros.h" + "CheckMacros.h" + "RequireMacros.h" + "TestRunner.h" + "TimeConstraint.h" + "ReportAssert.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestMacros.h + "Config.h" + "TestSuite.h" + "ExceptionMacros.h" + "ExecuteTest.h" + "AssertException.h" + "TestDetails.h" + "MemoryOutStream.h" + "Posix/SignalTranslator.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/TestSuite.h + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/CheckMacros.h + "HelperMacros.h" + "ExceptionMacros.h" + "Checks.h" + "AssertException.h" + "RequiredCheckException.h" + "MemoryOutStream.h" + "TestDetails.h" + "CurrentTest.h" + "ReportAssertImpl.h" + +1482076051 /mnt/hgfs/Programming/GitHub/unittest-cpp/UnitTest++/RequireMacros.h + "RequiredCheckTestReporter.h" + +1481841065 source:/mnt/hgfs/Programming/GitHub/etl/test/murmurhash3.cpp + "murmurhash3.h" + + +1479511691 /mnt/hgfs/Programming/GitHub/etl/test/murmurhash3.h + "../src/platform.h" + + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_algorithm.cpp + + "../src/algorithm.h" + "../src/container.h" + + + + + +1482613987 /mnt/hgfs/Programming/GitHub/etl/src/container.h + + + +1482624126 source:/mnt/hgfs/Programming/GitHub/etl/test/test_alignment.cpp + + "../src/alignment.h" + "../src/type_traits.h" + + + + + +1481309570 /mnt/hgfs/Programming/GitHub/etl/src/alignment.h + + "type_traits.h" + "static_assert.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_array.cpp + + "../src/array.h" + + + + "../src/integral_limits.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/array.h + + + + + "exception.h" + "type_traits.h" + "parameter_type.h" + "static_assert.h" + "error_handler.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/parameter_type.h + "type_traits.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/integral_limits.h + + + "type_traits.h" + "platform.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_binary.cpp + + + + "../src/binary.h" + "../src/bitset.h" + "../src/fnv_1.h" + "../src/integral_limits.h" + +1481309537 /mnt/hgfs/Programming/GitHub/etl/src/binary.h + + + "type_traits.h" + "integral_limits.h" + "static_assert.h" + "log.h" + "power.h" + "smallest.h" + "platform.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/log.h + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/power.h + + "log.h" + +1482653105 /mnt/hgfs/Programming/GitHub/etl/src/smallest.h + + "integral_limits.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/bitset.h + + + + + "platform.h" + "integral_limits.h" + "algorithm.h" + "nullptr.h" + "log.h" + "ibitset.h" + "error_handler.h" + +1481309224 /mnt/hgfs/Programming/GitHub/etl/src/ibitset.h + + + + "exception.h" + "integral_limits.h" + "binary.h" + "algorithm.h" + "platform.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/fnv_1.h + + "platform.h" + "static_assert.h" + "type_traits.h" + "ihash.h" + "frame_check_sequence.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/ihash.h + + + "exception.h" + "error_handler.h" + +1481841065 /mnt/hgfs/Programming/GitHub/etl/src/frame_check_sequence.h + + "platform.h" + "static_assert.h" + "type_traits.h" + "binary.h" + +1482623861 source:/mnt/hgfs/Programming/GitHub/etl/test/test_bitset.cpp + + + + + "../src/bitset.h" + +1482612858 source:/mnt/hgfs/Programming/GitHub/etl/test/test_bloom_filter.cpp + + + + "../src/bloom_filter.h" + "../src/fnv_1.h" + "../src/crc16.h" + "../src/crc16_ccitt.h" + "../src/crc32.h" + "../src/char_traits.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/bloom_filter.h + "parameter_type.h" + "bitset.h" + "type_traits.h" + "binary.h" + "log.h" + "power.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/crc16.h + + + "platform.h" + "frame_check_sequence.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/crc16_ccitt.h + + + "platform.h" + "frame_check_sequence.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/crc32.h + + + "platform.h" + "frame_check_sequence.h" + +1481309504 /mnt/hgfs/Programming/GitHub/etl/src/char_traits.h + + "platform.h" + "stdint.h" + "algorithm.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_bsd_checksum.cpp + + + + + + "../src/checksum.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/checksum.h + + "binary.h" + "frame_check_sequence.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_checksum.cpp + + + + + + "../src/checksum.h" + "../src/endian.h" + +1481309464 /mnt/hgfs/Programming/GitHub/etl/src/endian.h + + "enum_type.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/enum_type.h + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_container.cpp + + "../src/container.h" + + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_crc.cpp + + + + + + "../src/crc8_ccitt.h" + "../src/crc16.h" + "../src/crc16_ccitt.h" + "../src/crc16_kermit.h" + "../src/crc32.h" + "../src/crc64_ecma.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/crc8_ccitt.h + + + "platform.h" + "frame_check_sequence.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/crc16_kermit.h + + + "platform.h" + "frame_check_sequence.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/crc64_ecma.h + + + "platform.h" + "frame_check_sequence.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_cyclic_value.cpp + + "../src/cyclic_value.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/cyclic_value.h + + + "static_assert.h" + "exception.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_debounce.cpp + + "../src/debounce.h" + +1481309477 /mnt/hgfs/Programming/GitHub/etl/src/debounce.h + + "static_assert.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_deque.cpp + + "ExtraCheckMacros.h" + "../src/deque.h" + "data.h" + + + + + + +1479511691 /mnt/hgfs/Programming/GitHub/etl/test/ExtraCheckMacros.h + + + + + + + + + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/deque.h + + + + + "ideque.h" + "container.h" + "alignment.h" + "array.h" + +1482624126 /mnt/hgfs/Programming/GitHub/etl/src/ideque.h + + + "algorithm.h" + "type_traits.h" + "private/deque_base.h" + "parameter_type.h" + "error_handler.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/private/deque_base.h + + "../exception.h" + "../error_handler.h" + +1482185150 /mnt/hgfs/Programming/GitHub/etl/test/data.h + + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_endian.cpp + + + "../src/endian.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_enum_type.cpp + + + "../src/enum_type.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_error_handler.cpp + + + + + "../src/error_handler.h" + "../src/exception.h" + +1482625380 source:/mnt/hgfs/Programming/GitHub/etl/test/test_exception.cpp + + + "../src/exception.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_fixed_iterator.cpp + + + + "../src/fixed_iterator.h" + +1482624125 /mnt/hgfs/Programming/GitHub/etl/src/fixed_iterator.h + + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_flat_map.cpp + + + + + + + + + "data.h" + "../src/flat_map.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/flat_map.h + + + + "iflat_map.h" + "vector.h" + +1482748252 /mnt/hgfs/Programming/GitHub/etl/src/iflat_map.h + + + + + + "private/flat_map_base.h" + "type_traits.h" + "parameter_type.h" + "ivector.h" + "error_handler.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/private/flat_map_base.h + + "../exception.h" + "../ivector.h" + "../error_handler.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/ivector.h + + + + + "platform.h" + "algorithm.h" + "private/vector_base.h" + "type_traits.h" + "parameter_type.h" + "error_handler.h" + "private/ivectorpointer.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/private/ivectorpointer.h + "pvoidvector.h" + +1481841065 /mnt/hgfs/Programming/GitHub/etl/src/vector.h + + + + "ivector.h" + "container.h" + "alignment.h" + "array.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_flat_multimap.cpp + + + + + + + + + "data.h" + "../src/flat_multimap.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/flat_multimap.h + + + + "iflat_multimap.h" + "vector.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/iflat_multimap.h + + + + + + "private/flat_multimap_base.h" + "type_traits.h" + "parameter_type.h" + "ivector.h" + "error_handler.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/private/flat_multimap_base.h + + "../exception.h" + "../ivector.h" + "../error_handler.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_flat_multiset.cpp + + + + + + + + + "data.h" + "../src/flat_multiset.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/flat_multiset.h + + + + "iflat_multiset.h" + "vector.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/iflat_multiset.h + + + + + + "private/flat_multiset_base.h" + "type_traits.h" + "parameter_type.h" + "ivector.h" + "error_handler.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/private/flat_multiset_base.h + + "../exception.h" + "../ivector.h" + "../error_handler.h" + +1479511691 source:/mnt/hgfs/Programming/GitHub/etl/test/test_flat_set.cpp + + + + + + + + + "data.h" + "../src/flat_set.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/flat_set.h + + + + "iflat_set.h" + "vector.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/iflat_set.h + + + + + + "private/flat_set_base.h" + "type_traits.h" + "parameter_type.h" + "ivector.h" + "error_handler.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/private/flat_set_base.h + + "../exception.h" + "../ivector.h" + "../error_handler.h" + +1482623723 source:/mnt/hgfs/Programming/GitHub/etl/test/test_fnv_1.cpp + + + + + + "../src/fnv_1.h" + +1482625680 source:/mnt/hgfs/Programming/GitHub/etl/test/test_forward_list.cpp + + "ExtraCheckMacros.h" + "data.h" + "../src/forward_list.h" + + + + + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/forward_list.h + + "pool.h" + "iforward_list.h" + "container.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/pool.h + "alignment.h" + "array.h" + "bitset.h" + "ipool.h" + + +1481841065 /mnt/hgfs/Programming/GitHub/etl/src/ipool.h + + "private/pool_base.h" + "nullptr.h" + "ibitset.h" + "error_handler.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/private/pool_base.h + + "../exception.h" + "../error_handler.h" + "../error_handler.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/iforward_list.h + "platform.h" + + + + + "pool.h" + "nullptr.h" + "private/forward_list_base.h" + "type_traits.h" + "parameter_type.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/private/forward_list_base.h + + "../exception.h" + "../error_handler.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_function.cpp + + "../src/function.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_functional.cpp + + "../src/functional.h" + + + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/functional.h + +1482624624 source:/mnt/hgfs/Programming/GitHub/etl/test/test_hash.cpp + + + + + + "../src/hash.h" + +1481841145 /mnt/hgfs/Programming/GitHub/etl/src/hash.h + + + "fnv_1.h" + "type_traits.h" + "static_assert.h" + +1482624916 source:/mnt/hgfs/Programming/GitHub/etl/test/test_instance_count.cpp + + "../src/instance_count.h" + + + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/instance_count.h + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_integral_limits.cpp + + + + + "../src/integral_limits.h" + +1482799048 source:/mnt/hgfs/Programming/GitHub/etl/test/test_intrusive_forward_list.cpp + + "ExtraCheckMacros.h" + "data.h" + "../src/intrusive_forward_list.h" + + + + + + + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/intrusive_forward_list.h + "platform.h" + + + + + "nullptr.h" + "type_traits.h" + "exception.h" + "error_handler.h" + "intrusive_links.h" + "algorithm.h" + "private/counter_type.h" + +1482357841 /mnt/hgfs/Programming/GitHub/etl/src/intrusive_links.h + + + "nullptr.h" + "type_traits.h" + "exception.h" + "error_handler.h" + +1482353821 /mnt/hgfs/Programming/GitHub/etl/src/private/counter_type.h + +1482358550 source:/mnt/hgfs/Programming/GitHub/etl/test/test_intrusive_links.cpp + + "ExtraCheckMacros.h" + "data.h" + "../src/intrusive_links.h" + +1482840779 source:/mnt/hgfs/Programming/GitHub/etl/test/test_intrusive_list.cpp + + "ExtraCheckMacros.h" + "data.h" + "../src/intrusive_list.h" + + + + + + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/intrusive_list.h + "platform.h" + + + + + "nullptr.h" + "type_traits.h" + "exception.h" + "error_handler.h" + "intrusive_links.h" + "static_assert.h" + "algorithm.h" + "private/counter_type.h" + +1482624916 source:/mnt/hgfs/Programming/GitHub/etl/test/test_intrusive_queue.cpp + + "../src/intrusive_queue.h" + "../src/intrusive_links.h" + + +1482354421 /mnt/hgfs/Programming/GitHub/etl/src/intrusive_queue.h + + "type_traits.h" + "error_handler.h" + "intrusive_links.h" + "private/counter_type.h" + +1482624474 source:/mnt/hgfs/Programming/GitHub/etl/test/test_intrusive_stack.cpp + + "../src/intrusive_stack.h" + "../src/intrusive_links.h" + + +1482354421 /mnt/hgfs/Programming/GitHub/etl/src/intrusive_stack.h + + "type_traits.h" + "error_handler.h" + "intrusive_links.h" + "private/counter_type.h" + +1482750186 source:/mnt/hgfs/Programming/GitHub/etl/test/test_io_port.cpp + + "../src/io_port.h" + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/io_port.h + + "nullptr.h" + "parameter_type.h" + +1482624277 source:/mnt/hgfs/Programming/GitHub/etl/test/test_jenkins.cpp + + "murmurhash3.h" + + + + + "../src/jenkins.h" + "../src/endian.h" + +1481872412 /mnt/hgfs/Programming/GitHub/etl/src/jenkins.h + + + "platform.h" + "static_assert.h" + "type_traits.h" + "error_handler.h" + "ihash.h" + "frame_check_sequence.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_largest.cpp + + "../src/largest.h" + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/largest.h + "type_traits.h" + +1482625302 source:/mnt/hgfs/Programming/GitHub/etl/test/test_list.cpp + + "ExtraCheckMacros.h" + "../src/list.h" + "data.h" + + + + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/list.h + + "ilist.h" + "container.h" + "pool.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/ilist.h + + + + + "nullptr.h" + "private/list_base.h" + "type_traits.h" + "parameter_type.h" + "pool.h" + "platform.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/private/list_base.h + + "../exception.h" + "../error_handler.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_map.cpp + + + + + + + + + "../src/map.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/map.h + + + + "imap.h" + "container.h" + "pool.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/imap.h + + + + + "nullptr.h" + "private/map_base.h" + "type_traits.h" + "parameter_type.h" + "pool.h" + "platform.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/private/map_base.h + + "../exception.h" + "../error_handler.h" + +1482692728 source:/mnt/hgfs/Programming/GitHub/etl/test/test_maths.cpp + + "../src/log.h" + "../src/power.h" + "../src/fibonacci.h" + "../src/factorial.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/fibonacci.h + + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/factorial.h + + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_multimap.cpp + + + + + + + + "../src/multimap.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/multimap.h + + + + "imultimap.h" + "container.h" + "pool.h" + +1482098369 /mnt/hgfs/Programming/GitHub/etl/src/imultimap.h + + + + + "nullptr.h" + "private/multimap_base.h" + "type_traits.h" + "parameter_type.h" + "pool.h" + "platform.h" + +1481309650 /mnt/hgfs/Programming/GitHub/etl/src/private/multimap_base.h + + "../exception.h" + "../error_handler.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_multiset.cpp + + + + + + + + "../src/multiset.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/multiset.h + + + + "imultiset.h" + "container.h" + "pool.h" + +1482098369 /mnt/hgfs/Programming/GitHub/etl/src/imultiset.h + + + + + "nullptr.h" + "private/multiset_base.h" + "type_traits.h" + "parameter_type.h" + "pool.h" + "platform.h" + +1481309628 /mnt/hgfs/Programming/GitHub/etl/src/private/multiset_base.h + + "../exception.h" + "../error_handler.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_murmur3.cpp + + "murmurhash3.h" + + + + + "../src/murmur3.h" + "../src/endian.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/murmur3.h + + "platform.h" + "ihash.h" + "binary.h" + "error_handler.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_numeric.cpp + + "../src/numeric.h" + + + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/numeric.h + +1482624916 source:/mnt/hgfs/Programming/GitHub/etl/test/test_observer.cpp + + "../src/observer.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/observer.h + + "vector.h" + "exception.h" + "error_handler.h" + +1482624916 source:/mnt/hgfs/Programming/GitHub/etl/test/test_optional.cpp + + + + "../src/optional.h" + "../src/vector.h" + "data.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/optional.h + "alignment.h" + "type_traits.h" + "exception.h" + "error_handler.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_pearson.cpp + + + + + + + "../src/pearson.h" + "../src/endian.h" + +1481308892 /mnt/hgfs/Programming/GitHub/etl/src/pearson.h + + "platform.h" + "static_assert.h" + "type_traits.h" + "endian.h" + "ihash.h" + "array.h" + "container.h" + +1482750186 source:/mnt/hgfs/Programming/GitHub/etl/test/test_pool.cpp + + "ExtraCheckMacros.h" + "data.h" + + + "../src/pool.h" + +1482624474 source:/mnt/hgfs/Programming/GitHub/etl/test/test_priority_queue.cpp + + + "../src/priority_queue.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/priority_queue.h + + + "ipriority_queue.h" + "container.h" + "vector.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/ipriority_queue.h + + + "type_traits.h" + "parameter_type.h" + "error_handler.h" + "exception.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_queue.cpp + + + "../src/queue.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/queue.h + + + "iqueue.h" + "container.h" + "alignment.h" + "array.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/iqueue.h + + "private/queue_base.h" + "type_traits.h" + "parameter_type.h" + "error_handler.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/private/queue_base.h + + "../exception.h" + "../error_handler.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_set.cpp + + + + + + + + + "../src/set.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/set.h + + + + "iset.h" + "container.h" + "pool.h" + +1479511690 /mnt/hgfs/Programming/GitHub/etl/src/iset.h + + + + + "nullptr.h" + "private/set_base.h" + "type_traits.h" + "parameter_type.h" + "pool.h" + "platform.h" + +1482625676 /mnt/hgfs/Programming/GitHub/etl/src/private/set_base.h + + "../exception.h" + "../error_handler.h" + +1482654345 source:/mnt/hgfs/Programming/GitHub/etl/test/test_smallest.cpp + + "../src/smallest.h" + + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_stack.cpp + + + "data.h" + "../src/stack.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/stack.h + + + + "istack.h" + "container.h" + "alignment.h" + "array.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/istack.h + + "private/stack_base.h" + "type_traits.h" + "parameter_type.h" + "error_handler.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/private/stack_base.h + + "../exception.h" + "../error_handler.h" + +1482614415 source:/mnt/hgfs/Programming/GitHub/etl/test/test_string_char.cpp + + + + + "../src/cstring.h" + +1482614484 /mnt/hgfs/Programming/GitHub/etl/src/cstring.h + "platform.h" + "basic_string.h" + "ibasic_string.h" + "hash.h" + +1479511689 /mnt/hgfs/Programming/GitHub/etl/src/basic_string.h + + + + "ibasic_string.h" + "char_traits.h" + "container.h" + "alignment.h" + "array.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/ibasic_string.h + + + + + + "private/string_base.h" + "platform.h" + "algorithm.h" + "type_traits.h" + "error_handler.h" + "algorithm.h" + "char_traits.h" + +1482614484 /mnt/hgfs/Programming/GitHub/etl/src/private/string_base.h + + "../platform.h" + "../integral_limits.h" + "../exception.h" + "../error_handler.h" + +1482099557 source:/mnt/hgfs/Programming/GitHub/etl/test/test_string_u16.cpp + + + + + "../src/u16string.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/u16string.h + "platform.h" + "basic_string.h" + "hash.h" + +1482099666 source:/mnt/hgfs/Programming/GitHub/etl/test/test_string_u32.cpp + + + + + "../src/u32string.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/u32string.h + "platform.h" + "basic_string.h" + "hash.h" + +1482181573 source:/mnt/hgfs/Programming/GitHub/etl/test/test_string_wchar_t.cpp + + + + + "../src/wstring.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/wstring.h + "platform.h" + "basic_string.h" + "hash.h" + +1482624916 source:/mnt/hgfs/Programming/GitHub/etl/test/test_type_def.cpp + + + "../src/type_def.h" + +1481841066 /mnt/hgfs/Programming/GitHub/etl/src/type_def.h + +1482624915 source:/mnt/hgfs/Programming/GitHub/etl/test/test_unordered_map.cpp + + + + + + + + + + "data.h" + "../src/unordered_map.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/unordered_map.h + + + + "iunordered_map.h" + "container.h" + "pool.h" + "vector.h" + "intrusive_forward_list.h" + "hash.h" + +1482748240 /mnt/hgfs/Programming/GitHub/etl/src/iunordered_map.h + + + + + + "type_traits.h" + "parameter_type.h" + "hash.h" + "nullptr.h" + "ipool.h" + "ivector.h" + "error_handler.h" + "intrusive_forward_list.h" + "exception.h" + "error_handler.h" + +1482625301 source:/mnt/hgfs/Programming/GitHub/etl/test/test_unordered_multimap.cpp + + + + + + + + + + "data.h" + "../src/unordered_multimap.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/unordered_multimap.h + + + + "iunordered_multimap.h" + "container.h" + "pool.h" + "vector.h" + "intrusive_forward_list.h" + "hash.h" + +1482748240 /mnt/hgfs/Programming/GitHub/etl/src/iunordered_multimap.h + + + + + + "type_traits.h" + "parameter_type.h" + "hash.h" + "nullptr.h" + "ipool.h" + "ivector.h" + "error_handler.h" + "intrusive_forward_list.h" + "exception.h" + "error_handler.h" + +1482625301 source:/mnt/hgfs/Programming/GitHub/etl/test/test_unordered_multiset.cpp + + + + + + + + + + "data.h" + "../src/unordered_multiset.h" + "../src/checksum.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/unordered_multiset.h + + + + "iunordered_multiset.h" + "container.h" + "pool.h" + "vector.h" + "intrusive_forward_list.h" + "hash.h" + +1482748239 /mnt/hgfs/Programming/GitHub/etl/src/iunordered_multiset.h + + + + + + "type_traits.h" + "parameter_type.h" + "hash.h" + "nullptr.h" + "ipool.h" + "ivector.h" + "error_handler.h" + "intrusive_forward_list.h" + "exception.h" + "error_handler.h" + +1482624916 source:/mnt/hgfs/Programming/GitHub/etl/test/test_unordered_set.cpp + + + + + + + + + "data.h" + "../src/unordered_set.h" + "../src/checksum.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/unordered_set.h + + + + "iunordered_set.h" + "container.h" + "pool.h" + "vector.h" + "intrusive_forward_list.h" + "hash.h" + +1482748240 /mnt/hgfs/Programming/GitHub/etl/src/iunordered_set.h + + + + + + "type_traits.h" + "parameter_type.h" + "hash.h" + "nullptr.h" + "ipool.h" + "ivector.h" + "error_handler.h" + "intrusive_forward_list.h" + "exception.h" + "error_handler.h" + +1482074959 source:/mnt/hgfs/Programming/GitHub/etl/test/test_utility.cpp + + "../src/utility.h" + +1482075058 /mnt/hgfs/Programming/GitHub/etl/src/utility.h + "type_traits.h" + +1481841066 source:/mnt/hgfs/Programming/GitHub/etl/test/test_variant.cpp + + "ExtraCheckMacros.h" + "../src/variant.h" + + + + +1481841437 /mnt/hgfs/Programming/GitHub/etl/src/variant.h + + "platform.h" + "array.h" + "largest.h" + "exception.h" + "type_traits.h" + "integral_limits.h" + "static_assert.h" + "alignment.h" + "error_handler.h" + "largest.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_vector.cpp + + + + + "../src/vector.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_vector_pointer.cpp + + + + + "../src/vector.h" + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_visitor.cpp + + "../src/visitor.h" + +1479511691 /mnt/hgfs/Programming/GitHub/etl/src/visitor.h + +1479511692 source:/mnt/hgfs/Programming/GitHub/etl/test/test_xor_checksum.cpp + + + + + + "../src/checksum.h" + +1482922480 source:/mnt/hgfs/Programming/GitHub/etl/test/test_type_traits.cpp + + "../src/type_traits.h" + + + diff --git a/test/codeblocks/ETL.layout b/test/codeblocks/ETL.layout index 8fa3ea47..199dbeca 100644 --- a/test/codeblocks/ETL.layout +++ b/test/codeblocks/ETL.layout @@ -1,355 +1,419 @@ - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/vs2015/etl.vcxproj b/test/vs2015/etl.vcxproj index c671e270..69d2a083 100644 --- a/test/vs2015/etl.vcxproj +++ b/test/vs2015/etl.vcxproj @@ -169,6 +169,7 @@ + @@ -208,6 +209,7 @@ + @@ -271,7 +273,6 @@ - @@ -281,6 +282,7 @@ + @@ -358,15 +360,20 @@ - true + false - true + false - true + false + + + false + + + false - @@ -403,6 +410,7 @@ + diff --git a/test/vs2015/etl.vcxproj.filters b/test/vs2015/etl.vcxproj.filters index 244fdd50..d74a3301 100644 --- a/test/vs2015/etl.vcxproj.filters +++ b/test/vs2015/etl.vcxproj.filters @@ -498,9 +498,6 @@ ETL\Containers - - ETL\Containers - ETL\Containers @@ -522,6 +519,15 @@ ETL\Containers + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + @@ -812,6 +818,12 @@ Source Files + + Source Files + + + Source Files + From 77ecb120dc916afe8eaa3694210d5af77ba1c7fe Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:21:54 +0000 Subject: [PATCH 88/93] Deleted files --- src/private/counter_type.h | 139 ------------------------- src/string.h | 203 ------------------------------------- 2 files changed, 342 deletions(-) delete mode 100644 src/private/counter_type.h delete mode 100644 src/string.h diff --git a/src/private/counter_type.h b/src/private/counter_type.h deleted file mode 100644 index df94fbe8..00000000 --- a/src/private/counter_type.h +++ /dev/null @@ -1,139 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -http://www.etlcpp.com - -Copyright(c) 2016 jwellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#ifndef __ETL_COUNTER_TYPE__ -#define __ETL_COUNTER_TYPE__ - -#include - -#include "../intrusive_links.h" - -namespace etl -{ - //************************************************************************* - /// Counter type based on intrusive link count option. - //************************************************************************* - template - class counter_type - { - }; - - //************************************************************************* - /// Slow type. - //************************************************************************* - template <> - class counter_type - { - public: - - counter_type& operator ++() - { - return *this; - } - - counter_type& operator --() - { - return *this; - } - - counter_type& operator =(size_t new_count) - { - return *this; - } - - counter_type& operator +=(size_t diff) - { - return *this; - } - - counter_type& operator -=(size_t diff) - { - return *this; - } - - size_t get_count() const - { - return 0; - } - }; - - //************************************************************************* - /// Fast type. - //************************************************************************* - template <> - class counter_type - { - public: - - counter_type() - : count(0) - { - } - - counter_type& operator ++() - { - ++count; - return *this; - } - - counter_type& operator --() - { - --count; - return *this; - } - - counter_type& operator =(size_t new_count) - { - count = new_count; - return *this; - } - - counter_type& operator +=(size_t diff) - { - count += diff; - return *this; - } - - counter_type& operator -=(size_t diff) - { - count -= diff; - return *this; - } - - size_t get_count() const - { - return count; - } - - size_t count; - }; -} - -#endif diff --git a/src/string.h b/src/string.h deleted file mode 100644 index 26f1fbdf..00000000 --- a/src/string.h +++ /dev/null @@ -1,203 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -http://www.etlcpp.com - -Copyright(c) 2016 jwellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#ifndef __ETL_STRING__ -#define __ETL_STRING__ - -#include "platform.h" -#include "basic_string.h" -#include "hash.h" - -#if defined(ETL_COMPILER_MICROSOFT) - #undef min -#endif - -namespace etl -{ - typedef ibasic_string istring; - - //*************************************************************************** - /// A string implementation that uses a fixed size buffer. - ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. - ///\ingroup string - //*************************************************************************** - template - class string : public istring - { - public: - - typedef istring::value_type value_type; - - static const size_t MAX_SIZE = MAX_SIZE_; - - //************************************************************************* - /// Constructor. - //************************************************************************* - string() - : istring(reinterpret_cast(&buffer), MAX_SIZE) - { - istring::initialise(); - } - - //************************************************************************* - /// Copy constructor. - ///\param other The other string. - //************************************************************************* - string(const etl::string& other) - : istring(reinterpret_cast(&buffer), MAX_SIZE) - { - istring::initialise(); - istring::assign(other.begin(), other.end()); - } - - //************************************************************************* - /// From other string, position, length. - ///\param other The other string. - ///\param position The position of the first character. - ///\param length The number of characters. Default = npos. - //************************************************************************* - string(const etl::string& other, size_t position, size_t length = npos) - : istring(reinterpret_cast(&buffer), MAX_SIZE) - { - ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds)); - - // Set the length to the exact amount. - length = (length > MAX_SIZE_) ? MAX_SIZE_ : length; - - istring::initialise(); - istring::assign(other.begin() + position, other.begin() + position + length); - } - - //************************************************************************* - /// Constructor, from null terminated text. - ///\param text The initial text of the string. - //************************************************************************* - string(const value_type* text) - : istring(reinterpret_cast(&buffer), MAX_SIZE) - { - istring::initialise(); - istring::assign(text, text + etl::char_traits::length(text)); - } - - //************************************************************************* - /// Constructor, from null terminated text and count. - ///\param text The initial text of the string. - ///\param count The number of characters to copy. - //************************************************************************* - string(const value_type* text, size_t count) - : istring(reinterpret_cast(&buffer), MAX_SIZE) - { - istring::initialise(); - istring::assign(text, text + count); - } - - //************************************************************************* - /// Constructor, from initial size and value. - ///\param initialSize The initial size of the string. - ///\param value The value to fill the string with. - //************************************************************************* - string(size_t count, value_type c) - : istring(reinterpret_cast(&buffer), MAX_SIZE) - { - istring::initialise(); - istring::resize(count, c); - } - - //************************************************************************* - /// Constructor, from an iterator range. - ///\tparam TIterator The iterator type. - ///\param first The iterator to the first element. - ///\param last The iterator to the last element + 1. - //************************************************************************* - template - string(TIterator first, TIterator last) - : istring(reinterpret_cast(&buffer), MAX_SIZE) - { - istring::assign(first, last); - } - - //************************************************************************* - /// Returns a sub-string. - ///\param position The position of the first character. Default = 0. - ///\param length The number of characters. Default = npos. - //************************************************************************* - etl::string substr(size_t position = 0, size_t length = npos) const - { - etl::string new_string; - - if (position != size()) - { - ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds)); - - length = std::min(length, size() - position); - - new_string.assign(buffer + position, buffer + position + length); - } - - return new_string; - } - - //************************************************************************* - /// Assignment operator. - //************************************************************************* - string& operator = (const string& rhs) - { - if (&rhs != this) - { - istring::assign(rhs.cbegin(), rhs.cend()); - } - - return *this; - } - - private: - - value_type buffer[MAX_SIZE + 1]; - }; - - //************************************************************************* - /// Hash function. - //************************************************************************* - template <> - struct hash - { - size_t operator()(const etl::istring& text) const - { - return etl::__private_hash__::generic_hash<>(reinterpret_cast(&text[0]), - reinterpret_cast(&text[text.size()])); - } - }; -} - -#if defined(ETL_COMPILER_MICROSOFT) - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#endif From bc18cfa49647f236ea441171fc4d5c87bb0cfa30 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:22:37 +0000 Subject: [PATCH 89/93] Tests for intrusive_queue --- test/test_intrusive_queue.cpp | 259 ++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 test/test_intrusive_queue.cpp diff --git a/test/test_intrusive_queue.cpp b/test/test_intrusive_queue.cpp new file mode 100644 index 00000000..a0f660e2 --- /dev/null +++ b/test/test_intrusive_queue.cpp @@ -0,0 +1,259 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include + +#include "../src/intrusive_queue.h" +#include "../src/intrusive_links.h" + +#include + +namespace +{ + typedef etl::forward_link<0> link0; + typedef etl::bidirectional_link<1> link1; + + struct Data : public link0, public link1 + { + Data(int i) + : i(i) + { + + } + + int i; + }; + + bool operator ==(const Data& lhs, const Data& rhs) + { + return lhs.i == rhs.i; + } + + std::ostream& operator << (std::ostream& os, const Data& data) + { + os << data.i; + return os; + } + + std::vector data = + { + Data(1), Data(2), Data(3), Data(4), Data(5), Data(6), Data(7), Data(8) + }; + + SUITE(test_intrusive_queue) + { + //************************************************************************* + TEST(test_constructor) + { + etl::intrusive_queue queueD; + etl::intrusive_queue queueC; + + CHECK(queueD.empty()); + CHECK(queueC.empty()); + + CHECK_EQUAL(0U, queueD.size()); + CHECK_EQUAL(0U, queueC.size()); + } + + //************************************************************************* + TEST(test_empty) + { + etl::intrusive_queue queueD; + etl::intrusive_queue queueC; + + Data data1(1); + Data data2(2); + + CHECK(queueD.empty()); + CHECK(queueC.empty()); + + queueD.push(data1); + queueC.push(data2); + + CHECK(!queueD.empty()); + CHECK(!queueC.empty()); + } + + //************************************************************************* + TEST(test_size) + { + Data data1(1); + Data data2(2); + Data data3(3); + + etl::intrusive_queue queueD; + etl::intrusive_queue queueC; + + queueD.push(data1); + queueD.push(data2); + queueD.push(data3); + + queueC.push(data1); + queueC.push(data2); + + CHECK_EQUAL(3U, queueD.size()); + CHECK_EQUAL(2U, queueC.size()); + } + + //************************************************************************* + TEST(test_clear) + { + Data data1(1); + Data data2(2); + Data data3(3); + + etl::intrusive_queue queueD; + etl::intrusive_queue queueC; + + queueD.push(data1); + queueD.push(data2); + queueD.push(data3); + + queueC.push(data1); + queueC.push(data2); + + queueD.clear(); + queueC.clear(); + + CHECK(queueD.empty()); + CHECK(queueC.empty()); + } + + //************************************************************************* + TEST(test_push) + { + Data data1(1); + Data data2(2); + Data data3(3); + + etl::intrusive_queue queueD; + etl::intrusive_queue queueC; + + queueD.push(data1); + CHECK_EQUAL(queueD.front(), data1); + CHECK_EQUAL(queueD.back(), data1); + + queueD.push(data2); + CHECK_EQUAL(queueD.front(), data1); + CHECK_EQUAL(queueD.back(), data2); + + queueD.push(data3); + CHECK_EQUAL(queueD.front(), data1); + CHECK_EQUAL(queueD.back(), data3); + + queueC.push(data1); + CHECK_EQUAL(queueC.front(), data1); + CHECK_EQUAL(queueC.back(), data1); + + queueC.push(data2); + CHECK_EQUAL(queueC.front(), data1); + CHECK_EQUAL(queueC.back(), data2); + } + + + //************************************************************************* + TEST(test_pop) + { + Data data1(1); + Data data2(2); + Data data3(3); + + etl::intrusive_queue queueD; + etl::intrusive_queue queueC; + + queueD.push(data1); + queueD.push(data2); + queueD.push(data3); + + queueC.push(data1); + queueC.push(data2); + + CHECK_EQUAL(queueD.front(), data1); + CHECK_EQUAL(queueD.back(), data3); + queueD.pop(); + CHECK_EQUAL(queueD.front(), data2); + CHECK_EQUAL(queueD.back(), data3); + queueD.pop(); + CHECK_EQUAL(queueD.front(), data3); + CHECK_EQUAL(queueD.back(), data3); + queueD.pop(); + CHECK(queueD.empty()); + + CHECK_EQUAL(queueC.front(), data1); + CHECK_EQUAL(queueC.back(), data2); + queueC.pop(); + CHECK_EQUAL(queueC.front(), data2); + CHECK_EQUAL(queueC.back(), data2); + queueC.pop(); + CHECK(queueC.empty()); + } + + //************************************************************************* + TEST(test_front_const) + { + Data data1(1); + Data data2(2); + Data data3(3); + + etl::intrusive_queue queueD; + const etl::intrusive_queue& queueDR = queueD; + + queueD.push(data1); + queueD.push(data2); + queueD.push(data3); + + CHECK_EQUAL(queueD.front(), queueDR.front()); + queueD.pop(); + CHECK_EQUAL(queueD.front(), queueDR.front()); + queueD.pop(); + CHECK_EQUAL(queueD.front(), queueDR.front()); + } + + //************************************************************************* + TEST(test_back_const) + { + + Data data1(1); + Data data2(2); + Data data3(3); + + etl::intrusive_queue queueD; + const etl::intrusive_queue& queueDR = queueD; + + queueD.push(data1); + queueD.push(data2); + queueD.push(data3); + + CHECK_EQUAL(queueD.back(), queueDR.back()); + queueD.pop(); + CHECK_EQUAL(queueD.back(), queueDR.back()); + queueD.pop(); + CHECK_EQUAL(queueD.back(), queueDR.back()); + } + }; +} From d38cde25a692267796aa117d2eda7ee6dbfd6118 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:33:30 +0000 Subject: [PATCH 90/93] Replaces string.h --- src/cstring.h | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 src/cstring.h diff --git a/src/cstring.h b/src/cstring.h new file mode 100644 index 00000000..61f08f64 --- /dev/null +++ b/src/cstring.h @@ -0,0 +1,204 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_STRING__ +#define __ETL_STRING__ + +#include "platform.h" +#include "basic_string.h" +#include "ibasic_string.h" +#include "hash.h" + +#if defined(ETL_COMPILER_MICROSOFT) + #undef min +#endif + +namespace etl +{ + typedef etl::ibasic_string istring; + + //*************************************************************************** + /// A string implementation that uses a fixed size buffer. + ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. + ///\ingroup string + //*************************************************************************** + template + class string : public istring + { + public: + + typedef istring::value_type value_type; + + static const size_t MAX_SIZE = MAX_SIZE_; + + //************************************************************************* + /// Constructor. + //************************************************************************* + string() + : istring(reinterpret_cast(&buffer), MAX_SIZE) + { + istring::initialise(); + } + + //************************************************************************* + /// Copy constructor. + ///\param other The other string. + //************************************************************************* + string(const etl::string& other) + : istring(reinterpret_cast(&buffer), MAX_SIZE) + { + istring::initialise(); + istring::assign(other.begin(), other.end()); + } + + //************************************************************************* + /// From other string, position, length. + ///\param other The other string. + ///\param position The position of the first character. + ///\param length The number of characters. Default = npos. + //************************************************************************* + string(const etl::string& other, size_t position, size_t length = npos) + : istring(reinterpret_cast(&buffer), MAX_SIZE) + { + ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds)); + + // Set the length to the exact amount. + length = (length > MAX_SIZE_) ? MAX_SIZE_ : length; + + istring::initialise(); + istring::assign(other.begin() + position, other.begin() + position + length); + } + + //************************************************************************* + /// Constructor, from null terminated text. + ///\param text The initial text of the string. + //************************************************************************* + string(const value_type* text) + : istring(reinterpret_cast(&buffer), MAX_SIZE) + { + istring::initialise(); + istring::assign(text, text + etl::char_traits::length(text)); + } + + //************************************************************************* + /// Constructor, from null terminated text and count. + ///\param text The initial text of the string. + ///\param count The number of characters to copy. + //************************************************************************* + string(const value_type* text, size_t count) + : istring(reinterpret_cast(&buffer), MAX_SIZE) + { + istring::initialise(); + istring::assign(text, text + count); + } + + //************************************************************************* + /// Constructor, from initial size and value. + ///\param initialSize The initial size of the string. + ///\param value The value to fill the string with. + //************************************************************************* + string(size_t count, value_type c) + : istring(reinterpret_cast(&buffer), MAX_SIZE) + { + istring::initialise(); + istring::resize(count, c); + } + + //************************************************************************* + /// Constructor, from an iterator range. + ///\tparam TIterator The iterator type. + ///\param first The iterator to the first element. + ///\param last The iterator to the last element + 1. + //************************************************************************* + template + string(TIterator first, TIterator last) + : istring(reinterpret_cast(&buffer), MAX_SIZE) + { + istring::assign(first, last); + } + + //************************************************************************* + /// Returns a sub-string. + ///\param position The position of the first character. Default = 0. + ///\param length The number of characters. Default = npos. + //************************************************************************* + etl::string substr(size_t position = 0, size_t length = npos) const + { + etl::string new_string; + + if (position != this->size()) + { + ETL_ASSERT(position < this->size(), ETL_ERROR(string_out_of_bounds)); + + length = std::min(length, this->size() - position); + + new_string.assign(buffer + position, buffer + position + length); + } + + return new_string; + } + + //************************************************************************* + /// Assignment operator. + //************************************************************************* + string& operator = (const string& rhs) + { + if (&rhs != this) + { + istring::assign(rhs.cbegin(), rhs.cend()); + } + + return *this; + } + + private: + + value_type buffer[MAX_SIZE + 1]; + }; + + //************************************************************************* + /// Hash function. + //************************************************************************* + template <> + struct hash + { + size_t operator()(const etl::istring& text) const + { + return etl::__private_hash__::generic_hash<>(reinterpret_cast(&text[0]), + reinterpret_cast(&text[text.size()])); + } + }; +} + +#if defined(ETL_COMPILER_MICROSOFT) + #define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +#endif From e7293655291d96a2b8b39762de2d7979f187df42 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:34:04 +0000 Subject: [PATCH 91/93] Support for vectors of pointers. --- src/private/pvoidvector.cpp | 107 ++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/private/pvoidvector.cpp diff --git a/src/private/pvoidvector.cpp b/src/private/pvoidvector.cpp new file mode 100644 index 00000000..6b74805d --- /dev/null +++ b/src/private/pvoidvector.cpp @@ -0,0 +1,107 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include "pvoidvector.h" + +namespace etl +{ + //*************************************************************************** + /// Equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the arrays are equal, otherwise false + ///\ingroup vector + //*************************************************************************** + bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin()); + } + + //*************************************************************************** + /// Not equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the arrays are not equal, otherwise false + ///\ingroup vector + //*************************************************************************** + bool operator !=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return !(lhs == rhs); + } + + //*************************************************************************** + /// Less than operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexicographically less than the second, otherwise false + ///\ingroup vector + //*************************************************************************** + inline bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + } + + //*************************************************************************** + /// Greater than operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexicographically greater than the second, otherwise false + ///\ingroup vector + //*************************************************************************** + bool operator >(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return (rhs < lhs); + } + + //*************************************************************************** + /// Less than or equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexicographically less than or equal to the second, otherwise false + ///\ingroup vector + //*************************************************************************** + bool operator <=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return !(lhs > rhs); + } + + //*************************************************************************** + /// Greater than or equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexicographically greater than or equal to the second, otherwise false + ///\ingroup vector + //*************************************************************************** + bool operator >=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) + { + return !(lhs < rhs); + } +} + From 782fc9983ec6e9437930e944c38efee741e6be5d Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 13:36:06 +0000 Subject: [PATCH 92/93] Support for vectors of pointers. --- src/ivectorpointer.h | 531 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 531 insertions(+) create mode 100644 src/ivectorpointer.h diff --git a/src/ivectorpointer.h b/src/ivectorpointer.h new file mode 100644 index 00000000..594af73a --- /dev/null +++ b/src/ivectorpointer.h @@ -0,0 +1,531 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2016 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef __ETL_IVECTOR_POINTER__ +#define __ETL_IVECTOR_POINTER__ + +#ifndef __ETL_IN_IVECTOR_H__ +#error This header is a private element of etl::ivector +#endif + +namespace etl +{ + //*************************************************************************** + /// The base class for specifically sized vectors. + /// Can be used as a reference type for all vectors containing a specific pointer type. + ///\ingroup vector + //*************************************************************************** + template ::value, void>::type*/> + class ivector : public ivector + { + private: + + // Stops warning messages about unused template parameter. + //const bool not_void_ptr = typedef etl::is_same::value; + + public: + + typedef T* value_type; + typedef T*& reference; + typedef const T* const & const_reference; + typedef T** pointer; + typedef const T* const * const_pointer; + typedef T** iterator; + typedef const T* const * const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef size_t size_type; + typedef typename std::iterator_traits::difference_type difference_type; + + protected: + + typedef value_type parameter_t; + + private: + + typedef ivector base_t; + + public: + + //********************************************************************* + /// Returns an iterator to the beginning of the vector. + ///\return An iterator to the beginning of the vector. + //********************************************************************* + iterator begin() + { + return iterator(base_t::begin()); + } + + //********************************************************************* + /// Returns a const_iterator to the beginning of the vector. + ///\return A const iterator to the beginning of the vector. + //********************************************************************* + const_iterator begin() const + { + return const_iterator(base_t::begin()); + } + + //********************************************************************* + /// Returns an iterator to the end of the vector. + ///\return An iterator to the end of the vector. + //********************************************************************* + iterator end() + { + return iterator(base_t::end()); + } + + //********************************************************************* + /// Returns a const_iterator to the end of the vector. + ///\return A const iterator to the end of the vector. + //********************************************************************* + const_iterator end() const + { + return const_iterator(base_t::end()); + } + + //********************************************************************* + /// Returns a const_iterator to the beginning of the vector. + ///\return A const iterator to the beginning of the vector. + //********************************************************************* + const_iterator cbegin() const + { + return const_iterator(base_t::cbegin()); + } + + //********************************************************************* + /// Returns a const_iterator to the end of the vector. + ///\return A const iterator to the end of the vector. + //********************************************************************* + const_iterator cend() const + { + return const_iterator(base_t::cend()); + } + + //********************************************************************* + /// Returns an reverse iterator to the reverse beginning of the vector. + ///\return Iterator to the reverse beginning of the vector. + //********************************************************************* + reverse_iterator rbegin() + { + return reverse_iterator(iterator(base_t::end())); + } + + //********************************************************************* + /// Returns a const reverse iterator to the reverse beginning of the vector. + ///\return Const iterator to the reverse beginning of the vector. + //********************************************************************* + const_reverse_iterator rbegin() const + { + return const_reverse_iterator(const_iterator(base_t::end())); + } + + //********************************************************************* + /// Returns a reverse iterator to the end + 1 of the vector. + ///\return Reverse iterator to the end + 1 of the vector. + //********************************************************************* + reverse_iterator rend() + { + return reverse_iterator(iterator(base_t::begin())); + } + + //********************************************************************* + /// Returns a const reverse iterator to the end + 1 of the vector. + ///\return Const reverse iterator to the end + 1 of the vector. + //********************************************************************* + const_reverse_iterator rend() const + { + return const_reverse_iterator(const_iterator(base_t::begin())); + } + + //********************************************************************* + /// Returns a const reverse iterator to the reverse beginning of the vector. + ///\return Const reverse iterator to the reverse beginning of the vector. + //********************************************************************* + const_reverse_iterator crbegin() const + { + return const_reverse_iterator(const_iterator(base_t::cend())); + } + + //********************************************************************* + /// Returns a const reverse iterator to the end + 1 of the vector. + ///\return Const reverse iterator to the end + 1 of the vector. + //********************************************************************* + const_reverse_iterator crend() const + { + return const_reverse_iterator(const_iterator(base_t::cbegin())); + } + + //********************************************************************* + /// Resizes the vector. + /// If asserts or exceptions are enabled and the new size is larger than the + /// maximum then a vector_full is thrown. + ///\param new_size The new size. + //********************************************************************* + void resize(size_t new_size) + { + base_t::resize(new_size); + } + + //********************************************************************* + /// Resizes the vector. + /// If asserts or exceptions are enabled and the new size is larger than the + /// maximum then a vector_full is thrown. + ///\param new_size The new size. + ///\param value The value to fill new elements with. Default = default constructed value. + //********************************************************************* + void resize(size_t new_size, value_type value) + { + base_t::resize(new_size, value); + } + + //********************************************************************* + /// Returns a reference to the value at index 'i' + ///\param i The index. + ///\return A reference to the value at index 'i' + //********************************************************************* + reference operator [](size_t i) + { + return reference(base_t::operator[](i)); + } + + //********************************************************************* + /// Returns a const reference to the value at index 'i' + ///\param i The index. + ///\return A const reference to the value at index 'i' + //********************************************************************* + const_reference operator [](size_t i) const + { + return const_reference(base_t::operator[](i)); + } + + //********************************************************************* + /// Returns a reference to the value at index 'i' + /// If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range. + ///\param i The index. + ///\return A reference to the value at index 'i' + //********************************************************************* + reference at(size_t i) + { + return reference(base_t::at(i)); + } + + //********************************************************************* + /// Returns a const reference to the value at index 'i' + /// If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range. + ///\param i The index. + ///\return A const reference to the value at index 'i' + //********************************************************************* + const_reference at(size_t i) const + { + return const_reference(base_t::at(i)); + } + + //********************************************************************* + /// Returns a reference to the first element. + ///\return A reference to the first element. + //********************************************************************* + reference front() + { + return reference(base_t::front()); + } + + //********************************************************************* + /// Returns a const reference to the first element. + ///\return A const reference to the first element. + //********************************************************************* + const_reference front() const + { + return const_reference(base_t::front()); + } + + //********************************************************************* + /// Returns a reference to the last element. + ///\return A reference to the last element. + //********************************************************************* + reference back() + { + return reference(base_t::back()); + } + + //********************************************************************* + /// Returns a const reference to the last element. + ///\return A const reference to the last element. + //********************************************************************* + const_reference back() const + { + return const_reference(base_t::back()); + } + + //********************************************************************* + /// Returns a pointer to the beginning of the vector data. + ///\return A pointer to the beginning of the vector data. + //********************************************************************* + pointer data() + { + return pointer(base_t::data()); + } + + //********************************************************************* + /// Returns a const pointer to the beginning of the vector data. + ///\return A const pointer to the beginning of the vector data. + //********************************************************************* + const_pointer data() const + { + return const_pointer(base_t::data()); + } + + //********************************************************************* + /// Assigns values to the vector. + /// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. + /// If asserts or exceptions are enabled, emits vector_iterator if the iterators are reversed. + ///\param first The iterator to the first element. + ///\param last The iterator to the last element + 1. + //********************************************************************* + template + void assign(TIterator first, TIterator last) + { + base_t::initialise(); + + while (first != last) + { + p_buffer[current_size++] = (void*)*first++; + } + } + + //********************************************************************* + /// Assigns values to the vector. + /// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. + ///\param n The number of elements to add. + ///\param value The value to insert for each element. + //********************************************************************* + void assign(size_t n, parameter_t value) + { + base_t::assign(n, value); + } + + //************************************************************************* + /// Clears the vector. + //************************************************************************* + void clear() + { + base_t::clear(); + } + + //************************************************************************* + /// Increases the size of the vector by one, but does not initialise the new element. + /// If asserts or exceptions are enabled, throws a vector_full if the vector is already full. + //************************************************************************* + void push_back() + { + base_t::push_back(); + } + + //********************************************************************* + /// Inserts a value at the end of the vector. + /// If asserts or exceptions are enabled, emits vector_full if the vector is already full. + ///\param value The value to add. + //********************************************************************* + void push_back(parameter_t value) + { + base_t::push_back(value); + } + + //************************************************************************* + /// Removes an element from the end of the vector. + /// Does nothing if the vector is empty. + //************************************************************************* + void pop_back() + { + base_t::pop_back(); + } + + //********************************************************************* + /// Inserts a value to the vector. + /// If asserts or exceptions are enabled, emits vector_full if the vector is already full. + ///\param position The position to insert before. + ///\param value The value to insert. + //********************************************************************* + iterator insert(iterator position, parameter_t value) + { + return iterator(base_t::insert(base_t::iterator(position), value)); + } + + //********************************************************************* + /// Inserts 'n' values to the vector. + /// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. + ///\param position The position to insert before. + ///\param n The number of elements to add. + ///\param value The value to insert. + //********************************************************************* + void insert(iterator position, size_t n, parameter_t value) + { + base_t::insert(base_t::iterator(position), n, value); + } + + //********************************************************************* + /// Inserts a range of values to the vector. + /// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. + ///\param position The position to insert before. + ///\param first The first element to add. + ///\param last The last + 1 element to add. + //********************************************************************* + template + void insert(iterator position, TIterator first, TIterator last) + { + base_t::insert(base_t::iterator(position), first, last); + } + + //********************************************************************* + /// Erases an element. + ///\param i_element Iterator to the element. + ///\return An iterator pointing to the element that followed the erased element. + //********************************************************************* + iterator erase(iterator i_element) + { + return iterator(base_t::erase(base_t::iterator(i_element))); + } + + //********************************************************************* + /// Erases a range of elements. + /// The range includes all the elements between first and last, including the + /// element pointed by first, but not the one pointed by last. + ///\param first Iterator to the first element. + ///\param last Iterator to the last element. + ///\return An iterator pointing to the element that followed the erased element. + //********************************************************************* + iterator erase(iterator first, iterator last) + { + return iterator(base_t::erase(base_t::iterator(first), base_t::iterator(last))); + } + + //************************************************************************* + /// Assignment operator. + //************************************************************************* + ivector& operator = (const ivector& rhs) + { + if (&rhs != this) + { + assign(rhs.cbegin(), rhs.cend()); + } + + return *this; + } + + protected: + + //********************************************************************* + /// Constructor. + //********************************************************************* + ivector(void** p_buffer, size_t MAX_SIZE) + : ivector(p_buffer, MAX_SIZE) + { + } + }; + + //*************************************************************************** + /// Equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the arrays are equal, otherwise false + ///\ingroup vector + //*************************************************************************** + template + bool operator ==(const etl::ivector& lhs, const etl::ivector& rhs) + { + return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin()); + } + + //*************************************************************************** + /// Not equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the arrays are not equal, otherwise false + ///\ingroup vector + //*************************************************************************** + template + bool operator !=(const etl::ivector& lhs, const etl::ivector& rhs) + { + return !(lhs == rhs); + } + + //*************************************************************************** + /// Less than operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexicographically less than the second, otherwise false + ///\ingroup vector + //*************************************************************************** + template + bool operator <(const etl::ivector& lhs, const etl::ivector& rhs) + { + return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + } + + //*************************************************************************** + /// Greater than operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexicographically greater than the second, otherwise false + ///\ingroup vector + //*************************************************************************** + template + bool operator >(const etl::ivector& lhs, const etl::ivector& rhs) + { + return (rhs < lhs); + } + + //*************************************************************************** + /// Less than or equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexigraphically less than or equal to the second, otherwise false + ///\ingroup vector + //*************************************************************************** + template + bool operator <=(const etl::ivector& lhs, const etl::ivector& rhs) + { + return !(lhs > rhs); + } + + //*************************************************************************** + /// Greater than or equal operator. + ///\param lhs Reference to the first vector. + ///\param rhs Reference to the second vector. + ///\return true if the first vector is lexigraphically greater than or equal to the second, otherwise false + ///\ingroup vector + //*************************************************************************** + template + bool operator >=(const etl::ivector& lhs, const etl::ivector& rhs) + { + return !(lhs < rhs); + } +} + +#endif From 0112c572352f0241d629551917117a42ea2a2cd8 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 28 Dec 2016 14:10:30 +0000 Subject: [PATCH 93/93] Updated to version 9.0.0 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index a29ea47a..fbd7fbf0 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library -version=8.2.0 +version=9.0.0 author= John Wellbelove maintainer=John Wellbelove sentence=A C++ template library tailored for embedded systems.