diff --git a/alignment.h b/alignment.h index b4467c4f..cd51528c 100644 --- a/alignment.h +++ b/alignment.h @@ -4,6 +4,7 @@ The MIT License(MIT) Embedded Template Library. +https://github.com/ETLCPP/etl Copyright(c) 2014 jwellbelove @@ -29,79 +30,163 @@ SOFTWARE. #ifndef __ETL_ALIGNEMENT__ #define __ETL_ALIGNEMENT__ -#include "type_traits.h" +#include -///\defgroup align_at align_at +#include "type_traits.h" +#include "static_assert.h" + +///\defgroup alignment alignment /// Creates a variable of the specified type at the specified alignment. /// \ingroup utilities -#if !defined(COMPILER_IAR) - -#if defined(COMPILER_MICROSOFT) -#define ETL_ALIGNMENT_PRE(n) __declspec(align(n)) -#define ETL_ALIGNMENT_POST(n) -#endif - -#if defined(COMPILER_GCC) -#define ETL_ALIGNMENT_PRE(n) -#define ETL_ALIGNMENT_POST(n) __attribute__((aligned(n))) -#endif - -#if defined (COMPILER_KEIL) -#define ETL_ALIGNMENT_PRE(n) -#define ETL_ALIGNMENT_POST(n) __attribute__((aligned(n))) -#endif - namespace etl -{ - /// Template declaration. - template - struct align_at; - - /// Align 1 - template - struct align_at +{ + namespace __private_alignment__ { - ETL_ALIGNMENT_PRE(1) T value ETL_ALIGNMENT_POST(1); + //*************************************************************************** + // Matcher. + //*************************************************************************** + template + class type_with_alignment_matcher; + + // Matching alignment. + template + class type_with_alignment_matcher + { + public: + + typedef T1 type; + }; + + // Non-matching alignment. + template + class type_with_alignment_matcher + { + public: + + typedef typename type_with_alignment_matcher::value, ALIGNMENT, T2, T3, T4, T5, T6, T7, T8, void>::type type; + }; + + // Non-matching alignment, non left. + template + class type_with_alignment_matcher + { + public: + }; + + //*************************************************************************** + // Helper. + //*************************************************************************** + template + class type_with_alignment_helper + { + public: + + typedef typename type_with_alignment_matcher::value, ALIGNMENT, T1, T2, T3, T4, T5, T6, T7, T8>::type type; + }; + } + + //*************************************************************************** + /// Gets a type that has the same as the specified alignment. + ///\ingroup alignment + //*************************************************************************** + template + class type_with_alignment + { + public: + + typedef typename __private_alignment__::type_with_alignment_helper::type type; }; - /// Align 2 - template - struct align_at + //*************************************************************************** + /// Aligned storage + ///\ingroup alignment + //*************************************************************************** + template + struct aligned_storage { - ETL_ALIGNMENT_PRE(2) T value ETL_ALIGNMENT_POST(2); + struct type + { + /// Convert to T reference. + template + operator T& () + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(*data); + } + + /// Convert to const T reference. + template + operator const T& () const + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(*data); + } + + /// Convert to T pointer. + template + operator T* () + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(data); + } + + /// Convert to const T pointer. + template + operator const T* () const + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(data); + } + + /// Get address as T reference. + template + T& get_reference() + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(*data); + } + + /// Get address as const T reference. + template + const T& get_reference() const + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(*data); + } + + /// Get address as T pointer. + template + T* get_address() + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(data); + } + + /// Get address as const T pointer. + template + const T* get_address() const + { + STATIC_ASSERT(ALIGNMENT % etl::alignment_of::value == 0, "Incompatible alignment"); + return reinterpret_cast(data); + } + + union + { + uint8_t data[LENGTH]; + typename etl::type_with_alignment::type __etl_alignment_type__; // A POD type that has the same alignment as ALIGNMENT. + }; + }; }; - /// Align 4 - template - struct align_at - { - ETL_ALIGNMENT_PRE(4) T value ETL_ALIGNMENT_POST(4); - }; - - /// Align 8 - template - struct align_at - { - ETL_ALIGNMENT_PRE(8) T value ETL_ALIGNMENT_POST(8); - }; - - /// Align 16 - template - struct align_at - { - ETL_ALIGNMENT_PRE(16) T value ETL_ALIGNMENT_POST(16); - }; - - /// Align As - template - struct align_as : public align_at::value> + //*************************************************************************** + /// Aligned storage as + ///\ingroup alignment + //*************************************************************************** + template + struct aligned_storage_as : public etl::aligned_storage::value> { }; } -#endif - -#undef ETL_ALIGNMENT_PRE -#undef ETL_ALIGNMENT_POST #endif diff --git a/binary.h b/binary.h index b5ec80a1..23e82a40 100644 --- a/binary.h +++ b/binary.h @@ -300,7 +300,7 @@ namespace etl static const int S[] = { 1, 2, 4 }; static const int B[] = { 0x55, 0x33, 0x0F }; - count = v - ((v >> 1) & B[0]); + count = value - ((value >> 1) & B[0]); count = ((count >> S[1]) & B[1]) + (count & B[1]); count = ((count >> S[2]) + count) & B[2]; @@ -318,7 +318,7 @@ namespace etl static const int S[] = { 1, 2, 4, 8 }; static const int B[] = { 0x5555, 0x3333, 0x0F0F, 0x00FF }; - count = v - ((v >> 1) & B[0]); + count = value - ((value >> 1) & B[0]); count = ((count >> S[1]) & B[1]) + (count & B[1]); count = ((count >> S[2]) + count) & B[2]; count = ((count >> S[3]) + count) & B[3]; diff --git a/bitset.h b/bitset.h index acbfa551..f6d5dbc1 100644 --- a/bitset.h +++ b/bitset.h @@ -42,6 +42,7 @@ SOFTWARE. #include "nullptr.h" #include "log.h" #include "ibitset.h" +#include "binary.h" #if WIN32 #undef min @@ -70,21 +71,21 @@ namespace etl class bitset : public ibitset { // The type used for each element in the array. - typedef typename smallest_uint_for_bits::type element_type; + typedef typename smallest_uint_for_bits::type element_t; - static const element_type ALL_SET = etl::integral_limits::max; - static const element_type ALL_CLEAR = 0; - static const size_t BITS_PER_ELEMENT = etl::integral_limits::bits; - static const size_t ARRAY_SIZE = (N % BITS_PER_ELEMENT == 0) ? N / BITS_PER_ELEMENT : N / BITS_PER_ELEMENT + 1; + static const element_t ALL_SET = etl::integral_limits::max; + static const element_t ALL_CLEAR = 0; + static const size_t BITS_PER_ELEMENT = etl::integral_limits::bits; + static const size_t ARRAY_SIZE = (N % BITS_PER_ELEMENT == 0) ? N / BITS_PER_ELEMENT : N / BITS_PER_ELEMENT + 1; public: - static const size_t TOTAL_BITS = ARRAY_SIZE * BITS_PER_ELEMENT; + static const size_t TOTAL_BITS = ARRAY_SIZE * BITS_PER_ELEMENT; private: - static const size_t TOP_MASK_SHIFT = ((BITS_PER_ELEMENT - (TOTAL_BITS - N)) % BITS_PER_ELEMENT); - static const element_type TOP_MASK = element_type(TOP_MASK_SHIFT == 0 ? ALL_SET : ~(ALL_SET << TOP_MASK_SHIFT)); + static const size_t TOP_MASK_SHIFT = ((BITS_PER_ELEMENT - (TOTAL_BITS - N)) % BITS_PER_ELEMENT); + static const element_t TOP_MASK = element_t(TOP_MASK_SHIFT == 0 ? ALL_SET : ~(ALL_SET << TOP_MASK_SHIFT)); public: @@ -588,7 +589,7 @@ namespace etl // Can we do it in one hit? if (SHIFT == 0) { - data[0] = element_type(value); + data[0] = element_t(value); } else { @@ -637,18 +638,18 @@ namespace etl { if (position < N) { - size_t index; - element_type bit; + size_t index; + element_t bit; if (ARRAY_SIZE == 1) { index = 0; - bit = element_type(1) << position; + bit = element_t(1) << position; } else { index = position >> log2::value; - bit = element_type(1) << (position & (BITS_PER_ELEMENT - 1)); + bit = element_t(1) << (position & (BITS_PER_ELEMENT - 1)); } if (value) @@ -698,17 +699,17 @@ namespace etl if (position < N) { size_t index; - element_type bit; + element_t bit; if (ARRAY_SIZE == 1) { index = 0; - bit = element_type(1) << position; + bit = element_t(1) << position; } else { index = position >> log2::value; - bit = element_type(1) << (position & (BITS_PER_ELEMENT - 1)); + bit = element_t(1) << (position & (BITS_PER_ELEMENT - 1)); } data[index] &= ~bit; @@ -739,18 +740,18 @@ namespace etl { if (position < N) { - size_t index; - element_type bit; + size_t index; + element_t bit; if (ARRAY_SIZE == 1) { index = 0; - bit = element_type(1) << position; + bit = element_t(1) << position; } else { index = position >> log2::value; - bit = element_type(1) << (position & (BITS_PER_ELEMENT - 1)); + bit = element_t(1) << (position & (BITS_PER_ELEMENT - 1)); } data[index] ^= bit; @@ -784,17 +785,17 @@ namespace etl if (position < N) { size_t index; - element_type mask; + element_t mask; if (ARRAY_SIZE == 1) { index = 0; - mask = element_type(1) << position; + mask = element_t(1) << position; } else { index = position >> log2::value; - mask = element_type(1) << (position & (BITS_PER_ELEMENT - 1)); + mask = element_t(1) << (position & (BITS_PER_ELEMENT - 1)); } return (data[index] & mask) != 0; @@ -837,7 +838,7 @@ namespace etl } //************************************************************************* - /// Are none of th bits set? + /// Are none of the bits set? //************************************************************************* bool none() const { @@ -861,13 +862,7 @@ namespace etl for (size_t i = 0; i < ARRAY_SIZE; ++i) { - element_type value = data[i]; - - while (value != 0) - { - n += (value & 1); - value >>= 1; - } + n += etl::count_bits(data[i]); } return n; @@ -914,24 +909,35 @@ namespace etl bit = position & (BITS_PER_ELEMENT - 1); } - element_type mask = 1 << bit; + element_t mask = 1 << bit; // For each element in the bitset... while (index < ARRAY_SIZE) { - // For each bit in the element... - while ((bit < BITS_PER_ELEMENT) && (position != N)) - { - // Equal to the required state? - if (((data[index] & mask) != 0) == state) - { - return position; - } + element_t value = data[index]; - // Move on to the next bit. - mask <<= 1; - ++position; - ++bit; + // Needs checking? + if (( state && (value != ALL_CLEAR)) || + (!state && (value != ALL_SET))) + { + // For each bit in the element... + while ((bit < BITS_PER_ELEMENT) && (position < N)) + { + // Equal to the required state? + if (((value & mask) != 0) == state) + { + return position; + } + + // Move on to the next bit. + mask <<= 1; + ++position; + ++bit; + } + } + else + { + position += BITS_PER_ELEMENT; } // Start at the beginning for all other elements. @@ -941,7 +947,7 @@ namespace etl ++index; } - return N; + return ibitset::npos; } //************************************************************************* @@ -1179,7 +1185,7 @@ namespace etl private: - etl::array data; + etl::array data; }; //*************************************************************************** diff --git a/deque.h b/deque.h index 548399a1..452cc568 100644 --- a/deque.h +++ b/deque.h @@ -80,7 +80,7 @@ namespace etl /// Default constructor. //************************************************************************* deque() - : ideque(reinterpret_cast(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE) + : ideque(reinterpret_cast(&buffer[0]), MAX_SIZE, BUFFER_SIZE) { } @@ -88,7 +88,7 @@ namespace etl /// Copy constructor. //************************************************************************* deque(const deque& other) - : ideque(reinterpret_cast(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE) + : ideque(reinterpret_cast(&buffer[0]), MAX_SIZE, BUFFER_SIZE) { ideque::assign(other.begin(), other.end()); } @@ -98,7 +98,7 @@ namespace etl //************************************************************************* template deque(TIterator begin, TIterator end) - : ideque(reinterpret_cast(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE) + : ideque(reinterpret_cast(&buffer[0]), MAX_SIZE, BUFFER_SIZE) { ideque::assign(begin, end); } @@ -107,7 +107,7 @@ namespace etl /// Assigns data to the deque. //************************************************************************* explicit deque(size_t n, typename ideque::parameter_t value = value_type()) - : ideque(reinterpret_cast(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE) + : ideque(reinterpret_cast(&buffer[0]), MAX_SIZE, BUFFER_SIZE) { ideque::assign(n, value); } @@ -128,7 +128,7 @@ namespace etl private: /// The unititialised buffer of T used in the deque. - etl::align_as, T> buffer; + typename etl::aligned_storage::value>::type buffer[BUFFER_SIZE]; }; } diff --git a/flat_map.h b/flat_map.h index c9fccd0e..7172668c 100644 --- a/flat_map.h +++ b/flat_map.h @@ -70,6 +70,15 @@ namespace etl { } + //************************************************************************* + /// Copy constructor. + //************************************************************************* + flat_map(const flat_map& other) + : iflat_map(buffer) + { + iflat_map::assign(other.cbegin(), other.cend()); + } + //************************************************************************* /// Constructor, from an iterator range. ///\tparam TIterator The iterator type. diff --git a/flat_set.h b/flat_set.h index d08c37a7..b9e4003c 100644 --- a/flat_set.h +++ b/flat_set.h @@ -69,6 +69,15 @@ namespace etl { } + //************************************************************************* + /// Copy constructor. + //************************************************************************* + flat_set(const flat_set& other) + : iflat_set(buffer) + { + iflat_set::assign(other.cbegin(), other.cend()); + } + //************************************************************************* /// Constructor, from an iterator range. ///\tparam TIterator The iterator type. diff --git a/ibitset.h b/ibitset.h index 0276f358..8ca437d8 100644 --- a/ibitset.h +++ b/ibitset.h @@ -30,6 +30,8 @@ SOFTWARE. #ifndef __ETL_IBITSET__ #define __ETL_IBITSET__ +#include "integral_limits.h" + namespace etl { //************************************************************************* @@ -40,6 +42,11 @@ namespace etl { public: + enum + { + npos = etl::integral_limits::max + }; + //************************************************************************* /// Default constructor. //************************************************************************* diff --git a/iflat_map.h b/iflat_map.h index 59b1d08a..ac377172 100644 --- a/iflat_map.h +++ b/iflat_map.h @@ -81,7 +81,7 @@ namespace etl typedef typename std::iterator_traits::difference_type difference_type; protected: - + typedef typename parameter_type::type key_value_parameter_t; private: @@ -106,19 +106,6 @@ namespace etl public: - //********************************************************************* - /// Assignment operator. - /// The source flat_map can be larger than the destination, but - /// only the elements that will fit in the destination will be copied. - ///\param other The other flat_map. - //********************************************************************* - iflat_map& operator = (iflat_map& other) - { - buffer.operator=(other.buffer); - - return *this; - } - //********************************************************************* /// Returns an iterator to the beginning of the flat_map. ///\return An iterator to the beginning of the flat_map. @@ -303,6 +290,19 @@ namespace etl template void assign(TIterator first, TIterator last) { +#ifdef _DEBUG + difference_type count = std::distance(first, last); + + if (count < 0) + { +#ifdef ETL_THROW_EXCEPTIONS + throw flat_map_iterator(); +#else + error_handler::error(flat_map_iterator()); +#endif + } +#endif + clear(); while (first != last) @@ -499,7 +499,7 @@ namespace etl { return std::lower_bound(cbegin(), cend(), key, compare()); } - + //********************************************************************* /// Finds the upper bound of a key ///\param key The key to search for. diff --git a/iflat_set.h b/iflat_set.h index 2e3571f7..392957c8 100644 --- a/iflat_set.h +++ b/iflat_set.h @@ -82,19 +82,6 @@ namespace etl public: - //********************************************************************* - /// Assignment operator. - /// The source flat_set can be larger than the destination, but - /// only the elements that will fit in the destination will be copied. - ///\param other The other flat_set. - //********************************************************************* - iflat_set& operator = (iflat_set& other) - { - buffer.operator=(other.buffer); - - return *this; - } - //********************************************************************* /// Returns an iterator to the beginning of the flat_set. ///\return An iterator to the beginning of the flat_set. @@ -213,6 +200,19 @@ namespace etl template void assign(TIterator first, TIterator last) { +#ifdef _DEBUG + difference_type count = std::distance(first, last); + + if (count < 0) + { +#ifdef ETL_THROW_EXCEPTIONS + throw flat_set_iterator(); +#else + error_handler::error(flat_set_iterator()); +#endif + } +#endif + clear(); while (first != last) diff --git a/iforward_list.h b/iforward_list.h index 18c2bf7f..472860fc 100644 --- a/iforward_list.h +++ b/iforward_list.h @@ -376,6 +376,19 @@ namespace etl template void assign(TIterator first, TIterator last) { +#ifdef _DEBUG + difference_type count = std::distance(first, last); + + if (count < 0) + { +#ifdef ETL_THROW_EXCEPTIONS + throw forward_list_iterator(); +#else + error_handler::error(forward_list_iterator()); +#endif + } +#endif + initialise(); Node* p_last_node = &start_node; diff --git a/ilist.h b/ilist.h index 4709b241..3b48e5b0 100644 --- a/ilist.h +++ b/ilist.h @@ -480,6 +480,19 @@ namespace etl template void assign(TIterator first, TIterator last) { +#ifdef _DEBUG + difference_type count = std::distance(first, last); + + if (count < 0) + { +#ifdef ETL_THROW_EXCEPTIONS + throw list_iterator(); +#else + error_handler::error(list_iterator()); +#endif + } +#endif + initialise(); // Add all of the elements. diff --git a/io_port.h b/io_port.h new file mode 100644 index 00000000..99112309 --- /dev/null +++ b/io_port.h @@ -0,0 +1,429 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl + +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. +******************************************************************************/ + +#ifndef __ETL_IO_PORT__ +#define __ETL_IO_PORT__ + +///\defgroup io_port io port +/// IO port access +///\ingroup utilities + +#include + +#include "nullptr.h" +#include "parameter_type.h" + +namespace etl +{ + //*************************************************************************** + /// Read write port. + //*************************************************************************** + template + class io_port_rw + { + private: + + typedef volatile T* pointer_t; + typedef typename etl::parameter_type::type parameter_t; + + public: + + /// Read. + operator T() volatile const + { + return *reinterpret_cast(ADDRESS); + } + + /// Read. + T value() volatile const + { + return *reinterpret_cast(ADDRESS); + } + + /// Write. + io_port_rw& operator =(parameter_t value) + { + *reinterpret_cast(ADDRESS) = value; + return *this; + } + + /// Get the IO port address. + pointer_t get_address() + { + return reinterpret_cast(ADDRESS); + } + }; + + //*************************************************************************** + /// Read only port. + //*************************************************************************** + template + class io_port_ro + { + private: + + typedef volatile const T* pointer_t; + typedef typename etl::parameter_type::type parameter_t; + + /// Write disabled. + void operator =(parameter_t value); + + public: + + /// Read. + operator T() volatile const + { + return *reinterpret_cast(ADDRESS); + } + + /// Read. + T value() volatile const + { + return *reinterpret_cast(ADDRESS); + } + + /// Get the IO port address. + pointer_t get_address() + { + return reinterpret_cast(ADDRESS); + } + }; + + //*************************************************************************** + /// Write only port. + //*************************************************************************** + template + class io_port_wo + { + private: + + typedef T* pointer_t; + typedef typename etl::parameter_type::type parameter_t; + + /// Read disabled. + operator T() volatile const; + + public: + + /// Write. + void operator =(parameter_t value) + { + *reinterpret_cast(ADDRESS) = value; + } + + /// Get the IO port address. + pointer_t get_address() + { + return reinterpret_cast(ADDRESS); + } + }; + + //*************************************************************************** + /// Write only port with shadow register. + //*************************************************************************** + template + class io_port_wos + { + private: + + typedef T* pointer_t; + typedef typename etl::parameter_type::type parameter_t; + + public: + + /// Read. + operator T() const + { + return shadow_value; + } + + /// Read. + T value() const + { + return shadow_value; + } + + /// Write. + io_port_wos& operator =(parameter_t value) + { + shadow_value = value; + *reinterpret_cast(ADDRESS) = shadow_value; + return *this; + } + + /// Get the IO port address. + pointer_t get_address() + { + return reinterpret_cast(ADDRESS); + } + + private: + + T shadow_value; + }; + + //*************************************************************************** + /// Read write port. + /// Specialisation for dynamic addresses. + //*************************************************************************** + template + class io_port_rw + { + private: + + typedef volatile T* pointer_t; + typedef typename etl::parameter_type::type parameter_t; + + public: + + // Default constructor. + io_port_rw() + : address(nullptr) + { + } + + // Constructor. + io_port_rw(uint8_t* address_) + : address(reinterpret_cast(address_)) + { + } + + /// Set the IO port address. + void set_address(uintptr_t address_) + { + address = reinterpret_cast(address_); + } + + /// Get the IO port address. + pointer_t get_address() + { + return address; + } + + /// Read. + operator T() volatile const + { + return *address; + } + + /// Read. + T value() volatile const + { + return *address; + } + + /// Write. + io_port_rw& operator =(parameter_t value) + { + *address = value; + return *this; + } + + private: + + pointer_t address; + }; + + //*************************************************************************** + /// Read only port. + /// Specialisation for dynamic addresses. + //*************************************************************************** + template + class io_port_ro + { + private: + + typedef volatile const T* pointer_t; + + public: + + // Default constructor. + io_port_ro() + : address(nullptr) + { + } + + // Constructor. + io_port_ro(void* address_) + : address(reinterpret_cast(address_)) + { + } + + void set_address(uintptr_t address_) + { + address = reinterpret_cast(address_); + } + + /// Get the IO port address. + pointer_t get_address() + { + return address; + } + + /// Read. + operator T() volatile const + { + return *address; + } + + /// Read. + T value() volatile const + { + return *address; + } + + private: + + typedef typename etl::parameter_type::type parameter_t; + + /// Write disabled. + void operator =(parameter_t value); + + pointer_t address; + }; + + //*************************************************************************** + /// Write only port. + /// Specialisation for dynamic addresses. + //*************************************************************************** + template + class io_port_wo + { + private: + + typedef T* pointer_t; + + public: + + typedef typename etl::parameter_type::type parameter_t; + + // Default constructor. + io_port_wo() + : address(nullptr) + { + } + + // Constructor. + io_port_wo(void* address_) + : address(reinterpret_cast(address_)) + { + } + + /// Set the IO port address. + void set_address(uintptr_t address_) + { + address = reinterpret_cast(address_); + } + + /// Get the IO port address. + pointer_t get_address() + { + return address; + } + + /// Write. + void operator =(parameter_t value) + { + *address = value; + } + + private: + + /// Read disabled. + operator T() volatile const; + + pointer_t address; + }; + + //*************************************************************************** + /// Write only port with shadow register. + /// Specialisation for dynamic addresses. + //*************************************************************************** + template + class io_port_wos + { + private: + + typedef T* pointer_t; + typedef typename etl::parameter_type::type parameter_t; + + public: + + // Default constructor. + io_port_wos() + : address(nullptr) + { + } + + // Constructor. + io_port_wos(void* address_) + : address(reinterpret_cast(address_)) + { + } + + /// Set the IO port address. + void set_address(uintptr_t address_) + { + address = reinterpret_cast(address_); + } + + /// Get the IO port address. + pointer_t get_address() + { + return address; + } + + /// Read. + operator T() const + { + return shadow_value; + } + + /// Read. + T value() const + { + return shadow_value; + } + + /// Write. + io_port_wos& operator =(parameter_t value) + { + shadow_value = value; + *address = shadow_value; + return *this; + } + + private: + + T shadow_value; + pointer_t address; + }; +} + +#endif diff --git a/ipool.h b/ipool.h index 8cdfccc2..c7b50c50 100644 --- a/ipool.h +++ b/ipool.h @@ -57,6 +57,99 @@ namespace etl typedef const T& const_reference; typedef size_t size_type; + //************************************************************************* + /// iterator + //************************************************************************* + class iterator : public std::iterator + { + public: + + friend class ipool; + friend class const_iterator; + + //******************************* + iterator() + : index(0), + p_buffer(nullptr), + p_in_use_flags(nullptr) + { + } + + //******************************* + iterator(const iterator& other) + : index(other.index), + p_buffer(other.p_buffer), + p_in_use_flags(other.p_in_use_flags) + { + } + + //******************************* + iterator& operator ++() + { + index = p_in_use_flags->find_next(true, index + 1); + return *this; + } + + //******************************* + iterator operator ++(int) + { + iterator temp(*this); + index = p_in_use_flags->find_next(true, index + 1); + return temp; + } + + //******************************* + iterator operator =(const iterator& other) + { + index = other.index; + p_buffer = other.p_buffer; + p_in_use_flags = other.p_in_use_flags; + return *this; + } + + //******************************* + const_reference operator *() const + { + return p_buffer[index]; + } + + //******************************* + const_pointer operator ->() const + { + return &p_buffer[index]; + } + + //******************************* + friend bool operator == (const iterator& lhs, const iterator& rhs) + { + return (lhs.p_buffer == rhs.p_buffer) && (lhs.index == rhs.index); + } + + //******************************* + friend bool operator != (const iterator& lhs, const iterator& rhs) + { + return !(lhs == rhs); + } + + private: + + //******************************* + //******************************* + iterator(size_t index, + pointer p_buffer, + const ibitset* p_in_use_flags) + : index(index), + p_buffer(p_buffer), + p_in_use_flags(p_in_use_flags) + { + } + + size_t index; + pointer p_buffer; + const ibitset* p_in_use_flags; + }; + + //************************************************************************* /// const_iterator //************************************************************************* @@ -69,16 +162,24 @@ namespace etl //******************************* const_iterator() : index(0), - p_buffer(p_buffer), - p_in_use_flags(p_in_use_flags) + p_buffer(nullptr), + p_in_use_flags(nullptr) { } //******************************* const_iterator(const const_iterator& other) : index(other.index), - p_buffer(p_buffer), - p_in_use_flags(p_in_use_flags) + p_buffer(other.p_buffer), + p_in_use_flags(other.p_in_use_flags) + { + } + + //******************************* + const_iterator(const typename ipool::iterator& other) + : index(other.index), + p_buffer(other.p_buffer), + p_in_use_flags(other.p_in_use_flags) { } @@ -133,15 +234,6 @@ namespace etl private: //******************************* - const_iterator(const_pointer p_buffer, - const ibitset* p_in_use_flags) - : index(0), - p_buffer(p_buffer), - p_in_use_flags(p_in_use_flags) - { - index = p_in_use_flags->find_first(true); - } - //******************************* const_iterator(size_t index, const_pointer p_buffer, @@ -157,12 +249,38 @@ namespace etl const ibitset* p_in_use_flags; }; + //************************************************************************* + /// Get an iterator to the first allocated item in the pool. + //************************************************************************* + iterator begin() + { + size_t index = in_use_flags.find_first(true); + + if (index != ibitset::npos) + { + return iterator(index, p_buffer, &in_use_flags); + } + else + { + return end(); + } + } + //************************************************************************* /// Get a const iterator to the first allocated item in the pool. //************************************************************************* const_iterator begin() const { - return const_iterator(in_use_flags.find_first(true), p_buffer, &in_use_flags); + size_t index = in_use_flags.find_first(true); + + if (index != ibitset::npos) + { + return const_iterator(index, p_buffer, &in_use_flags); + } + else + { + return end(); + } } //************************************************************************* @@ -173,12 +291,20 @@ namespace etl return begin(); } + //************************************************************************* + /// Get an iterator to the end of the pool. + //************************************************************************* + iterator end() + { + return iterator(ibitset::npos, p_buffer, &in_use_flags); + } + //************************************************************************* /// Get a const iterator to the end of the pool. //************************************************************************* const_iterator end() const { - return const_iterator(in_use_flags.size(), p_buffer, &in_use_flags); + return const_iterator(ibitset::npos, p_buffer, &in_use_flags); } //************************************************************************* diff --git a/ivector.h b/ivector.h index f67947a5..9d52a10a 100644 --- a/ivector.h +++ b/ivector.h @@ -83,7 +83,7 @@ namespace etl { return &p_buffer[0]; } - + //********************************************************************* /// Returns a const_iterator to the beginning of the vector. ///\return A const iterator to the beginning of the vector. @@ -91,7 +91,7 @@ namespace etl const_iterator begin() const { return &p_buffer[0]; - } + } //********************************************************************* /// Returns an iterator to the end of the vector. @@ -118,7 +118,7 @@ namespace etl const_iterator cbegin() const { return &p_buffer[0]; - } + } //********************************************************************* /// Returns a const_iterator to the end of the vector. @@ -137,7 +137,7 @@ namespace etl { return reverse_iterator(end()); } - + //********************************************************************* /// Returns a const reverse iterator to the reverse beginning of the vector. ///\return Const iterator to the reverse beginning of the vector. @@ -145,7 +145,7 @@ namespace etl const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); - } + } //********************************************************************* /// Returns a reverse iterator to the end + 1 of the vector. @@ -172,7 +172,7 @@ namespace etl const_reverse_iterator crbegin() const { return const_reverse_iterator(cend()); - } + } //********************************************************************* /// Returns a const reverse iterator to the end + 1 of the vector. @@ -380,8 +380,7 @@ namespace etl template void assign(TIterator first, TIterator last) { - initialise(); - +#ifdef _DEBUG difference_type count = std::distance(first, last); if (count < 0) @@ -389,10 +388,11 @@ namespace etl #ifdef ETL_THROW_EXCEPTIONS throw vector_iterator(); #else - error_handler::error((vector_iterator)); + error_handler::error(vector_iterator()); #endif } - else if (static_cast(count) > MAX_SIZE) + + if (static_cast(count) > MAX_SIZE) { #ifdef ETL_THROW_EXCEPTIONS throw vector_full(); @@ -400,14 +400,15 @@ namespace etl error_handler::error(vector_full()); #endif } - else +#endif + + initialise(); + + // Safe to copy. + while (first != last) { - // Safe to copy. - while (first != last) - { - create_element(*first); - ++first; - } + create_element(*first); + ++first; } } @@ -592,10 +593,10 @@ namespace etl { create_element_at(to++, value); } - + current_size += n_insert; } - } + } } //********************************************************************* @@ -685,7 +686,7 @@ namespace etl //********************************************************************* /// Erases a range of elements. - /// The range includes all the elements between first and last, including the + /// 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. @@ -695,7 +696,7 @@ namespace etl { std::copy(last, end(), first); size_t n_delete = std::distance(first, last); - + // Destroy the elements left over at the end. while (n_delete-- > 0) { diff --git a/map.h b/map.h index 968c5a5e..11e78159 100644 --- a/map.h +++ b/map.h @@ -67,7 +67,7 @@ namespace etl //************************************************************************* /// Copy constructor. //************************************************************************* - explicit map(const map& other) + map(const map& other) : imap(node_pool, MAX_SIZE) { imap::assign(other.cbegin(), other.cend()); diff --git a/optional.h b/optional.h new file mode 100644 index 00000000..7c0a100e --- /dev/null +++ b/optional.h @@ -0,0 +1,365 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl + +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_OPTIONAL__ +#define __ETL_OPTIONAL__ + +#include "alignment.h" +#include "type_traits.h" + +namespace etl +{ + //***************************************************************************** + /// A null option type. + ///\ingroup utilities + //***************************************************************************** + class nullopt_t + { + public: + + // Convertible to any type of null non-member pointer. + template + operator T*() const + { + return 0; + } + + private: + + // Can't take address of nullopt. + void operator&() const; + }; + + //***************************************************************************** + /// A null option. + ///\ingroup utilities + //***************************************************************************** + const nullopt_t nullopt = {}; + + //***************************************************************************** + /// An optional type. + /// If the optional type is not initialised then a type is not constructed. + ///\tparam The type to store. + ///\ingroup utilities + //***************************************************************************** + template + class optional + { + public: + + //*************************************************************************** + /// Constructor. + //*************************************************************************** + optional() + : valid(false) + { + } + + //*************************************************************************** + /// Constructor with nullopt. + //*************************************************************************** + optional(etl::nullopt_t) + : valid(false) + { + } + + //*************************************************************************** + /// Copy constructor. + //*************************************************************************** + optional(const optional& other) + { + if (other) + { + new (storage.template get_address()) T(other.value()); + valid = true; + } + } + + //*************************************************************************** + /// Constructor from value type. + //*************************************************************************** + optional(const T& value) + { + new (storage.template get_address()) T(value); + valid = true; + } + + //*************************************************************************** + /// Destructor. + //*************************************************************************** + ~optional() + { + if (valid) + { + storage. template get_reference().~T(); + } + } + + //*************************************************************************** + /// Assignment operator from nullopt. + //*************************************************************************** + optional& operator =(etl::nullopt_t) + { + if (valid) + { + storage. template get_reference().~T(); + valid = false; + } + + return *this; + } + + //*************************************************************************** + /// Assignment operator from optional. + //*************************************************************************** + optional& operator =(const optional& other) + { + if (valid && !bool(other)) + { + storage. template get_reference().~T(); + valid = false; + } + else if (bool(other)) + { + if (valid) + { + storage. template get_reference() = other.value(); + } + else + new (storage.template get_address()) T(other.value()); + { + valid = true; + } + } + + return *this; + } + + //*************************************************************************** + /// Assignment operator from value type. + //*************************************************************************** + optional& operator =(T& value) + { + if (valid) + { + storage. template get_reference() = value; + } + else + { + new (storage.template get_address()) T(value); + valid = true; + } + + return *this; + } + + //*************************************************************************** + /// Pointer operator. + //*************************************************************************** + T* operator ->() + { + return storage.template get_address(); + } + + //*************************************************************************** + /// Pointer operator. + //*************************************************************************** + const T* operator ->() const + { + return storage.template get_address(); + } + + //*************************************************************************** + /// Dereference operator. + //*************************************************************************** + T& operator *() + { + return storage. template get_reference(); + } + + //*************************************************************************** + /// Dereference operator. + //*************************************************************************** + const T& operator *() const + { + return storage. template get_reference(); + } + + //*************************************************************************** + /// Bool conversion operator. + //*************************************************************************** + explicit operator bool() const + { + return valid; + } + + //*************************************************************************** + /// Get a reference to the value. + //*************************************************************************** + T& value() + { + return storage. template get_reference(); + } + + //*************************************************************************** + /// Get a const reference to the value. + //*************************************************************************** + const T& value() const + { + return storage. template get_reference(); + } + + //*************************************************************************** + /// Gets the value or a default if no valid. + //*************************************************************************** + T value_or(T default_value) const + { + return valid ? value() : default_value; + } + + private: + + typename etl::aligned_storage_as::type storage; + bool valid; + }; +} + +//*************************************************************************** +/// Equality operator. +//*************************************************************************** +template +bool operator ==(const etl::optional& lhs, const etl::optional& rhs) +{ + if (bool(lhs) != bool(rhs)) + { + return false; + } + else if (!bool(lhs) && !bool(rhs)) + { + return true; + } + else + { + return lhs.value() == rhs.value(); + } +} + +//*************************************************************************** +/// Less than operator. +//*************************************************************************** +template +bool operator <(const etl::optional& lhs, const etl::optional& rhs) +{ + if (!bool(rhs)) + { + return false; + } + else if (!bool(lhs)) + { + return true; + } + else + { + return lhs.value() < rhs.value(); + } +} + +//*************************************************************************** +/// Equality operator. +//*************************************************************************** +template +bool operator ==(const etl::optional& lhs, etl::nullopt_t) +{ + return !bool(lhs); +} + +//*************************************************************************** +/// Equality operator. +//*************************************************************************** +template +bool operator ==(etl::nullopt_t, const etl::optional& rhs) +{ + return false; +} + +//*************************************************************************** +/// Less than operator. +//*************************************************************************** +template +bool operator <(const etl::optional& lhs, etl::nullopt_t) +{ + return !bool(lhs); +} + +//*************************************************************************** +/// Less than operator. +//*************************************************************************** +template +bool operator <(etl::nullopt_t, const etl::optional& rhs) +{ + return bool(rhs); +} + +//*************************************************************************** +/// Equality operator. +//************************************************************************** +template +bool operator ==(const etl::optional& lhs, const T& rhs) +{ + return bool(lhs) ? lhs.value() == rhs : false; +} + +//*************************************************************************** +/// Equality operator. +//************************************************************************** +template +bool operator ==(const T& value, const etl::optional& rhs) +{ + return bool(rhs) ? rhs.value() == value : false; +} + +//*************************************************************************** +/// Less than operator. +//*************************************************************************** +template +bool operator <(const etl::optional& lhs, const T& rhs) +{ + return bool(lhs) ? lhs.value() < rhs : true; +} + +//*************************************************************************** +/// Make an optional. +//*************************************************************************** +template +etl::optional::type> make_optional(T& value) +{ + return etl::optional::type>(value); +} + +#endif diff --git a/pool.h b/pool.h index f5cccbec..0cfcfbd8 100644 --- a/pool.h +++ b/pool.h @@ -60,7 +60,7 @@ namespace etl /// Constructor //************************************************************************* pool() - : ipool(reinterpret_cast(&aligned_buffer.value[0]), in_use, SIZE) + : ipool(reinterpret_cast(&buffer[0]), in_use, SIZE) { } @@ -75,7 +75,7 @@ namespace etl private: ///< The memory for the pool of objects. - etl::align_as, T> aligned_buffer; + typename etl::aligned_storage::value>::type buffer[SIZE]; ///< The set of flags that indicate which items are free in the pool. bitset in_use; diff --git a/queue.h b/queue.h index 89665f7d..39baf2c6 100644 --- a/queue.h +++ b/queue.h @@ -63,7 +63,7 @@ namespace etl /// Default constructor. //************************************************************************* queue() - : iqueue(reinterpret_cast(&buffer.value[0]), SIZE) + : iqueue(reinterpret_cast(&buffer[0]), SIZE) { } @@ -71,7 +71,7 @@ namespace etl /// Copy constructor //************************************************************************* queue(const queue& rhs) - : iqueue(reinterpret_cast(&buffer.value[0]), SIZE) + : iqueue(reinterpret_cast(&buffer[0]), SIZE) { iqueue::clone(rhs); } @@ -100,7 +100,7 @@ namespace etl private: /// The unititialised buffer of T used in the stack. - etl::align_as, T> buffer; + typename etl::aligned_storage::value>::type buffer[SIZE]; }; } diff --git a/stack.h b/stack.h index 2025f5c2..ef6922f9 100644 --- a/stack.h +++ b/stack.h @@ -51,7 +51,7 @@ namespace etl //*************************************************************************** ///\ingroup stack /// A fixed capacity stack. - /// This stack does not support concurrent access by different threads. + /// This stack does not suppo7rt concurrent access by different threads. /// \tparam T The type this stack should support. /// \tparam MAX_SIZE The maximum capacity of the stack. //*************************************************************************** @@ -64,7 +64,7 @@ namespace etl /// Default constructor. //************************************************************************* stack() - : istack(reinterpret_cast(&buffer.value[0]), SIZE) + : istack(reinterpret_cast(&buffer[0]), SIZE) { } @@ -72,7 +72,7 @@ namespace etl /// Copy constructor //************************************************************************* stack(const stack& rhs) - : istack(reinterpret_cast(&buffer.value[0]), SIZE) + : istack(reinterpret_cast(&buffer[0]), SIZE) { istack::clone(rhs); } @@ -101,7 +101,7 @@ namespace etl private: /// The unititialised buffer of T used in the stack. - etl::align_as, T> buffer; + typename etl::aligned_storage::value>::type buffer[SIZE]; }; } diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index 1ac9a069..4d2612f7 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -159,6 +159,7 @@ + @@ -173,6 +174,7 @@ + @@ -214,12 +216,14 @@ + + diff --git a/test/codeblocks/ETL.depend b/test/codeblocks/ETL.depend index 4f846443..613a6e19 100644 --- a/test/codeblocks/ETL.depend +++ b/test/codeblocks/ETL.depend @@ -1,22 +1,22 @@ # depslib dependency file v1.0 -1418906586 source:u:\users\john\documents\programming\github\etl\crc16.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\crc16.cpp 1415195892 -1418906586 source:u:\users\john\documents\programming\github\etl\crc16_ccitt.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\crc16_ccitt.cpp -1418906586 source:u:\users\john\documents\programming\github\etl\crc32.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\crc32.cpp -1418906586 source:u:\users\john\documents\programming\github\etl\crc64_ecma.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\crc64_ecma.cpp -1418906586 source:u:\users\john\documents\programming\github\etl\crc8_ccitt.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\crc8_ccitt.cpp -1418906587 source:u:\users\john\documents\programming\github\etl\test\main.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\main.cpp 1414170116 +/UnitTest++.h> @@ -161,7 +161,7 @@ 1414845610 u:\users\john\documents\programming\github\unittest-cpp\unittest++\reportassert.h "HelperMacros.h" -1424300009 source:u:\users\john\documents\programming\github\etl\test\test_array.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_array.cpp "../array.h" @@ -169,7 +169,7 @@ "../integral_limits.h" -1418906586 u:\users\john\documents\programming\github\etl\array.h +1424726109 u:\users\john\documents\programming\github\etl\array.h @@ -182,20 +182,20 @@ 1415185403 .h" -1418906586 u:\users\john\documents\programming\github\etl\exception.h +1424726109 u:\users\john\documents\programming\github\etl\exception.h -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_container.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_container.cpp "../container.h" 1414586788 ner.h" -1418906586 u:\users\john\documents\programming\github\etl\container.h +1424726109 u:\users\john\documents\programming\github\etl\container.h -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_crc.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_crc.cpp @@ -211,63 +211,63 @@ 1414929413 ecma.h" -1424592745 u:\users\john\documents\programming\github\etl\crc8_ccitt.h +1424726109 u:\users\john\documents\programming\github\etl\crc8_ccitt.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1424592745 u:\users\john\documents\programming\github\etl\crc16.h +1424726109 u:\users\john\documents\programming\github\etl\crc16.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1424592745 u:\users\john\documents\programming\github\etl\crc16_ccitt.h +1424726109 u:\users\john\documents\programming\github\etl\crc16_ccitt.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1424592745 u:\users\john\documents\programming\github\etl\crc16_kermit.h +1424726109 u:\users\john\documents\programming\github\etl\crc16_kermit.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1424592745 u:\users\john\documents\programming\github\etl\crc32.h +1424726109 u:\users\john\documents\programming\github\etl\crc32.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1424592745 u:\users\john\documents\programming\github\etl\crc64_ecma.h +1424726109 u:\users\john\documents\programming\github\etl\crc64_ecma.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_cyclic_value.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_cyclic_value.cpp "../cyclic_value.h" 1415139747 _value.h" -1418906586 u:\users\john\documents\programming\github\etl\cyclic_value.h +1424726109 u:\users\john\documents\programming\github\etl\cyclic_value.h "static_assert.h" "exception.h" -1418906586 u:\users\john\documents\programming\github\etl\static_assert.h +1424726109 u:\users\john\documents\programming\github\etl\static_assert.h -1424031255 source:u:\users\john\documents\programming\github\etl\test\test_deque.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_deque.cpp "../deque.h" "data.h" @@ -277,7 +277,7 @@ -1423602443 u:\users\john\documents\programming\github\etl\deque.h +1427533742 u:\users\john\documents\programming\github\etl\deque.h @@ -287,7 +287,7 @@ "alignment.h" "array.h" -1424031255 u:\users\john\documents\programming\github\etl\ideque.h +1424726109 u:\users\john\documents\programming\github\etl\ideque.h "algorithm.h" @@ -298,53 +298,53 @@ 1415195892 e.h" -1418906587 u:\users\john\documents\programming\github\etl\type_traits.h +1427537710 u:\users\john\documents\programming\github\etl\type_traits.h "nullptr.h" 1415195892 " -1418906586 u:\users\john\documents\programming\github\etl\nullptr.h +1424726109 u:\users\john\documents\programming\github\etl\nullptr.h -1423602443 u:\users\john\documents\programming\github\etl\deque_base.h +1424726109 u:\users\john\documents\programming\github\etl\deque_base.h "exception.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_enum_type.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_enum_type.cpp "../enum_type.h" 1414345217 ype.h" -1418906586 u:\users\john\documents\programming\github\etl\enum_type.h +1424726109 u:\users\john\documents\programming\github\etl\enum_type.h -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_exception.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_exception.cpp "../exception.h" 1414344663 ion.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_function.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_function.cpp "../function.h" 1414347748 on.h" -1418906586 u:\users\john\documents\programming\github\etl\function.h +1424726109 u:\users\john\documents\programming\github\etl\function.h -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_largest.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_largest.cpp "../largest.h" 1414583364 ts> -1418906586 u:\users\john\documents\programming\github\etl\largest.h +1424726109 u:\users\john\documents\programming\github\etl\largest.h "type_traits.h" -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_list.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_list.cpp "ExtraCheckMacros.h" "../list.h" @@ -354,7 +354,7 @@ -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_map.cpp +1426375754 source:u:\users\john\documents\programming\github\etl\test\test_map.cpp @@ -378,13 +378,13 @@ 1415009648 +/ReportAssertImpl.h> -1423387319 u:\users\john\documents\programming\github\etl\list.h +1424726109 u:\users\john\documents\programming\github\etl\list.h "ilist.h" "container.h" "pool.h" -1423387319 u:\users\john\documents\programming\github\etl\map.h +1427533742 u:\users\john\documents\programming\github\etl\map.h @@ -392,7 +392,7 @@ "container.h" "pool.h" -1423387319 u:\users\john\documents\programming\github\etl\ilist.h +1427533742 u:\users\john\documents\programming\github\etl\ilist.h @@ -403,7 +403,7 @@ "parameter_type.h" "pool.h" -1423602443 u:\users\john\documents\programming\github\etl\imap.h +1426375768 u:\users\john\documents\programming\github\etl\imap.h @@ -415,11 +415,11 @@ "pool.h" -1423387319 u:\users\john\documents\programming\github\etl\list_base.h +1424726109 u:\users\john\documents\programming\github\etl\list_base.h "exception.h" -1423387319 u:\users\john\documents\programming\github\etl\map_base.h +1424726109 u:\users\john\documents\programming\github\etl\map_base.h "exception.h" @@ -428,33 +428,33 @@ "../log.h" "../pow.h" -1418906586 u:\users\john\documents\programming\github\etl\log.h +1424726109 u:\users\john\documents\programming\github\etl\log.h 1415195892 u:\users\john\documents\programming\github\etl\pow.h -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_numeric.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_numeric.cpp "../numeric.h" -1418906586 u:\users\john\documents\programming\github\etl\numeric.h +1424726109 u:\users\john\documents\programming\github\etl\numeric.h -1419429129 source:u:\users\john\documents\programming\github\etl\test\test_observer.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_observer.cpp "../observer.h" 1415136649 er.h" -1418984093 u:\users\john\documents\programming\github\etl\observer.h +1424726109 u:\users\john\documents\programming\github\etl\observer.h "vector.h" "exception.h" "error_handler.h" -1424300125 u:\users\john\documents\programming\github\etl\vector.h +1427533742 u:\users\john\documents\programming\github\etl\vector.h @@ -463,7 +463,7 @@ "alignment.h" "array.h" -1423994330 u:\users\john\documents\programming\github\etl\ivector.h +1427533742 u:\users\john\documents\programming\github\etl\ivector.h @@ -476,19 +476,19 @@ 1415195892 se.h" -1423387319 u:\users\john\documents\programming\github\etl\vector_base.h +1424726109 u:\users\john\documents\programming\github\etl\vector_base.h "exception.h" "error_handler.h" -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_queue.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_queue.cpp "../queue.h" 1415139315 h" -1424300125 u:\users\john\documents\programming\github\etl\queue.h +1427533742 u:\users\john\documents\programming\github\etl\queue.h "iqueue.h" @@ -496,24 +496,24 @@ "alignment.h" "array.h" -1423387319 u:\users\john\documents\programming\github\etl\iqueue.h +1424726109 u:\users\john\documents\programming\github\etl\iqueue.h "queue_base.h" "type_traits.h" "parameter_type.h" "error_handler.h" -1423387319 u:\users\john\documents\programming\github\etl\queue_base.h +1424726109 u:\users\john\documents\programming\github\etl\queue_base.h "exception.h" -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_stack.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_stack.cpp "data.h" "../stack.h" -1423602443 u:\users\john\documents\programming\github\etl\stack.h +1427533742 u:\users\john\documents\programming\github\etl\stack.h @@ -522,38 +522,38 @@ "alignment.h" "array.h" -1423387319 u:\users\john\documents\programming\github\etl\istack.h +1424726109 u:\users\john\documents\programming\github\etl\istack.h "stack_base.h" "type_traits.h" "parameter_type.h" "error_handler.h" -1423387319 u:\users\john\documents\programming\github\etl\stack_base.h +1424726109 u:\users\john\documents\programming\github\etl\stack_base.h "exception.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_type_traits.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_type_traits.cpp "../type_traits.h" 1415196048 raits.h" -1423602443 source:u:\users\john\documents\programming\github\etl\test\test_vector.cpp +1426199387 source:u:\users\john\documents\programming\github\etl\test\test_vector.cpp "../vector.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_visitor.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_visitor.cpp "../visitor.h" 1414764632 r.h" -1418906587 u:\users\john\documents\programming\github\etl\visitor.h +1424726109 u:\users\john\documents\programming\github\etl\visitor.h 1414845610 source:u:\users\john\documents\programming\github\unittest-cpp\unittest++\assertexception.cpp "AssertException.h" @@ -1061,14 +1061,14 @@ 1415195892 /mnt/hgfs/W7 My Documents/Programming/GitHub/etl/largest.h -1423602443 source:u:\users\john\documents\programming\github\etl\test\test_bitset.cpp +1427533742 source:u:\users\john\documents\programming\github\etl\test\test_bitset.cpp "../bitset.h" -1424287554 u:\users\john\documents\programming\github\etl\bitset.h +1427533742 u:\users\john\documents\programming\github\etl\bitset.h @@ -1080,17 +1080,18 @@ "nullptr.h" "log.h" "ibitset.h" + "binary.h" -1418906586 u:\users\john\documents\programming\github\etl\integral_limits.h +1424726109 u:\users\john\documents\programming\github\etl\integral_limits.h "type_traits.h" -1418906586 u:\users\john\documents\programming\github\etl\smallest.h +1424726109 u:\users\john\documents\programming\github\etl\smallest.h "integral_limits.h" -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_forward_list.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_forward_list.cpp "ExtraCheckMacros.h" "data.h" @@ -1101,13 +1102,13 @@ -1423387319 u:\users\john\documents\programming\github\etl\forward_list.h +1424726109 u:\users\john\documents\programming\github\etl\forward_list.h "pool.h" "iforward_list.h" "container.h" -1423387319 u:\users\john\documents\programming\github\etl\iforward_list.h +1427533742 u:\users\john\documents\programming\github\etl\iforward_list.h @@ -1118,70 +1119,75 @@ "type_traits.h" "parameter_type.h" -1423387319 u:\users\john\documents\programming\github\etl\forward_list_base.h +1424726109 u:\users\john\documents\programming\github\etl\forward_list_base.h "exception.h" -1418906586 source:u:\users\john\documents\programming\github\etl\crc16_kermit.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\crc16_kermit.cpp -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_alignment.cpp +1427533742 source:u:\users\john\documents\programming\github\etl\test\test_alignment.cpp "../alignment.h" "../type_traits.h" + + + -1421503095 u:\users\john\documents\programming\github\etl\alignment.h +1427545833 u:\users\john\documents\programming\github\etl\alignment.h + + "type_traits.h" + "static_assert.h" + +1424726109 u:\users\john\documents\programming\github\etl\parameter_type.h "type_traits.h" -1418906586 u:\users\john\documents\programming\github\etl\parameter_type.h - "type_traits.h" - -1418906586 u:\users\john\documents\programming\github\etl\endian.h +1424726109 u:\users\john\documents\programming\github\etl\endian.h "enum_type.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_integral_limits.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_integral_limits.cpp "../integral_limits.h" -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_maths.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_maths.cpp "../log.h" "../power.h" "../fibonacci.h" "../factorial.h" -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_pool.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_pool.cpp "data.h" "../pool.h" -1423602443 u:\users\john\documents\programming\github\etl\pool.h +1427533742 u:\users\john\documents\programming\github\etl\pool.h "alignment.h" "array.h" "bitset.h" "ipool.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_smallest.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_smallest.cpp "../smallest.h" -1418930923 source:u:\users\john\documents\programming\github\etl\test\test_variant.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_variant.cpp "../variant.h" -1423387319 u:\users\john\documents\programming\github\etl\variant.h +1427533742 u:\users\john\documents\programming\github\etl\variant.h "array.h" "largest.h" @@ -1192,17 +1198,17 @@ "alignment.h" "error_handler.h" -1423387319 u:\users\john\documents\programming\github\etl\power.h +1424726109 u:\users\john\documents\programming\github\etl\power.h "log.h" -1418906586 u:\users\john\documents\programming\github\etl\fibonacci.h +1424726109 u:\users\john\documents\programming\github\etl\fibonacci.h -1418906586 u:\users\john\documents\programming\github\etl\factorial.h +1424726109 u:\users\john\documents\programming\github\etl\factorial.h -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_algorithm.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_algorithm.cpp "../algorithm.h" "../container.h" @@ -1211,7 +1217,7 @@ -1418906586 u:\users\john\documents\programming\github\etl\algorithm.h +1424726109 u:\users\john\documents\programming\github\etl\algorithm.h @@ -1220,38 +1226,38 @@ 1416912728 u:\users\john\documents\programming\github\etl\platform.h -1418906586 u:\users\john\documents\programming\github\etl\error_handler.h +1424726109 u:\users\john\documents\programming\github\etl\error_handler.h "exception.h" "function.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_error_handler.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_error_handler.cpp "../error_handler.h" "../exception.h" -1418906586 source:u:\users\john\documents\programming\github\etl\error_handler.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\error_handler.cpp "error_handler.h" "nullptr.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_functional.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_functional.cpp "../functional.h" -1418906586 u:\users\john\documents\programming\github\etl\functional.h +1424726109 u:\users\john\documents\programming\github\etl\functional.h -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_instance_count.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_instance_count.cpp "../instance_count.h" -1418906586 u:\users\john\documents\programming\github\etl\instance_count.h +1424726109 u:\users\john\documents\programming\github\etl\instance_count.h -1424592745 source:u:\users\john\documents\programming\github\etl\test\test_checksum.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_checksum.cpp @@ -1260,14 +1266,14 @@ "../checksum.h" "../endian.h" -1424592745 u:\users\john\documents\programming\github\etl\checksum.h +1424726109 u:\users\john\documents\programming\github\etl\checksum.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_fnv_1.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_fnv_1.cpp @@ -1276,19 +1282,19 @@ "../fnv_1.h" "../endian.h" -1424592745 u:\users\john\documents\programming\github\etl\fnv_1.h +1424726109 u:\users\john\documents\programming\github\etl\fnv_1.h "static_assert.h" "type_traits.h" "endian.h" "ihash.h" -1418906587 source:u:\users\john\documents\programming\github\etl\test\test_endian.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_endian.cpp "../endian.h" -1420911635 source:u:\users\john\documents\programming\github\etl\test\test_hash.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_hash.cpp @@ -1296,12 +1302,13 @@ "../hash.h" -1420911637 u:\users\john\documents\programming\github\etl\hash.h +1424726109 u:\users\john\documents\programming\github\etl\hash.h "fnv_1.h" "type_traits.h" -1423387319 u:\users\john\documents\programming\github\etl\ibitset.h +1427533742 u:\users\john\documents\programming\github\etl\ibitset.h + "integral_limits.h" 1423387319 source:u:\users\john\documents\programming\github\etl\test\test_lookup.cpp @@ -1339,13 +1346,13 @@ "ivector.h" "error_handler.h" -1423387319 u:\users\john\documents\programming\github\etl\ipool.h +1427533742 u:\users\john\documents\programming\github\etl\ipool.h "pool_base.h" "nullptr.h" "error_handler.h" -1423387319 u:\users\john\documents\programming\github\etl\pool_base.h +1424726109 u:\users\john\documents\programming\github\etl\pool_base.h "exception.h" "error_handler.h" @@ -1356,10 +1363,10 @@ 1419179259 u:\users\john\documents\programming\github\etl\singleton.h -1423387319 u:\users\john\documents\programming\github\etl\test\data.h +1424726109 u:\users\john\documents\programming\github\etl\test\data.h -1423387319 source:u:\users\john\documents\programming\github\etl\test\test_bloom_filter.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_bloom_filter.cpp @@ -1369,41 +1376,42 @@ "../crc16_ccitt.h" "../crc32.h" -1423602443 u:\users\john\documents\programming\github\etl\bloom_filter.h +1424726109 u:\users\john\documents\programming\github\etl\bloom_filter.h "parameter_type.h" "bitset.h" "type_traits.h" "log.h" "power.h" -1423602443 source:u:\users\john\documents\programming\github\etl\test\test_fixed_iterator.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_fixed_iterator.cpp "../fixed_iterator.h" -1423602443 u:\users\john\documents\programming\github\etl\fixed_iterator.h +1424726109 u:\users\john\documents\programming\github\etl\fixed_iterator.h -1424592745 u:\users\john\documents\programming\github\etl\ihash.h +1424726109 u:\users\john\documents\programming\github\etl\ihash.h "exception.h" "endian.h" -1424299637 source:u:\users\john\documents\programming\github\etl\test\test_binary.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_binary.cpp "../binary.h" "../bitset.h" "../fnv_1.h" + "../integral_limits.h" -1424286616 u:\users\john\documents\programming\github\etl\binary.h +1427533742 u:\users\john\documents\programming\github\etl\binary.h "type_traits.h" "integral_limits.h" "static_assert.h" -1424383830 source:u:\users\john\documents\programming\github\etl\test\test_flat_map.cpp +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_flat_map.cpp @@ -1412,16 +1420,17 @@ + "data.h" "../flat_map.h" -1424380279 u:\users\john\documents\programming\github\etl\flat_map.h +1427533742 u:\users\john\documents\programming\github\etl\flat_map.h "iflat_map.h" "vector.h" -1424383918 u:\users\john\documents\programming\github\etl\iflat_map.h +1427533742 u:\users\john\documents\programming\github\etl\iflat_map.h @@ -1433,9 +1442,56 @@ "ivector.h" "error_handler.h" -1424299331 u:\users\john\documents\programming\github\etl\flat_map_base.h +1424726109 u:\users\john\documents\programming\github\etl\flat_map_base.h "exception.h" "ivector.h" "error_handler.h" +1424726109 source:u:\users\john\documents\programming\github\etl\test\test_flat_set.cpp + + + + + + + + + "data.h" + "../flat_set.h" + +1427533742 u:\users\john\documents\programming\github\etl\flat_set.h + + + + "iflat_set.h" + "vector.h" + +1427533742 u:\users\john\documents\programming\github\etl\iflat_set.h + + + + + + "flat_set_base.h" + "type_traits.h" + "parameter_type.h" + "ivector.h" + "error_handler.h" + +1424726109 u:\users\john\documents\programming\github\etl\flat_set_base.h + + "exception.h" + "ivector.h" + "error_handler.h" + +1427533742 source:u:\users\john\documents\programming\github\etl\test\test_io_port.cpp + + "../io_port.h" + + +1427533742 u:\users\john\documents\programming\github\etl\io_port.h + + "nullptr.h" + "parameter_type.h" + diff --git a/test/codeblocks/ETL.layout b/test/codeblocks/ETL.layout index b1aef941..fd55ea1d 100644 --- a/test/codeblocks/ETL.layout +++ b/test/codeblocks/ETL.layout @@ -1,124 +1,24 @@ + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -126,36 +26,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - @@ -166,19 +41,14 @@ - + - + - + - - - - - - + @@ -186,19 +56,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/iar/etl.dep b/test/iar/etl.dep index c2cc6d44..33e36c98 100644 --- a/test/iar/etl.dep +++ b/test/iar/etl.dep @@ -2,13 +2,13 @@ 2 - 4054523468 + 4196203668 Debug + $PROJ_DIR$\..\..\bitset.h $PROJ_DIR$\..\..\alignment.h $PROJ_DIR$\..\..\algorithm.h - $PROJ_DIR$\..\..\bitset.h $PROJ_DIR$\..\..\array.h $PROJ_DIR$\..\..\crc16.cpp $PROJ_DIR$\..\..\container.h @@ -16,18 +16,75 @@ $PROJ_DIR$\..\..\crc16.h $PROJ_DIR$\..\..\crc16_ccitt.cpp $PROJ_DIR$\..\..\crc16_kermit.cpp - $PROJ_DIR$\Debug\Exe\cpp.out - $PROJ_DIR$\Debug\Obj\crc16.pbi + $PROJ_DIR$\..\..\crc32.cpp + $PROJ_DIR$\..\..\crc16_kermit.h + $PROJ_DIR$\..\..\crc64_ecma.h + $PROJ_DIR$\..\..\crc32.h + $PROJ_DIR$\..\..\crc64_ecma.cpp + $PROJ_DIR$\..\..\crc8_ccitt.cpp + $PROJ_DIR$\..\..\crc8_ccitt.h + $PROJ_DIR$\..\..\cyclic_value.h + $PROJ_DIR$\..\..\doxygen.h + $PROJ_DIR$\..\..\deque.h + $PROJ_DIR$\..\..\deque_base.h + $PROJ_DIR$\..\..\exception.h + $PROJ_DIR$\..\..\endian.h + $PROJ_DIR$\..\..\enum_type.h + $PROJ_DIR$\..\..\error_handler.cpp + $PROJ_DIR$\..\..\error_handler.h + $PROJ_DIR$\..\..\factorial.h + $PROJ_DIR$\..\..\fibonacci.h + $PROJ_DIR$\..\..\forward_list.h + $PROJ_DIR$\..\..\functional.h + $PROJ_DIR$\..\..\forward_list_base.h + $PROJ_DIR$\..\..\function.h + $TOOLKIT_DIR$\inc\c\xmtx.h + $PROJ_DIR$\..\..\ideque.h + $PROJ_DIR$\..\..\iforward_list.h + $PROJ_DIR$\..\..\ilist.h + $PROJ_DIR$\..\..\integral_limits.h + $PROJ_DIR$\..\..\imap.h + $PROJ_DIR$\..\..\ipool.h + $PROJ_DIR$\..\..\iqueue.h + $PROJ_DIR$\..\..\istack.h + $PROJ_DIR$\..\..\largest.h + $PROJ_DIR$\..\..\ivector.h + $PROJ_DIR$\..\..\numeric.h + $PROJ_DIR$\..\..\list.h + $PROJ_DIR$\..\..\list_base.h + $PROJ_DIR$\..\..\map.h + $PROJ_DIR$\..\..\map_base.h + $PROJ_DIR$\..\..\log.h + $PROJ_DIR$\..\..\nullptr.h + $PROJ_DIR$\..\..\observer.h + $PROJ_DIR$\..\..\parameter_type.h + $PROJ_DIR$\..\..\power.h + $PROJ_DIR$\..\..\pool.h + $PROJ_DIR$\..\..\queue.h + $PROJ_DIR$\..\..\smallest.h + $PROJ_DIR$\..\..\queue_base.h + $PROJ_DIR$\..\..\static_assert.h + $PROJ_DIR$\..\..\stack.h + $PROJ_DIR$\..\..\stack_base.h + $PROJ_DIR$\..\..\type_traits.h + $PROJ_DIR$\..\..\variant.h + $TOOLKIT_DIR$\inc\cpp\memory + $PROJ_DIR$\..\..\vector.h + $PROJ_DIR$\..\..\vector_base.h + $PROJ_DIR$\..\..\visitor.h + $PROJ_DIR$\..\test_compile.cpp $PROJ_DIR$\Debug\Obj\crc16_kermit.pbi - $PROJ_DIR$\Debug\Obj\crc32.pbi - $PROJ_DIR$\Debug\Obj\crc64_ecma.pbi - $PROJ_DIR$\Debug\Obj\crc8_ccitt.pbi - $TOOLKIT_DIR$\inc\c\yvals.h + $PROJ_DIR$\Debug\Obj\crc16.pbi + $PROJ_DIR$\Debug\Exe\cpp.out $TOOLKIT_DIR$\inc\c\ycheck.h - $TOOLKIT_DIR$\inc\c\DLib_Defaults.h $TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h - $TOOLKIT_DIR$\inc\c\DLib_Product.h + $TOOLKIT_DIR$\inc\c\DLib_Defaults.h $TOOLKIT_DIR$\inc\c\stdint.h + $TOOLKIT_DIR$\inc\c\DLib_Product.h + $TOOLKIT_DIR$\inc\c\yvals.h + $PROJ_DIR$\Debug\Obj\crc8_ccitt.pbi + $PROJ_DIR$\Debug\Obj\crc64_ecma.pbi + $PROJ_DIR$\Debug\Obj\crc32.pbi $TOOLKIT_DIR$\inc\c\stdlib.h $TOOLKIT_DIR$\inc\c\cstring $TOOLKIT_DIR$\inc\c\cstdlib @@ -67,8 +124,6 @@ $TOOLKIT_DIR$\inc\cpp\xmemory $TOOLKIT_DIR$\inc\c\xlocale.h $TOOLKIT_DIR$\inc\c\xtls.h - $TOOLKIT_DIR$\inc\c\xmtx.h - $TOOLKIT_DIR$\inc\cpp\memory $TOOLKIT_DIR$\inc\cpp\algorithm $TOOLKIT_DIR$\inc\cpp\xstddef $TOOLKIT_DIR$\inc\cpp\new @@ -93,61 +148,6 @@ $PROJ_DIR$\Debug\Obj\error_handler.o $PROJ_DIR$\..\..\ibitset.h $PROJ_DIR$\Debug\List\cpp.map - $PROJ_DIR$\..\..\crc32.cpp - $PROJ_DIR$\..\..\crc16_kermit.h - $PROJ_DIR$\..\..\crc64_ecma.h - $PROJ_DIR$\..\..\crc32.h - $PROJ_DIR$\..\..\crc64_ecma.cpp - $PROJ_DIR$\..\..\crc8_ccitt.h - $PROJ_DIR$\..\..\crc8_ccitt.cpp - $PROJ_DIR$\..\..\cyclic_value.h - $PROJ_DIR$\..\..\doxygen.h - $PROJ_DIR$\..\..\deque.h - $PROJ_DIR$\..\..\deque_base.h - $PROJ_DIR$\..\..\exception.h - $PROJ_DIR$\..\..\endian.h - $PROJ_DIR$\..\..\enum_type.h - $PROJ_DIR$\..\..\error_handler.cpp - $PROJ_DIR$\..\..\error_handler.h - $PROJ_DIR$\..\..\factorial.h - $PROJ_DIR$\..\..\forward_list.h - $PROJ_DIR$\..\..\fibonacci.h - $PROJ_DIR$\..\..\functional.h - $PROJ_DIR$\..\..\forward_list_base.h - $PROJ_DIR$\..\..\function.h - $PROJ_DIR$\..\..\imap.h - $PROJ_DIR$\..\..\ideque.h - $PROJ_DIR$\..\..\iforward_list.h - $PROJ_DIR$\..\..\ilist.h - $PROJ_DIR$\..\..\integral_limits.h - $PROJ_DIR$\..\..\ipool.h - $PROJ_DIR$\..\..\iqueue.h - $PROJ_DIR$\..\..\istack.h - $PROJ_DIR$\..\..\largest.h - $PROJ_DIR$\..\..\ivector.h - $PROJ_DIR$\..\..\list.h - $PROJ_DIR$\..\..\list_base.h - $PROJ_DIR$\..\..\map.h - $PROJ_DIR$\..\..\map_base.h - $PROJ_DIR$\..\..\log.h - $PROJ_DIR$\..\..\nullptr.h - $PROJ_DIR$\..\..\observer.h - $PROJ_DIR$\..\..\numeric.h - $PROJ_DIR$\..\..\parameter_type.h - $PROJ_DIR$\..\..\power.h - $PROJ_DIR$\..\..\pool.h - $PROJ_DIR$\..\..\queue.h - $PROJ_DIR$\..\..\smallest.h - $PROJ_DIR$\..\..\queue_base.h - $PROJ_DIR$\..\..\static_assert.h - $PROJ_DIR$\..\..\stack.h - $PROJ_DIR$\..\..\stack_base.h - $PROJ_DIR$\..\..\type_traits.h - $PROJ_DIR$\..\..\variant.h - $PROJ_DIR$\..\..\vector.h - $PROJ_DIR$\..\..\vector_base.h - $PROJ_DIR$\..\..\visitor.h - $PROJ_DIR$\..\test_compile.cpp $TOOLKIT_DIR$\inc\c\ymath.h $TOOLKIT_DIR$\inc\c\xtgmath.h $TOOLKIT_DIR$\inc\c\xencoding_limits.h @@ -160,6 +160,8 @@ $PROJ_DIR$\Debug\Obj\crc16_kermit.o $PROJ_DIR$\Debug\Obj\crc8_ccitt.o $PROJ_DIR$\..\..\ihash.h + $PROJ_DIR$\..\..\binary.h + $PROJ_DIR$\..\..\io_port.h $PROJ_DIR$\..\..\crc16.cpp @@ -170,17 +172,17 @@ BICOMP - 11 + 68 ICCARM - 21 17 16 18 19 20 144 83 + 73 70 75 72 71 74 144 138 BICOMP - 17 16 21 144 18 83 19 20 + 70 75 73 144 72 138 71 74 @@ -199,11 +201,11 @@ ICCARM - 21 17 16 18 19 20 144 83 + 73 70 75 72 71 74 144 138 BICOMP - 17 16 21 144 18 83 19 20 + 70 75 73 144 72 138 71 74 @@ -216,17 +218,17 @@ BICOMP - 12 + 67 ICCARM - 21 17 16 18 19 20 144 83 + 73 70 75 72 71 74 144 138 BICOMP - 17 16 21 144 18 83 19 20 + 70 75 73 144 72 138 71 74 @@ -235,25 +237,10 @@ ILINK - 10 86 + 69 141 - - $PROJ_DIR$\Debug\Exe\cpp.out - - - ILINK - 86 - - - - - ILINK - 50 147 148 151 146 145 152 84 26 53 55 56 52 51 - - - $PROJ_DIR$\..\..\crc32.cpp @@ -263,17 +250,17 @@ BICOMP - 13 + 78 ICCARM - 21 17 16 18 19 20 144 83 + 73 70 75 72 71 74 144 138 BICOMP - 17 16 21 144 18 83 19 20 + 70 75 73 144 72 138 71 74 @@ -286,17 +273,17 @@ BICOMP - 14 + 77 ICCARM - 21 17 16 18 19 20 144 83 + 73 70 75 72 71 74 144 138 BICOMP - 17 16 21 144 18 83 19 20 + 70 75 73 144 72 138 71 74 @@ -309,17 +296,17 @@ BICOMP - 15 + 76 ICCARM - 21 17 16 18 19 20 144 83 + 73 70 75 72 71 74 144 138 BICOMP - 17 16 21 144 18 83 19 20 + 70 75 73 144 72 138 71 74 @@ -328,21 +315,21 @@ ICCARM - 84 + 139 BICOMP - 82 + 137 ICCARM - 102 98 108 124 + 25 21 31 49 BICOMP - 108 124 98 102 + 31 49 21 25 @@ -351,21 +338,36 @@ ICCARM - 26 + 83 BICOMP - 27 + 84 ICCARM - 1 63 62 58 24 17 16 18 19 20 144 83 22 29 65 34 64 66 43 42 33 67 45 68 69 35 46 23 70 32 31 40 30 71 36 47 72 28 54 142 143 73 74 75 48 41 37 49 25 76 38 59 60 61 39 78 57 79 80 77 81 44 136 124 0 3 98 127 133 102 108 2 21 113 131 123 85 5 92 99 100 153 7 6 88 90 89 94 96 110 97 + 2 118 62 115 81 70 75 72 71 74 144 138 79 86 120 91 119 121 100 99 90 122 102 123 124 92 103 80 125 89 88 97 87 126 93 104 127 85 111 142 143 128 129 130 105 98 94 106 82 131 95 116 117 32 96 133 114 134 135 132 136 101 60 49 1 73 57 3 21 51 25 31 0 36 55 48 140 154 5 16 22 23 153 7 6 11 13 12 17 19 33 20 155 63 42 64 61 41 BICOMP - 41 153 98 65 66 17 36 23 88 63 35 76 44 43 133 136 5 96 58 18 29 34 45 16 81 21 3 7 89 64 67 68 69 28 77 99 127 0 2 92 6 90 94 30 62 24 42 22 144 83 19 20 33 31 46 40 47 54 142 74 75 78 79 80 124 70 123 85 113 1 32 71 72 73 143 48 37 49 25 57 38 59 60 39 61 102 108 131 100 110 97 + 60 72 123 36 70 86 81 3 75 122 21 100 11 101 115 119 102 90 91 153 57 118 5 19 120 82 48 73 64 7 12 63 124 99 94 80 95 96 97 98 22 87 1 0 16 6 13 17 155 61 62 79 144 138 71 74 121 125 89 126 127 128 143 105 106 114 88 116 117 32 51 25 2 92 103 93 104 85 111 142 129 130 131 132 133 134 135 136 49 31 55 140 154 23 33 20 42 41 + + + + + $PROJ_DIR$\Debug\Exe\cpp.out + + + ILINK + 141 + + + + + ILINK + 107 147 148 151 146 145 152 139 83 110 112 113 109 108 diff --git a/test/iar/etl.ewp b/test/iar/etl.ewp index 7113198b..390712fd 100644 --- a/test/iar/etl.ewp +++ b/test/iar/etl.ewp @@ -2000,6 +2000,9 @@ $PROJ_DIR$\..\..\integral_limits.h + + $PROJ_DIR$\..\..\io_port.h + $PROJ_DIR$\..\..\ipool.h @@ -2021,15 +2024,15 @@ $PROJ_DIR$\..\..\list_base.h + + $PROJ_DIR$\..\..\log.h + $PROJ_DIR$\..\..\map.h $PROJ_DIR$\..\..\map_base.h - - $PROJ_DIR$\..\..\log.h - $PROJ_DIR$\..\..\nullptr.h diff --git a/test/iar/etl.ewt b/test/iar/etl.ewt index 3feeaf98..29b07890 100644 --- a/test/iar/etl.ewt +++ b/test/iar/etl.ewt @@ -283,6 +283,9 @@ $PROJ_DIR$\..\..\integral_limits.h + + $PROJ_DIR$\..\..\io_port.h + $PROJ_DIR$\..\..\ipool.h @@ -304,15 +307,15 @@ $PROJ_DIR$\..\..\list_base.h + + $PROJ_DIR$\..\..\log.h + $PROJ_DIR$\..\..\map.h $PROJ_DIR$\..\..\map_base.h - - $PROJ_DIR$\..\..\log.h - $PROJ_DIR$\..\..\nullptr.h diff --git a/test/iar/settings/etl.wsdt b/test/iar/settings/etl.wsdt index 6295675c..94ceb9cb 100644 --- a/test/iar/settings/etl.wsdt +++ b/test/iar/settings/etl.wsdt @@ -12,7 +12,7 @@ - 242272727 + 259272727 @@ -24,7 +24,7 @@ - + TabID-10727-29778 @@ -32,11 +32,11 @@ Workspace - etletl/ETLetl/Outputetl/Testetl/main.cpp + etletl/Outputetl/Testetl/main.cpp - 0 + 0 TabID-15390-31123 @@ -46,20 +46,20 @@ - 0 + 0 - TextEditor$WS_DIR$\..\..\algorithm.h0000025529322932TextEditor$WS_DIR$\..\test_compile.cpp0000068328432841TextEditorC:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0\arm\inc\cpp\xlocnum000006472243822438TextEditor$WS_DIR$\..\..\alignment.h000009635033503TextEditor$WS_DIR$\..\..\type_traits.h0000018387538753TextEditor$WS_DIR$\..\..\log.h000002921962196TextEditor$WS_DIR$\..\..\nullptr.h00000013271327TextEditor$WS_DIR$\..\..\variant.h000009393936239362TextEditor$WS_DIR$\..\..\crc16.cpp000000645645TextEditor$WS_DIR$\..\..\ideque.h000009543101131011TextEditor$WS_DIR$\..\..\deque.h0000079472847360100000010000001 + TextEditor$WS_DIR$\..\test_compile.cpp0000005165160TextEditor$WS_DIR$\..\..\variant.h0000075331086310860100000010000001 - iaridepm.enu1-2-2953333-2-22002001041672004011744799569140000-2-2193825124096819242001002083200401104167200401 + iaridepm.enu1-2-2953333-2-22002001041672004011744799569140000-2-2193825124096819242001002083200401104167200401 diff --git a/test/keil/Test1.uvguix.John b/test/keil/Test1.uvguix.John index 40763414..e37ed39c 100644 --- a/test/keil/Test1.uvguix.John +++ b/test/keil/Test1.uvguix.John @@ -73,8 +73,8 @@ 2 3 - -1 - -1 + -32000 + -32000 -1 @@ -90,8 +90,8 @@ 0 - 1549 - 010000000400000001000000010000000000000001000000000000000200000000000000010000000100000000000000280000002800000001000000100000000C000000010000003B553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C63726336345F65636D612E68000000000C63726336345F65636D612E6800000000FFFFFFFFFFFFFFFF36553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C63726333322E68000000000763726333322E6800000000FFFFFFFFFFFFFFFF3D553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C63726331365F6B65726D69742E68000000000E63726331365F6B65726D69742E6800000000FFFFFFFFFFFFFFFF3C553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C63726331365F63636974742E68000000000D63726331365F63636974742E6800000000FFFFFFFFFFFFFFFF36553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C63726331362E68000000000763726331362E6800000000FFFFFFFFFFFFFFFF36553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C69686173682E68000000000769686173682E6800000000FFFFFFFFFFFFFFFF38553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C696269747365742E680000000009696269747365742E6800000000FFFFFFFFFFFFFFFF37553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C6964657175652E6800000000086964657175652E6800000000FFFFFFFFFFFFFFFF36553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C64657175652E68000000000764657175652E6800000000FFFFFFFFFFFFFFFF3A553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C6669626F6E616363692E68000000000B6669626F6E616363692E6800000000FFFFFFFFFFFFFFFF3A553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C666163746F7269616C2E68000000000B666163746F7269616C2E6800000000FFFFFFFFFFFFFFFF3D553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C6379636C69635F76616C75652E68000000000E6379636C69635F76616C75652E6800000000FFFFFFFFFFFFFFFF44553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C746573745C746573745F636F6D70696C652E6370700000000010746573745F636F6D70696C652E63707000000000FFFFFFFFFFFFFFFF39553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C66756E6374696F6E2E68000000000A66756E6374696F6E2E6800000000FFFFFFFFFFFFFFFF37553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C6269747365742E6800000000086269747365742E6800000000FFFFFFFFFFFFFFFF3B553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C637263385F63636974742E68000000000C637263385F63636974742E6800000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000940100006500000080070000FD030000 + 440 + 01000000040000000100000001000000000000000100000000000000020000000000000001000000010000000000000028000000280000000100000003000000000000000100000044553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C746573745C746573745F636F6D70696C652E6370700000000010746573745F636F6D70696C652E63707000000000FFFFFFFFFFFFFFFF38553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C69766563746F722E68000000000969766563746F722E6800000000FFFFFFFFFFFFFFFF38553A5C55736572735C4A6F686E5C446F63756D656E74735C50726F6772616D6D696E675C4769744875625C65746C5C76617269616E742E68000000000976617269616E742E6800000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000940100006500000080070000FD030000 @@ -1285,8 +1285,8 @@ 59392 File - 2261 - 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE8030000000000000000000000000000000000000000000000010000000100000096000000020020500000000010766F6964206F70657261746F72202829960000000000000010000373657410766F6964206F70657261746F72202829096966756E6374696F6E086F70657261746F7208456E756D547970650A5374727563744E616D65077479706564656608547970654E616D65114445434C4152455F454E554D5F545950451A72657475726E2028544261736526292A2854426173652A29303B0C504C4154464F524D5F41524D09696E745F6C65617374057374643A3A09434F4D50494C45525F0A53797374656D496E69740641737369676E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F50726F6A6563742057696E646F7773000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65AC030000 + 2266 + 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000004000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE8030000000000000000000000000000000000000000000000010000000100000096000000020020500000000003736574960000000000000011000D6572726F725F68616E646C65720373657410766F6964206F70657261746F72202829096966756E6374696F6E086F70657261746F7208456E756D547970650A5374727563744E616D65077479706564656608547970654E616D65114445434C4152455F454E554D5F545950451A72657475726E2028544261736526292A2854426173652A29303B0C504C4154464F524D5F41524D09696E745F6C65617374057374643A3A09434F4D50494C45525F0A53797374656D496E69740641737369676E0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F50726F6A6563742057696E646F7773000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65AC030000 1423 @@ -1318,7 +1318,7 @@ Debug 2220 - 00200000000000001900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000002500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000002600000000000000000000000000000000010000000100000001801D800000000000002700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000002800000000000000000000000000000000010000000100000001801B80000000000000290000000000000000000000000000000001000000010000000180E57F0000000000002A00000000000000000000000000000000010000000100000001801C800000000000002B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000002C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B0000000000002D0000000000000000000000000000000001000000010000000180F07F0000000000002E0000000000000000000000000000000001000000010000000180E8880000000000003700000000000000000000000000000000010000000100000001803B010000000000002F0000000000000000000000000000000001000000010000000180BB8A00000000000030000000000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E0E01000000000000310000000D57617463682057696E646F7773000000000000000000000000010000000100000000000000000000000100000002001380D88B000000000000310000000757617463682031000000000000000000000000010000000100000000000000000000000100000000001380D98B0000000000003100000007576174636820320000000000000000000000000100000001000000000000000000000001000000000013800F01000000000000320000000E4D656D6F72792057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380D28B00000000000032000000084D656D6F72792031000000000000000000000000010000000100000000000000000000000100000000001380D38B00000000000032000000084D656D6F72792032000000000000000000000000010000000100000000000000000000000100000000001380D48B00000000000032000000084D656D6F72792033000000000000000000000000010000000100000000000000000000000100000000001380D58B00000000000032000000084D656D6F727920340000000000000000000000000100000001000000000000000000000001000000000013801001000000000000330000000E53657269616C2057696E646F77730000000000000000000000000100000001000000000000000000000001000000040013809307000000000000330000000755415254202331000000000000000000000000010000000100000000000000000000000100000000001380940700000000000033000000075541525420233200000000000000000000000001000000010000000000000000000000010000000000138095070000000000003300000007554152542023330000000000000000000000000100000001000000000000000000000001000000000013809607000000000000330000000E49544D2F525441205669657765720000000000000000000000000100000001000000000000000000000001000000000013803C010000000000003400000010416E616C797369732057696E646F7773000000000000000000000000010000000100000000000000000000000100000003001380658A000000000000340000000E4C6F67696320416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380DC7F0000000000003E00000014506572666F726D616E636520416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380E788000000000000380000000D436F646520436F76657261676500000000000000000000000001000000010000000000000000000000010000000000138053010000000000003F0000000D54726163652057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013805401000000000000FFFFFFFF115472616365204D656E7520416E63686F720100000000000000010000000000000001000000000000000000000001000000000013802901000000000000350000001553797374656D205669657765722057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013804B01000000000000FFFFFFFF1453797374656D2056696577657220416E63686F720100000000000000010000000000000001000000000000000000000001000000000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000138001890000000000003600000007546F6F6C626F7800000000000000000000000001000000010000000000000000000000010000000300138044C5000000000000FFFFFFFF0E5570646174652057696E646F77730100000000000000010000000000000001000000000000000000000001000000000013800000000000000400FFFFFFFF000000000000000000010000000000000001000000000000000000000001000000000013805B01000000000000FFFFFFFF12546F6F6C626F78204D656E75416E63686F72010000000000000001000000000000000100000000000000000000000100000000000000000005446562756764020000 + 00200000000000001900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000002500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000002600000000000000000000000000000000010000000100000001801D800000000000002700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000002800000000000000000000000000000000010000000100000001801B80000000000000290000000000000000000000000000000001000000010000000180E57F0000000000002A00000000000000000000000000000000010000000100000001801C800000000000002B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000002C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B0000000000002D0000000000000000000000000000000001000000010000000180F07F0000000000002E0000000000000000000000000000000001000000010000000180E8880000000000003700000000000000000000000000000000010000000100000001803B010000000000002F0000000000000000000000000000000001000000010000000180BB8A00000000000030000000000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E0E01000000000000310000000D57617463682057696E646F7773000000000000000000000000010000000100000000000000000000000100000002001380D88B000000000000310000000757617463682031000000000000000000000000010000000100000000000000000000000100000000001380D98B0000000000003100000007576174636820320000000000000000000000000100000001000000000000000000000001000000000013800F01000000000000320000000E4D656D6F72792057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380D28B00000000000032000000084D656D6F72792031000000000000000000000000010000000100000000000000000000000100000000001380D38B00000000000032000000084D656D6F72792032000000000000000000000000010000000100000000000000000000000100000000001380D48B00000000000032000000084D656D6F72792033000000000000000000000000010000000100000000000000000000000100000000001380D58B00000000000032000000084D656D6F727920340000000000000000000000000100000001000000000000000000000001000000000013801001000000000000330000000E53657269616C2057696E646F77730000000000000000000000000100000001000000000000000000000001000000040013809307000000000000330000000755415254202331000000000000000000000000010000000100000000000000000000000100000000001380940700000000000033000000075541525420233200000000000000000000000001000000010000000000000000000000010000000000138095070000000000003300000007554152542023330000000000000000000000000100000001000000000000000000000001000000000013809607000000000000330000000E49544D2F525441205669657765720000000000000000000000000100000001000000000000000000000001000000000013803C010000000000003400000010416E616C797369732057696E646F7773000000000000000000000000010000000100000000000000000000000100000003001380658A000000000000340000000E4C6F67696320416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380DC7F0000000000003E00000014506572666F726D616E636520416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380E788000000000000380000000D436F646520436F76657261676500000000000000000000000001000000010000000000000000000000010000000000138053010000000000003F0000000D54726163652057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013805401000000000000FFFFFFFF115472616365204D656E7520416E63686F720000000000000000010000000000000001000000000000000000000001000000000013802901000000000000350000001553797374656D205669657765722057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013804B01000000000000FFFFFFFF1453797374656D2056696577657220416E63686F720000000000000000010000000000000001000000000000000000000001000000000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000138001890000000000003600000007546F6F6C626F7800000000000000000000000001000000010000000000000000000000010000000300138044C5000000000000FFFFFFFF0E5570646174652057696E646F77730000000000000000010000000000000001000000000000000000000001000000000013800000000000000400FFFFFFFF000000000000000000010000000000000001000000000000000000000001000000000013805B01000000000000FFFFFFFF12546F6F6C626F78204D656E75416E63686F72000000000000000001000000000000000100000000000000000000000100000000000000000005446562756764020000 898 @@ -2583,147 +2583,30 @@ 0 100 - 12 - - ..\..\crc64_ecma.h - 26 - 17 - 39 - 0 - - 0 - - - ..\..\crc32.h - 6 - 1 - 41 - 0 - - 0 - - - ..\..\crc16_kermit.h - 6 - 1 - 41 - 0 - - 0 - - - ..\..\crc16_ccitt.h - 6 - 1 - 41 - 0 - - 0 - - - ..\..\crc16.h - 6 - 1 - 41 - 0 - - 0 - - - ..\..\ihash.h - 0 - 145 - 1 - 0 - - 0 - - - ..\..\ibitset.h - 36 - 44 - 59 - 0 - - 0 - - - ..\..\ideque.h - 57 - 510 - 517 - 0 - - 0 - - - ..\..\deque.h - 0 - 1 - 1 - 0 - - 0 - - - ..\..\fibonacci.h - 0 - 1 - 1 - 0 - - 0 - - - ..\..\factorial.h - 17 - 9 - 36 - 0 - - 0 - - - ..\..\cyclic_value.h - 5 - 174 - 223 - 0 - - 0 - + 0 ..\test_compile.cpp - 2 - 184 - 227 + 8 + 281 + 309 0 0 - ..\..\function.h - 79 - 58 - 81 + ..\..\ivector.h + 7 + 159 + 195 0 0 - ..\..\bitset.h - 0 - 8 - 49 - 0 - - 0 - - - ..\..\crc8_ccitt.h - 6 - 1 - 41 + ..\..\variant.h + 28 + 26 + 43 0 0 diff --git a/test/keil/Test1.uvoptx b/test/keil/Test1.uvoptx index a0a4b70d..1afdd940 100644 --- a/test/keil/Test1.uvoptx +++ b/test/keil/Test1.uvoptx @@ -1115,6 +1115,19 @@ 0 0 + + 3 + 72 + 5 + 0 + 0 + 0 + 0 + ..\..\io_port.h + io_port.h + 0 + 0 + diff --git a/test/keil/Test1.uvprojx b/test/keil/Test1.uvprojx index f7b55cb5..da1ae3a6 100644 --- a/test/keil/Test1.uvprojx +++ b/test/keil/Test1.uvprojx @@ -362,8 +362,8 @@ 0 0 - - PLATFORM_ARM,COMPILER_KEIL + --exceptions + PLATFORM_ARM,COMPILER_KEIL, ETL_THROW_EXCEPTIONS ..\..\..\etl;..\Keil @@ -773,6 +773,11 @@ 5 ..\..\ihash.h + + io_port.h + 5 + ..\..\io_port.h + diff --git a/test/test_alignment.cpp b/test/test_alignment.cpp index 83ca44d3..79fcf541 100644 --- a/test/test_alignment.cpp +++ b/test/test_alignment.cpp @@ -31,136 +31,62 @@ SOFTWARE. #include "../type_traits.h" #include +#include +#include +#include + +void f(int a) +{ +} namespace { - struct Data - { - int i; - char c; - short s[3]; - }; - SUITE(test_alignment) { //************************************************************************* - TEST(test_align_at) - { - size_t alignment; - - // 1 - typedef etl::align_at align_char_1; - alignment = etl::alignment_of::value; - CHECK_EQUAL(1, alignment); - - // 2 - typedef etl::align_at align_char_2; - alignment = etl::alignment_of::value; - CHECK_EQUAL(2, alignment); - - align_char_2 data2[2]; - CHECK((size_t(&data2[0]) % 2) == 0); - CHECK((size_t(&data2[1]) % 2) == 0); - - // 4 - typedef etl::align_at align_char_4; - alignment = etl::alignment_of::value; - CHECK_EQUAL(4, alignment); - - align_char_4 data4[2]; - CHECK((size_t(&data4[0]) % 4) == 0); - CHECK((size_t(&data4[1]) % 4) == 0); - - // 8 - typedef etl::align_at align_char_8; - alignment = etl::alignment_of::value; - CHECK_EQUAL(8, alignment); - - align_char_8 data8[2]; - CHECK((size_t(&data8[0]) % 8) == 0); - CHECK((size_t(&data8[1]) % 8) == 0); - - // 16 - typedef etl::align_at align_char_16; - alignment = etl::alignment_of::value; - CHECK_EQUAL(16, alignment); - - align_char_16 data16[2]; - CHECK((size_t(&data16[0]) % 16) == 0); - CHECK((size_t(&data16[1]) % 16) == 0); - } - - //************************************************************************* - TEST(test_align_as) + TEST(test_aligned_storage) { size_t alignment; size_t expected; - // char - typedef etl::align_as align_char_char; - alignment = etl::alignment_of::value; - expected = std::alignment_of::value; + typedef etl::aligned_storage::value>::type storage32_t; + static storage32_t data32[10]; + + alignment = etl::alignment_of::value; + expected = std::alignment_of::value; + CHECK_EQUAL(expected, alignment); - // short - typedef etl::align_as align_char_short; - alignment = etl::alignment_of::value; - expected = std::alignment_of::value; + for (int i = 0; i < 10; ++i) + { + CHECK_EQUAL(0, size_t(&data32[1]) % expected); + } + + etl::aligned_storage<100, 8>::type data9; + f(static_cast(data9)); + } + + //************************************************************************* + TEST(test_aligned_storage_as) + { + size_t alignment; + size_t expected; + + typedef etl::aligned_storage_as::type storage32_t; + static storage32_t data32[10]; + + alignment = etl::alignment_of::value; + expected = std::alignment_of::value; + CHECK_EQUAL(expected, alignment); - align_char_short data_short[2]; - CHECK((size_t(&data_short[0].value) % expected) == 0); - CHECK((size_t(&data_short[1].value) % expected) == 0); + for (int i = 0; i < 10; ++i) + { + CHECK_EQUAL(0, size_t(&data32[1]) % expected); + } - // int - typedef etl::align_as align_char_int; - alignment = etl::alignment_of::value; - expected = std::alignment_of::value; - CHECK_EQUAL(expected, alignment); - - align_char_int data_int[2]; - CHECK((size_t(&data_int[0].value) % expected) == 0); - CHECK((size_t(&data_int[1].value) % expected) == 0); - - // long - typedef etl::align_as align_char_long; - alignment = etl::alignment_of::value; - expected = std::alignment_of::value; - CHECK_EQUAL(expected, alignment); - - align_char_long data_long[2]; - CHECK((size_t(&data_long[0].value) % expected) == 0); - CHECK((size_t(&data_long[1].value) % expected) == 0); - - // long long - typedef etl::align_as align_char_long_long; - alignment = etl::alignment_of::value; - expected = std::alignment_of::value; - CHECK_EQUAL(expected, alignment); - - align_char_long_long data_long_long[2]; - CHECK((size_t(&data_long_long[0].value) % expected) == 0); - CHECK((size_t(&data_long_long[1].value) % expected) == 0); - - // double - typedef etl::align_as align_char_double; - alignment = etl::alignment_of::value; - expected = std::alignment_of::value; - CHECK_EQUAL(expected, alignment); - - align_char_double data_double[2]; - CHECK((size_t(&data_double[0].value) % expected) == 0); - CHECK((size_t(&data_double[1].value) % expected) == 0); - - // struct Data - typedef etl::align_as align_char_data; - alignment = etl::alignment_of::value; - expected = std::alignment_of::value; - CHECK_EQUAL(expected, alignment); - - align_char_data data_data[2]; - CHECK((size_t(&data_data[0].value) % expected) == 0); - CHECK((size_t(&data_data[1].value) % expected) == 0); + etl::aligned_storage<100, 8>::type data9; + f(static_cast(data9)); } }; } diff --git a/test/test_bitset.cpp b/test/test_bitset.cpp index 71d8e61a..e832dced 100644 --- a/test/test_bitset.cpp +++ b/test/test_bitset.cpp @@ -89,7 +89,7 @@ namespace //************************************************************************* TEST(test_construct_from_string) - { + { std::bitset<60> compare("110001001000110100010101100111001100010010001101000101011001"); etl::bitset<60> data("110001001000110100010101100111001100010010001101000101011001"); @@ -441,7 +441,7 @@ namespace etl::bitset<60> shift2(0x48D159E0); etl::bitset<60> shift11(0x91A2B3C000); - data2 = data1 << 1; + data2 = data1 << 1; CHECK(data2 == shift1); data2 = data1 << 2; @@ -560,7 +560,7 @@ namespace data2 ^= data1; CHECK(data2 == data3); } - + //************************************************************************* TEST(test_big_bitset) { @@ -587,7 +587,7 @@ namespace { CHECK_EQUAL(compare.test(i), data.test(i)); } - } + } //************************************************************************* TEST(test_small_bitset) @@ -611,10 +611,10 @@ namespace data.set("000000"); CHECK_EQUAL(0, data.find_first(false)); - CHECK_EQUAL(6, data.find_first(true)); + CHECK_EQUAL(etl::ibitset::npos, data.find_first(true)); data.set("111111"); - CHECK_EQUAL(6, data.find_first(false)); + CHECK_EQUAL(etl::ibitset::npos, data.find_first(false)); CHECK_EQUAL(0, data.find_first(true)); data.set("000001"); @@ -646,12 +646,12 @@ namespace data.set("000000"); CHECK_EQUAL(0, data.find_next(false, 0)); CHECK_EQUAL(1, data.find_next(false, 1)); - CHECK_EQUAL(6, data.find_next(true, 2)); + 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(6, data.find_next(false, 2)); + CHECK_EQUAL(etl::ibitset::npos, data.find_next(false, 2)); data.set("001110"); CHECK_EQUAL(0, data.find_next(false, 0)); diff --git a/test/test_compile.cpp b/test/test_compile.cpp index 5e6a1920..e976c61e 100644 --- a/test/test_compile.cpp +++ b/test/test_compile.cpp @@ -12,16 +12,31 @@ #include "crc64_ecma.h" #include "cyclic_value.h" #include "deque.h" - -#if !defined(COMPILER_IAR) +#include "io_port.h" +#include "vector.h" #include "variant.h" -#endif #if defined(COMPILER_KEIL) #pragma diag_suppress 550 #pragma diag_suppress 177 #endif +#if defined(COMPILER_IAR) +#pragma diag_suppress = pe177 +#endif + +struct Test +{ + Test(int i, double d) + : i(i), + d(d) + { + } + + int i; + double d; +}; + //***************************************************************************** // algorithm //***************************************************************************** @@ -90,23 +105,22 @@ void test_algorithm() //***************************************************************************** // alignment //***************************************************************************** -etl::align_at data9; -etl::align_at data10; +etl::aligned_storage<100, 8>::type data9; +etl::aligned_storage_as<100, double>::type data10; void test_alignment() { - data9.value = 0; - data10.value = 0; + int a = static_cast(data9); - etl::align_at data1; - etl::align_at data2; - etl::align_at data3; - etl::align_at data4; + etl::aligned_storage<1, 1>::type data1; + etl::aligned_storage<1, 2>::type data2; + etl::aligned_storage<1, 4>::type data3; + etl::aligned_storage<1, 8>::type data4; - etl::align_as data5; - etl::align_as data6; - etl::align_as data7; - etl::align_as data8; + etl::aligned_storage_as<1, char>::type data5; + etl::aligned_storage_as<1, short>::type data6; + etl::aligned_storage_as<1, int>::type data7; + etl::aligned_storage_as<1, double>::type data8; } //***************************************************************************** @@ -219,12 +233,108 @@ void test_cyclic_value() b = cv1 != cv2; } +template +struct serial_port +{ + etl::io_port_ro rxdata; + etl::io_port_wo txdata; + etl::io_port_rw control; + etl::io_port_ro status; + etl::io_port_wos control2; +}; + +struct dynamic_serial_port +{ + dynamic_serial_port(uint8_t* base) + : rxdata(base), + txdata(base + 1), + control(base + 2), + status(base + 4), + control2(base + 6) + { + } + + etl::io_port_ro rxdata; + etl::io_port_wo txdata; + etl::io_port_rw control; + etl::io_port_ro status; + etl::io_port_wos control2; +}; + //***************************************************************************** -// cyclic_value +// io_port +//***************************************************************************** +void test_io_port() +{ + serial_port<0x1234> port1; + + uint8_t rxdata = port1.rxdata; + port1.txdata = 0x34; + port1.control = 0x5678; // Little endian. + uint16_t status = port1.status; + port1.control2 = 0xDE; + int control2 = port1.control2; + + uint8_t memory[7]; + dynamic_serial_port port2(memory); + + uint8_t rxdata2 = port2.rxdata; + port2.txdata = 0x34; + port2.control = 0x5678; // Little endian. + uint16_t status2 = port2.status; + port2.control2 = 0xDE; + int control22 = port2.control2; +} + +//***************************************************************************** +// variant +//***************************************************************************** +void test_variant() +{ + typedef etl::variant Data; + + Data data; + + data = int(1); + int i = data; + + data = double(2.2); + double d = data; + + data = Test(3, 3.3); + Test test(data); +} + +//***************************************************************************** +// deque //***************************************************************************** void test_deque() { + typedef etl::deque Data; + Data data; + + data.push_back(Test(1, 1.1)); + data.push_back(Test(2, 2.2)); + + Data::iterator it = data.begin(); + data.erase(it); +} + +//***************************************************************************** +// vector +//***************************************************************************** +void test_vector() +{ + typedef etl::vector Data; + + Data data; + + data.push_back(Test(1, 1.1)); + data.push_back(Test(2, 2.2)); + + Data::iterator it = data.begin(); + data.erase(it); } //***************************************************************************** @@ -232,5 +342,13 @@ void test_deque() //***************************************************************************** int main() { + test_algorithm(); test_alignment(); + test_array(); + test_bitset(); + test_crc(); + test_cyclic_value(); + test_deque(); + test_vector(); + test_io_port(); } diff --git a/test/test_io_port.cpp b/test/test_io_port.cpp new file mode 100644 index 00000000..059e2e18 --- /dev/null +++ b/test/test_io_port.cpp @@ -0,0 +1,112 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl + +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 "../io_port.h" + +#include + +template +struct serial_port +{ + etl::io_port_ro rxdata; + etl::io_port_wo txdata; + etl::io_port_rw control; + etl::io_port_ro status; + etl::io_port_wos control2; +}; + +struct dynamic_serial_port +{ + dynamic_serial_port(uint8_t* base) + : rxdata(base), + txdata(base + 1), + control(base + 2), + status(base + 4), + control2(base + 6) + { + } + + etl::io_port_ro rxdata; + etl::io_port_wo txdata; + etl::io_port_rw control; + etl::io_port_ro status; + etl::io_port_wos control2; +}; + +namespace +{ + SUITE(test_alignment) + { + //************************************************************************* + TEST(test_io_port) + { + serial_port<0x1234> port; + } + + //************************************************************************* + TEST(test_dynamic_io_port) + { + uint8_t memory[7]; + memory[0] = 0x12; + memory[1] = 0x00; + memory[2] = 0x00; + memory[3] = 0x00; + memory[4] = 0xBC; + memory[5] = 0x9A; + memory[6] = 0x00; + + dynamic_serial_port port(memory); + + uint8_t rxdata = port.rxdata; + CHECK_EQUAL(memory[0], rxdata); + CHECK_EQUAL(memory[0], port.rxdata); + + port.txdata = 0x34; + CHECK_EQUAL(0x34, memory[1]); + + port.control = 0x5678; // Little endian. + CHECK_EQUAL(0x5678, memory[2] | (memory[3] << 8)); + + uint16_t status = port.status; + CHECK_EQUAL(0x9ABC, status); + CHECK_EQUAL(0x9ABC, port.status); + + port.control2 = 0xDE; + CHECK_EQUAL(0xDE, memory[6]); + + int control2 = port.control2; + CHECK_EQUAL(0xDE, control2); + CHECK_EQUAL(0xDE, port.control2); + + port.control2.set_address(0x1000); + uint8_t* address = port.control2.get_address(); + CHECK_EQUAL(reinterpret_cast(0x1000), address); + } + }; +} diff --git a/test/test_optional.cpp b/test/test_optional.cpp new file mode 100644 index 00000000..9819a6db --- /dev/null +++ b/test/test_optional.cpp @@ -0,0 +1,192 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl + +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. +******************************************************************************/ + +#include + +#include +#include + +#include "../optional.h" +#include "../vector.h" +#include "data.h" + +typedef TestDataNDC Data; + +std::ostream& operator << (std::ostream& os, const Data& data) +{ + os << data.value; + return os; +} + +std::ostream& operator << (std::ostream& os, const etl::optional& data) +{ + os << data.value(); + return os; +} + +namespace +{ + SUITE(test_optional) + { + //************************************************************************* + TEST(test_initialisation) + { + etl::optional data1; + etl::optional data2; + + CHECK(!bool(data1)); + CHECK(!bool(data2)); + + data1 = Data("Hello"); + CHECK(bool(data1)); + CHECK_EQUAL(Data("Hello"), data1); + + data1 = data2; + CHECK(!bool(data1)); + CHECK(!bool(data2)); + + data1 = Data("World"); + data2 = data1; + CHECK(bool(data1)); + CHECK(bool(data2)); + + etl::optional data3(data1); + CHECK(bool(data3)); + CHECK_EQUAL(data1, data3); + + etl::optional data4; + data4 = Data("Hello"); + data4 = etl::nullopt; + CHECK(!bool(data4)); + } + + //************************************************************************* + TEST(test_nullopt) + { + etl::optional data; + data = Data("Hello"); + data = etl::nullopt; + CHECK(!bool(data)); + } + + //************************************************************************* + TEST(test_value_or) + { + etl::optional data; + + Data result = data.value_or(Data("Default")); + CHECK_EQUAL(Data("Default"), result); + + data = Data("Value"); + result = data.value_or(Data("Default")); + CHECK_EQUAL(Data("Value"), result); + } + + //************************************************************************* + TEST(test_equality) + { + etl::optional data1; + etl::optional data2; + + CHECK(data1 == data2); + + data1 = Data("Data1"); + CHECK(!(data1 == data2)); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(!(data1 == data2)); + + data1 = Data("Data1"); + data2 = Data("Data1"); + CHECK(data1 == data2); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(!(data1 == data2)); + + CHECK(data1 == Data("Data1")); + CHECK(!(data1 == Data("Data2"))); + } + + //************************************************************************* + TEST(test_less_than) + { + etl::optional data1; + etl::optional data2; + + CHECK(!(data1 < data2)); + + data1 = Data("Data1"); + CHECK(!(data1 < data2)); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(data1 < data2); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(data1 < data2); + CHECK(!(data2 < data1)); + + CHECK(data1 < Data("Data2")); + CHECK(!(data1 < Data("Data1"))); + } + + //************************************************************************* + TEST(test_container_of_optional) + { + etl::vector, 10> container; + + container.resize(5, Data("1")); + + CHECK(bool(container[0])); + CHECK(bool(container[1])); + CHECK(bool(container[2])); + CHECK(bool(container[3])); + CHECK(bool(container[4])); + } + + //************************************************************************* + TEST(test_optional_container) + { + etl::optional> container; + CHECK(!bool(container)); + + container = etl::vector(); + CHECK(bool(container)); + + container.value().resize(5, Data("1")); + + CHECK_EQUAL(Data("1"), container.value()[0]); + CHECK_EQUAL(Data("1"), container.value()[1]); + CHECK_EQUAL(Data("1"), container.value()[2]); + CHECK_EQUAL(Data("1"), container.value()[3]); + CHECK_EQUAL(Data("1"), container.value()[4]); + } + }; +} diff --git a/test/vs2013/etl.vcxproj b/test/vs2013/etl.vcxproj index 36f282c8..417eadc7 100644 --- a/test/vs2013/etl.vcxproj +++ b/test/vs2013/etl.vcxproj @@ -155,11 +155,13 @@ + + @@ -172,6 +174,7 @@ + @@ -186,6 +189,8 @@ + + @@ -225,6 +230,7 @@ + false @@ -233,13 +239,18 @@ - + + false + false + - + + false + @@ -247,19 +258,28 @@ + - + + false + - + + false + + + + true + diff --git a/test/vs2013/etl.vcxproj.filters b/test/vs2013/etl.vcxproj.filters index 49bc1b35..236c8fc4 100644 --- a/test/vs2013/etl.vcxproj.filters +++ b/test/vs2013/etl.vcxproj.filters @@ -351,6 +351,21 @@ ETL\Containers + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Containers + @@ -449,9 +464,6 @@ Source Files - - Source Files - Source Files @@ -548,6 +560,18 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + diff --git a/type_traits.h b/type_traits.h index 2bc3ce4a..c823010c 100644 --- a/type_traits.h +++ b/type_traits.h @@ -309,6 +309,17 @@ namespace etl template struct rank : public integral_constant::value + 1> {}; template struct rank : public integral_constant::value + 1> {}; + /// decay + ///\ingroup type_traits + template + struct decay + { + typedef typename etl::remove_reference::type U; + typedef typename etl::conditional::value, + typename etl::remove_extent::type*, + typename etl::remove_cv::type>::type type; + }; + /// Alignment templates. /// These require compiler specific intrinsics. ///\ingroup type_traits diff --git a/variant.h b/variant.h index 7b520f49..5171c3c6 100644 --- a/variant.h +++ b/variant.h @@ -46,6 +46,7 @@ SOFTWARE. #if defined(COMPILER_KEIL) #pragma diag_suppress 940 + #pragma diag_suppress 111 #endif //***************************************************************************** @@ -451,6 +452,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -473,6 +475,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -503,6 +506,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -524,6 +528,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -553,6 +558,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -573,6 +579,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -601,6 +608,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -620,6 +628,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -647,6 +656,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -665,6 +675,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -691,6 +702,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -708,6 +720,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -733,6 +746,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -749,6 +763,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -773,6 +788,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -788,6 +804,7 @@ namespace etl #else error_handler::error(variant_invalid_type_id_exception()); #endif + return reinterpret_cast(*p_data); break; } } @@ -816,7 +833,7 @@ namespace etl { STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - new(&data.value[0]) T(value); + new(static_cast(data)) T(value); type_id = Type_Id_Lookup::type_id; } @@ -839,7 +856,7 @@ namespace etl { STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - new(&data.value[0]) T(value); + new(data) T(value); type_id = Type_Id_Lookup::type_id; return *this; } @@ -894,14 +911,14 @@ namespace etl { switch (type_id) { - case 0: reader.read(reinterpret_cast(*&data.value[0])); break; - case 1: reader.read(reinterpret_cast(*&data.value[0])); break; - case 2: reader.read(reinterpret_cast(*&data.value[0])); break; - case 3: reader.read(reinterpret_cast(*&data.value[0])); break; - case 4: reader.read(reinterpret_cast(*&data.value[0])); break; - case 5: reader.read(reinterpret_cast(*&data.value[0])); break; - case 6: reader.read(reinterpret_cast(*&data.value[0])); break; - case 7: reader.read(reinterpret_cast(*&data.value[0])); break; + case 0: reader.read(static_cast(data)); break; + case 1: reader.read(static_cast(data)); break; + case 2: reader.read(static_cast(data)); break; + case 3: reader.read(static_cast(data)); break; + case 4: reader.read(static_cast(data)); break; + case 5: reader.read(static_cast(data)); break; + case 6: reader.read(static_cast(data)); break; + case 7: reader.read(static_cast(data)); break; default: #ifdef ETL_THROW_EXCEPTIONS throw variant_invalid_type_id_exception(); @@ -958,7 +975,7 @@ namespace etl #endif } - return reinterpret_cast(*&data.value[0]); + return static_cast(data); } //*************************************************************************** @@ -980,7 +997,7 @@ namespace etl #endif } - return reinterpret_cast(*&data.value[0]); + return static_cast(data); } //*************************************************************************** @@ -990,7 +1007,7 @@ namespace etl template TBase& upcast() { - return upcast_functor()(&data.value[0], type_id); + return upcast_functor()(data, type_id); } //*************************************************************************** @@ -1000,7 +1017,7 @@ namespace etl template const TBase& upcast() const { - return upcast_functor()(&data.value[0], type_id); + return upcast_functor()(data, type_id); } //*************************************************************************** @@ -1031,7 +1048,7 @@ namespace etl /// The internal storage. /// Aligned on a suitable boundary, which should be good for all types. //*************************************************************************** - align_at, ALIGNMENT> data; + typename etl::aligned_storage::value>::type data; //*************************************************************************** /// The id of the current stored type. diff --git a/vector.h b/vector.h index b93fb190..4575fdeb 100644 --- a/vector.h +++ b/vector.h @@ -64,7 +64,7 @@ namespace etl /// Constructor. //************************************************************************* vector() - : ivector(reinterpret_cast(&buffer.value[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) { } @@ -73,7 +73,7 @@ namespace etl ///\param initialSize The initial size of the vector. //************************************************************************* explicit vector(size_t initialSize) - : ivector(reinterpret_cast(&buffer.value[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) { ivector::resize(initialSize); } @@ -84,7 +84,7 @@ namespace etl ///\param value The value to fill the vector with. //************************************************************************* vector(size_t initialSize, typename ivector::parameter_t value) - : ivector(reinterpret_cast(&buffer.value[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) { ivector::resize(initialSize, value); } @@ -97,7 +97,7 @@ namespace etl //************************************************************************* template vector(TIterator first, TIterator last) - : ivector(reinterpret_cast(&buffer.value[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) { ivector::assign(first, last); } @@ -117,7 +117,7 @@ namespace etl private: - etl::align_as, T> buffer; + typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; }; }