From 50c380901adf41b0a8daf3b348f63860bcb18aec Mon Sep 17 00:00:00 2001 From: JR Date: Sun, 27 Jun 2021 18:14:30 +0200 Subject: [PATCH 1/5] add a couple of arduino examples (#397) * Add information about Arduino library and repo * Add arduino library example --- README.md | 4 ++ arduino/create_arduino_library.py | 18 +++++++++ .../Example_0_import_etl.ino | 10 +++++ .../Example_Vector_1_simple_use.ino | 37 +++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 arduino_examples/Example_0_import_etl/Example_0_import_etl.ino create mode 100644 arduino_examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino diff --git a/README.md b/README.md index 4baa523d..2ca62bd4 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,7 @@ Any help porting the library to work under different platforms and compilers wou I am especially interested in people who are using Keil, IAR, Green Hills, TI Code Composer etc, bare metal or RTOS, and DSPs. See (https://www.etlcpp.com) for up-to-date information. + +**Arduino library:** + +The content of this repo is available as a library in the Arduino IDE (search for the "Embedded Template Library" in the IDE library manager). The Arduino library repository is available at ```https://github.com/ETLCPP/etl-arduino```, see there for more details. diff --git a/arduino/create_arduino_library.py b/arduino/create_arduino_library.py index b74549e1..97924e7f 100644 --- a/arduino/create_arduino_library.py +++ b/arduino/create_arduino_library.py @@ -27,6 +27,10 @@ print('etl_dir = ', etl_dir) include_dir = os.path.join(etl_dir, 'include') print('include_dir = ', include_dir) +# Get the ETL arduino_examples folder +arduino_examples_dir = os.path.join(etl_dir, 'arduino_examples') +print('examples_dir = ', arduino_examples_dir) + # Get the root folder of both repositories common_dir = os.path.dirname(etl_dir) print('common_dir = ', common_dir) @@ -39,6 +43,10 @@ print('etl_arduino_dir = ', etl_arduino_dir) etl_arduino_src_dir = os.path.join(etl_arduino_dir, 'src') print('etl_arduino_src_dir = ', etl_arduino_src_dir) +# Get the ETL Arduino examples repository folder +etl_arduino_examples_dir = os.path.join(etl_arduino_dir, 'examples') +print('etl_arduino_examples_dir = ', etl_arduino_examples_dir) + print('') # Copy the library properties @@ -70,3 +78,13 @@ print('Copy the ETL headers') print(' From :', source) print(' To :', destination) shutil.copytree(source, destination, dirs_exist_ok = True) + +print('') + +# Copy the ETL arduino_examples +source = arduino_examples_dir +destination = etl_arduino_examples_dir +print('Copy the ETL examples_arduino') +print(' From :', source) +print(' To :', destination) +shutil.copytree(source, destination, dirs_exist_ok = True) diff --git a/arduino_examples/Example_0_import_etl/Example_0_import_etl.ino b/arduino_examples/Example_0_import_etl/Example_0_import_etl.ino new file mode 100644 index 00000000..d208c463 --- /dev/null +++ b/arduino_examples/Example_0_import_etl/Example_0_import_etl.ino @@ -0,0 +1,10 @@ +#include "Embedded_Template_Library.h" // this is required for any more etl import when using Arduino IDE + +void setup(){ + +} + + +void loop(){ + +} diff --git a/arduino_examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino b/arduino_examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino new file mode 100644 index 00000000..a0c92fc1 --- /dev/null +++ b/arduino_examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino @@ -0,0 +1,37 @@ +#include "Embedded_Template_Library.h" +#include "etl/vector.h" + +template +void print_vector(etl::ivector const & vec_in){ + Serial.print(F("print vector content | size ")); Serial.print(vec_in.size()); Serial.print(F(" | capacity ")); Serial.println(vec_in.capacity()); + Serial.print(F("content | ")); + for (T const & elem : vec_in) { + Serial.print(elem); + Serial.print(F(" | ")); + } + Serial.println(); +} + +void setup(){ + Serial.begin(115200); + delay(100); + Serial.println(F("booted")); + + etl::vector vec_int; + + Serial.println(F("initialized vec_int")); + print_vector(vec_int); + + vec_int.push_back(1); + vec_int.push_back(2); + Serial.println(F("pushed to vec_int")); + print_vector(vec_int); + + vec_int.pop_back(); + Serial.println(F("pop from vec_int; returns no value")); + print_vector(vec_int); +} + +void loop(){ + +} From 6c32cac9ca91e3f3f45dd25c48a0cc4bf7089920 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 22 Jun 2021 20:32:57 +0100 Subject: [PATCH 2/5] Fixed swapped HUGE_VAL & HUGE_VALF definitions --- include/etl/limits.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/etl/limits.h b/include/etl/limits.h index 52023d2a..56b5292e 100644 --- a/include/etl/limits.h +++ b/include/etl/limits.h @@ -73,8 +73,8 @@ SOFTWARE. #if !defined(HUGE_VAL) // Looks like we don't have these macros defined. // They're compiler implementation dependent, so we'll make them the same as the max values. - #define HUGE_VAL FLT_MAX - #define HUGE_VALF DBL_MAX + #define HUGE_VALF FLT_MAX + #define HUGE_VAL DBL_MAX #define HUGE_VALL LDBL_MAX #endif From c49a9274dfddff425afac0517ebf8dabae356509 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 24 Jun 2021 18:14:25 +0100 Subject: [PATCH 3/5] Deleted experimental files --- include/etl/experimental/crc16.h | 82 ---- include/etl/experimental/crc16_ccitt.h | 82 ---- include/etl/experimental/crc16_genibus.h | 82 ---- include/etl/experimental/crc16_kermit.h | 82 ---- include/etl/experimental/crc16_modbus.h | 82 ---- include/etl/experimental/crc16_usb.h | 82 ---- include/etl/experimental/crc16_x25.h | 82 ---- include/etl/experimental/crc16_xmodem.h | 82 ---- include/etl/experimental/crc32.h | 82 ---- include/etl/experimental/crc32_bzip2.h | 82 ---- include/etl/experimental/crc32_c.h | 82 ---- include/etl/experimental/crc32_mpeg2.h | 82 ---- include/etl/experimental/crc32_posix.h | 82 ---- include/etl/experimental/crc64_ecma.h | 82 ---- include/etl/experimental/crc8_ccitt.h | 80 ---- include/etl/experimental/crc8_rohc.h | 83 ---- include/etl/experimental/variant_new.h | 509 ----------------------- 17 files changed, 1820 deletions(-) delete mode 100644 include/etl/experimental/crc16.h delete mode 100644 include/etl/experimental/crc16_ccitt.h delete mode 100644 include/etl/experimental/crc16_genibus.h delete mode 100644 include/etl/experimental/crc16_kermit.h delete mode 100644 include/etl/experimental/crc16_modbus.h delete mode 100644 include/etl/experimental/crc16_usb.h delete mode 100644 include/etl/experimental/crc16_x25.h delete mode 100644 include/etl/experimental/crc16_xmodem.h delete mode 100644 include/etl/experimental/crc32.h delete mode 100644 include/etl/experimental/crc32_bzip2.h delete mode 100644 include/etl/experimental/crc32_c.h delete mode 100644 include/etl/experimental/crc32_mpeg2.h delete mode 100644 include/etl/experimental/crc32_posix.h delete mode 100644 include/etl/experimental/crc64_ecma.h delete mode 100644 include/etl/experimental/crc8_ccitt.h delete mode 100644 include/etl/experimental/crc8_rohc.h delete mode 100644 include/etl/experimental/variant_new.h diff --git a/include/etl/experimental/crc16.h b/include/etl/experimental/crc16.h deleted file mode 100644 index 07b0c39d..00000000 --- a/include/etl/experimental/crc16.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_EX_INCLUDED -#define ETL_CRC16_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc16 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc16_t = etl::crc_type; -#else - template - class crc16_t : public etl::private_crc::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_t<256U> crc16_t256; - typedef etl::crc::crc16_t<16U> crc16_t16; - typedef etl::crc::crc16_t<4U> crc16_t4; - typedef crc16_t256 crc16; - } -} -#endif diff --git a/include/etl/experimental/crc16_ccitt.h b/include/etl/experimental/crc16_ccitt.h deleted file mode 100644 index be148a56..00000000 --- a/include/etl/experimental/crc16_ccitt.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_CCITT_EX_INCLUDED -#define ETL_CRC16_CCITT_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc16_ccitt 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc16_ccitt_t = etl::crc_type; -#else - template - class crc16_ccitt_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_ccitt_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_ccitt_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_ccitt_t<256U> crc16_ccitt_t256; - typedef etl::crc::crc16_ccitt_t<16U> crc16_ccitt_t16; - typedef etl::crc::crc16_ccitt_t<4U> crc16_ccitt_t4; - typedef crc16_ccitt_t256 crc16_ccitt; - } -} -#endif diff --git a/include/etl/experimental/crc16_genibus.h b/include/etl/experimental/crc16_genibus.h deleted file mode 100644 index f901ab8f..00000000 --- a/include/etl/experimental/crc16_genibus.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_GENIBUS_EX_INCLUDED -#define ETL_CRC16_GENIBUS_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc16_genibus 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc16_genibus_t = etl::crc_type; -#else - template - class crc16_genibus_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_genibus_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_genibus_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_genibus_t<256U> crc16_genibus_t256; - typedef etl::crc::crc16_genibus_t<16U> crc16_genibus_t16; - typedef etl::crc::crc16_genibus_t<4U> crc16_genibus_t4; - typedef crc16_genibus_t256 crc16_genibus; - } -} -#endif diff --git a/include/etl/experimental/crc16_kermit.h b/include/etl/experimental/crc16_kermit.h deleted file mode 100644 index eb9cc987..00000000 --- a/include/etl/experimental/crc16_kermit.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_KERMIT_EX_INCLUDED -#define ETL_CRC16_KERMIT_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc16_kermit 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc16_kermit_t = etl::crc_type; -#else - template - class crc16_kermit_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_kermit_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_kermit_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_kermit_t<256U> crc16_kermit_t256; - typedef etl::crc::crc16_kermit_t<16U> crc16_kermit_t16; - typedef etl::crc::crc16_kermit_t<4U> crc16_kermit_t4; - typedef crc16_kermit_t256 crc16_kermit; - } -} -#endif diff --git a/include/etl/experimental/crc16_modbus.h b/include/etl/experimental/crc16_modbus.h deleted file mode 100644 index aca95d3b..00000000 --- a/include/etl/experimental/crc16_modbus.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_MODBUS_EX_INCLUDED -#define ETL_CRC16_MODBUS_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -//\defgroup crc16_modbus 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc16_modbus_t = etl::crc_type; -#else - template - class crc16_modbus_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_modbus_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_modbus_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_modbus_t<256U> crc16_modbus_t256; - typedef etl::crc::crc16_modbus_t<16U> crc16_modbus_t16; - typedef etl::crc::crc16_modbus_t<4U> crc16_modbus_t4; - typedef crc16_modbus_t256 crc16_modbus; - } -} -#endif diff --git a/include/etl/experimental/crc16_usb.h b/include/etl/experimental/crc16_usb.h deleted file mode 100644 index 2510d78b..00000000 --- a/include/etl/experimental/crc16_usb.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_USB_EX_INCLUDED -#define ETL_CRC16_USB_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc16_usb 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc16_usb_t = etl::crc_type; -#else - template - class crc16_usb_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_usb_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_usb_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_usb_t<256U> crc16_usb_t256; - typedef etl::crc::crc16_usb_t<16U> crc16_usb_t16; - typedef etl::crc::crc16_usb_t<4U> crc16_usb_t4; - typedef crc16_usb_t256 crc16_usb; - } -} -#endif diff --git a/include/etl/experimental/crc16_x25.h b/include/etl/experimental/crc16_x25.h deleted file mode 100644 index 916c15a7..00000000 --- a/include/etl/experimental/crc16_x25.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_X25_EX_INCLUDED -#define ETL_CRC16_X25_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc16_x25 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc16_x25_t = etl::crc_type; -#else - template - class crc16_x25_t : public etl::private_crc::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_x25_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_x25_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_x25_t<256U> crc16_x25_t256; - typedef etl::crc::crc16_x25_t<16U> crc16_x25_t16; - typedef etl::crc::crc16_x25_t<4U> crc16_x25_t4; - typedef crc16_x25_t256 crc16_x25; - } -} -#endif diff --git a/include/etl/experimental/crc16_xmodem.h b/include/etl/experimental/crc16_xmodem.h deleted file mode 100644 index 19c520af..00000000 --- a/include/etl/experimental/crc16_xmodem.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC16_XMODEM_EX_INCLUDED -#define ETL_CRC16_XMODEM_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc16_xmodem 16 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED - template - using crc16_xmodem_t = etl::crc_type; -#else - template - class crc16_xmodem_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc16_xmodem_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc16_xmodem_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc16_xmodem_t<256U> crc16_xmodem_t256; - typedef etl::crc::crc16_xmodem_t<16U> crc16_xmodem_t16; - typedef etl::crc::crc16_xmodem_t<4U> crc16_xmodem_t4; - typedef crc16_xmodem_t256 crc16_xmodem; - } -} -#endif diff --git a/include/etl/experimental/crc32.h b/include/etl/experimental/crc32.h deleted file mode 100644 index 37767d2f..00000000 --- a/include/etl/experimental/crc32.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC32_EX_INCLUDED -#define ETL_CRC32_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc32 32 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED - template - using crc32_t = etl::crc_type; -#else - template - class crc32_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc32_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc32_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc32_t<256U> crc32_t256; - typedef etl::crc::crc32_t<16U> crc32_t16; - typedef etl::crc::crc32_t<4U> crc32_t4; - typedef crc32_t256 crc32; - } -} -#endif diff --git a/include/etl/experimental/crc32_bzip2.h b/include/etl/experimental/crc32_bzip2.h deleted file mode 100644 index 5d632d76..00000000 --- a/include/etl/experimental/crc32_bzip2.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC32_BZIP2_EX_INCLUDED -#define ETL_CRC32_BZIP2_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc32_bzip2 32 bit CRC BZIP2 calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED - template - using crc32_bzip2_t = etl::crc_type; -#else - template - class crc32_bzip2_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc32_bzip2_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc32_bzip2_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc32_bzip2_t<256U> crc32_bzip2_t256; - typedef etl::crc::crc32_bzip2_t<16U> crc32_bzip2_t16; - typedef etl::crc::crc32_bzip2_t<4U> crc32_bzip2_t4; - typedef crc32_bzip2_t256 crc32_bzip2; - } -} -#endif diff --git a/include/etl/experimental/crc32_c.h b/include/etl/experimental/crc32_c.h deleted file mode 100644 index 84d84167..00000000 --- a/include/etl/experimental/crc32_c.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC32_C_EX_INCLUDED -#define ETL_CRC32_C_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc32_c 32 bit CRC_C calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED - template - using crc32_c_t = etl::crc_type; -#else - template - class crc32_c_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc32_c_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc32_c_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc32_c_t<256U> crc32_c_t256; - typedef etl::crc::crc32_c_t<16U> crc32_c_t16; - typedef etl::crc::crc32_c_t<4U> crc32_c_t4; - typedef crc32_c_t256 crc32_c; - } -} -#endif diff --git a/include/etl/experimental/crc32_mpeg2.h b/include/etl/experimental/crc32_mpeg2.h deleted file mode 100644 index e23657a4..00000000 --- a/include/etl/experimental/crc32_mpeg2.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC32_MPEG2_EX_INCLUDED -#define ETL_CRC32_MPEG2_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc32_mpeg2 32 bit CRC MPEG2 calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED - template - using crc32_mpeg2_t = etl::crc_type; -#else - template - class crc32_mpeg2_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc32_mpeg2_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc32_mpeg2_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc32_mpeg2_t<256U> crc32_mpeg2_t256; - typedef etl::crc::crc32_mpeg2_t<16U> crc32_mpeg2_t16; - typedef etl::crc::crc32_mpeg2_t<4U> crc32_mpeg2_t4; - typedef crc32_mpeg2_t256 crc32_mpeg2; - } -} -#endif diff --git a/include/etl/experimental/crc32_posix.h b/include/etl/experimental/crc32_posix.h deleted file mode 100644 index 5f3cb701..00000000 --- a/include/etl/experimental/crc32_posix.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC32_POSIX_EX_INCLUDED -#define ETL_CRC32_POSIX_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc32_posix 32 bit CRC POSIX calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED - template - using crc32_posix_t = etl::crc_type; -#else - template - class crc32_posix_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc32_posix_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc32_posix_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc32_posix_t<256U> crc32_posix_t256; - typedef etl::crc::crc32_posix_t<16U> crc32_posix_t16; - typedef etl::crc::crc32_posix_t<4U> crc32_posix_t4; - typedef crc32_posix_t256 crc32_posix; - } -} -#endif diff --git a/include/etl/experimental/crc64_ecma.h b/include/etl/experimental/crc64_ecma.h deleted file mode 100644 index 407c0f4a..00000000 --- a/include/etl/experimental/crc64_ecma.h +++ /dev/null @@ -1,82 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC64_ECMA_EX_INCLUDED -#define ETL_CRC64_ECMA_EX_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup crc64_ecma 64 bit ECMA CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED - template - using crc64_ecma_t = etl::crc_type; -#else - template - class crc64_ecma_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc64_ecma_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc64_ecma_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc64_ecma_t<256U> crc64_ecma_t256; - typedef etl::crc::crc64_ecma_t<16U> crc64_ecma_t16; - typedef etl::crc::crc64_ecma_t<4U> crc64_ecma_t4; - typedef crc64_ecma_t256 crc64_ecma; - } -} -#endif diff --git a/include/etl/experimental/crc8_ccitt.h b/include/etl/experimental/crc8_ccitt.h deleted file mode 100644 index 66683b68..00000000 --- a/include/etl/experimental/crc8_ccitt.h +++ /dev/null @@ -1,80 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC8_CCITT_EXP_INCLUDED -#define ETL_CRC8_CCITT_EXP_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc8_ccitt_t = etl::crc_type; -#else - template - class crc8_ccitt_t : public etl::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc8_ccitt_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc8_ccitt_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef crc8_ccitt_t<256U> crc8_ccitt_t256; - typedef crc8_ccitt_t<16U> crc8_ccitt_t16; - typedef crc8_ccitt_t<4U> crc8_ccitt_t4; - typedef crc8_ccitt_t256 crc8_ccitt; - } -} - -#endif diff --git a/include/etl/experimental/crc8_rohc.h b/include/etl/experimental/crc8_rohc.h deleted file mode 100644 index 60ab5b23..00000000 --- a/include/etl/experimental/crc8_rohc.h +++ /dev/null @@ -1,83 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2021 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_CRC8_ROHC_EXP_INCLUDED -#define ETL_CRC8_ROHC_EXP_INCLUDED - -#include "../platform.h" -#include "crc_implementation.h" -#include "crc_parameters.h" - -///\defgroup rohc 8 bit CRC calculation -///\ingroup crc - -namespace etl -{ - namespace crc - { -#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03 - template - using crc8_rohc_t = etl::crc_type; -#else - template - class crc8_rohc_t : public etl::private_crc::crc_type - { - public: - - //************************************************************************* - /// Default constructor. - //************************************************************************* - crc8_rohc_t() - { - this->reset(); - } - - //************************************************************************* - /// Constructor from range. - /// \param begin Start of the range. - /// \param end End of the range. - //************************************************************************* - template - crc8_rohc_t(TIterator begin, const TIterator end) - { - this->reset(); - this->add(begin, end); - } - }; -#endif - - typedef etl::crc::crc8_rohc_t<256U> crc8_rohc_t256; - typedef etl::crc::crc8_rohc_t<16U> crc8_rohc_t16; - typedef etl::crc::crc8_rohc_t<4U> crc8_rohc_t4; - typedef crc8_rohc_t256 crc8_rohc; - } -} - -#endif diff --git a/include/etl/experimental/variant_new.h b/include/etl/experimental/variant_new.h deleted file mode 100644 index 160969ac..00000000 --- a/include/etl/experimental/variant_new.h +++ /dev/null @@ -1,509 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2020 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_VARIANT_NEW_INCLUDED -#define ETL_VARIANT_NEW_INCLUDED - -#include - -#include "private/new.h" - -#include "platform.h" -#include "utility.h" -#include "array.h" -#include "largest.h" -#include "exception.h" -#include "type_traits.h" -#include "integral_limits.h" -#include "static_assert.h" -#include "alignment.h" -#include "error_handler.h" -#include "null_type.h" - -#if defined(ETL_COMPILER_KEIL) - #pragma diag_suppress 940 - #pragma diag_suppress 111 -#endif - -#undef ETL_FILE -#define ETL_FILE "24" - -#if ETL_CPP11_SUPPORTED - -//***************************************************************************** -///\defgroup variant variant -/// A class that can contain one a several specified types in a type safe manner. -///\ingroup containers -//***************************************************************************** - -namespace etl -{ - //*************************************************************************** - /// Base exception for the variant class. - ///\ingroup variant - //*************************************************************************** - class variant_exception : public exception - { - public: - variant_exception(string_type reason_, string_type file_name_, numeric_type line_number_) - : exception(reason_, file_name_, line_number_) - { - } - }; - - //*************************************************************************** - /// 'Unsupported type' exception for the variant class. - ///\ingroup variant - //*************************************************************************** - class variant_incorrect_type_exception : public variant_exception - { - public: - variant_incorrect_type_exception(string_type file_name_, numeric_type line_number_) - : variant_exception(ETL_ERROR_TEXT("variant: unsupported type", ETL_FILE"A"), file_name_, line_number_) - { - } - }; - - //*************************************************************************** - /// A template class that can store any of the types defined in the template parameter list. - /// Supports up to 8 types. - ///\ingroup variant - //*************************************************************************** - template - class variant - { - public: - - //*************************************************************************** - /// The id a unsupported types. - //*************************************************************************** - static ETL_CONST_OR_CONSTEXPR size_t npos = -1; - - private: - - // All types of variant are friends. - template - friend class variant; - - //*************************************************************************** - /// The largest type. - //*************************************************************************** - typedef typename largest_type::type largest_t; - - //*************************************************************************** - /// The largest size. - //*************************************************************************** - static const size_t SIZE = sizeof(largest_t); - - //*************************************************************************** - /// The largest alignment. - //*************************************************************************** - static const size_t ALIGNMENT = etl::largest_alignment::value; - - public: - - //*************************************************************************** - /// Destructor. - //*************************************************************************** - ~variant() - { - destruct_current(); - } - - //*************************************************************************** - /// Default constructor. - /// Sets the state of the instance to containing no valid data. - //*************************************************************************** - variant() - : type_id(UNSUPPORTED_TYPE_ID) - { - } - - //*************************************************************************** - /// Constructor that catches any types that are not supported. - /// Forces a ETL_STATIC_ASSERT. - //*************************************************************************** - template - variant(const T& value) - { - ETL_STATIC_ASSERT(etl::index_of::value != etl::index_of::npos, "Unsupported type"); - - ::new (static_cast(data)) T(value); - type_id = etl::index_of::value; - } - - //*************************************************************************** - /// Copy constructor. - ///\param other The other variant object to copy. - //*************************************************************************** - variant(const variant& other) - { - switch (other.type_id) - { - case 0: ::new (static_cast(data)) T1(other.get()); break; - case 1: ::new (static_cast(data)) T2(other.get()); break; - case 2: ::new (static_cast(data)) T3(other.get()); break; - case 3: ::new (static_cast(data)) T4(other.get()); break; - case 4: ::new (static_cast(data)) T5(other.get()); break; - case 5: ::new (static_cast(data)) T6(other.get()); break; - case 6: ::new (static_cast(data)) T7(other.get()); break; - case 7: ::new (static_cast(data)) T8(other.get()); break; - default: break; - } - - type_id = other.type_id; - } - -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && !defined(ETL_VARIANT_FORCE_CPP03) - //************************************************************************* - /// Emplace with variadic constructor parameters. - //************************************************************************* - template - T& emplace(Args&&... args) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(etl::forward(args)...); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } -#else - //*************************************************************************** - /// Emplace with one constructor parameter. - //*************************************************************************** - template - T& emplace(const TP1& value1) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } - - //*************************************************************************** - /// Emplace with two constructor parameters. - //*************************************************************************** - template - T& emplace(const TP1& value1, const TP2& value2) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1, value2); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } - - //*************************************************************************** - /// Emplace with three constructor parameters. - //*************************************************************************** - template - T& emplace(const TP1& value1, const TP2& value2, const TP3& value3) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1, value2, value3); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } - - //*************************************************************************** - /// Emplace with four constructor parameters. - //*************************************************************************** - template - T& emplace(const TP1& value1, const TP2& value2, const TP3& value3, const TP4& value4) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1, value2, value3, value4); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } -#endif - - //*************************************************************************** - /// Assignment operator for T1 type. - ///\param value The value to assign. - //*************************************************************************** - template - variant& operator =(const T& value) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value); - type_id = Type_Id_Lookup::type_id; - - return *this; - } - - //*************************************************************************** - /// Assignment operator for variant type. - ///\param other The variant to assign. - //*************************************************************************** - variant& operator =(const variant& other) - { - if (this != &other) - { - destruct_current(); - - switch (other.type_id) - { - case 0: ::new (static_cast(data)) T1(other.get()); break; - case 1: ::new (static_cast(data)) T2(other.get()); break; - case 2: ::new (static_cast(data)) T3(other.get()); break; - case 3: ::new (static_cast(data)) T4(other.get()); break; - case 4: ::new (static_cast(data)) T5(other.get()); break; - case 5: ::new (static_cast(data)) T6(other.get()); break; - case 6: ::new (static_cast(data)) T7(other.get()); break; - case 7: ::new (static_cast(data)) T8(other.get()); break; - default: break; - } - - type_id = other.type_id; - } - - return *this; - } - - //*************************************************************************** - /// Checks if the type is the same as the current stored type. - /// For variants with the same type declarations. - ///\return true if the types are the same, otherwise false. - //*************************************************************************** - bool is_same_type(const variant& other) const - { - return type_id == other.type_id; - } - - //*************************************************************************** - /// Checks if the type is the same as the current stored type. - /// For variants with differing declarations. - ///\return true if the types are the same, otherwise false. - //*************************************************************************** - template - bool is_same_type(const variant& other) const - { - bool is_same = false; - - switch (other.type_id) - { - case 0: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 1: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 2: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 3: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 4: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 5: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 6: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 7: is_same = (type_id == Type_Id_Lookup::type_id); break; - default: break; - } - - return is_same; - } - - //*************************************************************************** - /// Calls the supplied reader instance. - /// The 'read' function appropriate to the current type is called with the stored value. - //*************************************************************************** - void call(reader& r) - { - switch (type_id) - { - case 0: r.read(static_cast(data)); break; - case 1: r.read(static_cast(data)); break; - case 2: r.read(static_cast(data)); break; - case 3: r.read(static_cast(data)); break; - case 4: r.read(static_cast(data)); break; - case 5: r.read(static_cast(data)); break; - case 6: r.read(static_cast(data)); break; - case 7: r.read(static_cast(data)); break; - default: break; - } - } - - //*************************************************************************** - /// Checks whether a valid value is currently stored. - ///\return true if the value is valid, otherwise false. - //*************************************************************************** - bool is_valid() const - { - return type_id != UNSUPPORTED_TYPE_ID; - } - - //*************************************************************************** - /// Checks to see if the type currently stored is the same as that specified in the template parameter. - ///\return true if it is the specified type, otherwise false. - //*************************************************************************** - template - bool is_type() const - { - return type_id == Type_Id_Lookup::type_id; - } - - //*************************************************************************** - /// Gets the index of the type currently stored or UNSUPPORTED_TYPE_ID - //*************************************************************************** - size_t index() const - { - return type_id; - } - - //*************************************************************************** - /// Clears the value to 'no valid stored value'. - //*************************************************************************** - void clear() - { - destruct_current(); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - /// Throws a variant_incorrect_type_exception if the actual type is not that specified. - ///\return A reference to the value. - //*************************************************************************** - template - T& get() - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - ETL_ASSERT(is_type(), ETL_ERROR(variant_incorrect_type_exception)); - - return static_cast(data); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - /// Throws a variant_incorrect_type_exception if the actual type is not that specified. - ///\return A const reference to the value. - //*************************************************************************** - template - const T& get() const - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - ETL_ASSERT(is_type(), ETL_ERROR(variant_incorrect_type_exception)); - - return static_cast(data); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - ///\return A reference to the value. - //*************************************************************************** - template - TBase& upcast() - { - return upcast_functor()(data, type_id); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - ///\return A const reference to the value. - //*************************************************************************** - template - const TBase& upcast() const - { - return upcast_functor()(data, type_id); - } - - //*************************************************************************** - /// Conversion operators for each type. - //*************************************************************************** - operator T1&() { return get(); } - operator T2&() { return get(); } - operator T3&() { return get(); } - operator T4&() { return get(); } - operator T5&() { return get(); } - operator T6&() { return get(); } - operator T7&() { return get(); } - operator T8&() { return get(); } - - //*************************************************************************** - /// Checks if the template type is supported by the implementation of variant.. - ///\return true if the type is supported, otherwise false. - //*************************************************************************** - template - static bool is_supported_type() - { - return Type_Is_Supported::value; - } - - private: - - //*************************************************************************** - /// Destruct the current occupant of the variant. - //*************************************************************************** - void destruct_current() - { - switch (type_id) - { - case 0: { static_cast(data)->~T1(); break; } - case 1: { static_cast(data)->~T2(); break; } - case 2: { static_cast(data)->~T3(); break; } - case 3: { static_cast(data)->~T4(); break; } - case 4: { static_cast(data)->~T5(); break; } - case 5: { static_cast(data)->~T6(); break; } - case 6: { static_cast(data)->~T7(); break; } - case 7: { static_cast(data)->~T8(); break; } - default: { break; } - } - - type_id = UNSUPPORTED_TYPE_ID; - } - - constexpr size_t NUMBER_OF_VARIANTS = sizeof...(TVariants); - - //*************************************************************************** - /// The internal storage. - /// Aligned on a suitable boundary, which should be good for all types. - //*************************************************************************** - typename etl::aligned_storage::type data; - - //*************************************************************************** - /// The id of the current stored type. - //*************************************************************************** - type_id_t type_id; - }; -} - -#endif - -#undef ETL_FILE - -#endif From e109e4977b9a5edbbcc0e8bd34c04b2bd8fc5c68 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 24 Jun 2021 20:38:57 +0100 Subject: [PATCH 4/5] C++20 compatibility for deprecated std::is_pod --- .../etl/generators/type_traits_generator.h | 30 +++++++++++++++---- include/etl/type_traits.h | 30 +++++++++++++++---- include/etl/vector.h | 4 --- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index 776d991b..b2d405fe 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -1148,51 +1148,71 @@ namespace etl //*************************************************************************** /// is_trivially_constructible ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_constructible : std::is_trivially_constructible {}; +#else template struct is_trivially_constructible : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_constructible_v = std::is_pod_v; + inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible::value; #endif //*************************************************************************** /// is_trivially_copy_constructible ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; +#else template struct is_trivially_copy_constructible : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_constructible_v = std::is_pod_v; + inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible::value; #endif //*************************************************************************** /// is_trivially_destructible ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_destructible : std::is_trivially_destructible {}; +#else template struct is_trivially_destructible : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_destructible_v = std::is_pod_v; + inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible::value; #endif //*************************************************************************** /// is_trivially_copy_assignable ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; +#else template struct is_trivially_copy_assignable : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_assignable_v = std::is_pod_v; + inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable::value; #endif //*************************************************************************** /// is_trivially_copyable ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_copyable : std::is_trivially_copyable {}; +#else template struct is_trivially_copyable : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copyable_v = std::is_pod_v; + inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable::value; #endif #endif diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index e51a839e..281b94bf 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -1136,51 +1136,71 @@ namespace etl //*************************************************************************** /// is_trivially_constructible ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_constructible : std::is_trivially_constructible {}; +#else template struct is_trivially_constructible : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_constructible_v = std::is_pod_v; + inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible::value; #endif //*************************************************************************** /// is_trivially_copy_constructible ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; +#else template struct is_trivially_copy_constructible : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_constructible_v = std::is_pod_v; + inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible::value; #endif //*************************************************************************** /// is_trivially_destructible ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_destructible : std::is_trivially_destructible {}; +#else template struct is_trivially_destructible : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_destructible_v = std::is_pod_v; + inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible::value; #endif //*************************************************************************** /// is_trivially_copy_assignable ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; +#else template struct is_trivially_copy_assignable : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_assignable_v = std::is_pod_v; + inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable::value; #endif //*************************************************************************** /// is_trivially_copyable ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + template struct is_trivially_copyable : std::is_trivially_copyable {}; +#else template struct is_trivially_copyable : std::is_pod {}; +#endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copyable_v = std::is_pod_v; + inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable::value; #endif #endif diff --git a/include/etl/vector.h b/include/etl/vector.h index b1ee244c..81ce56e3 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -1297,9 +1297,7 @@ namespace etl ETL_OVERRIDE #endif { - #if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED ETL_ASSERT(etl::is_trivially_copyable::value, ETL_ERROR(etl::vector_incompatible_type)); - #endif etl::ivector::repair_buffer(buffer); } @@ -1468,9 +1466,7 @@ namespace etl ETL_OVERRIDE #endif { -#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED ETL_ASSERT(etl::is_trivially_copyable::value, ETL_ERROR(etl::vector_incompatible_type)); -#endif etl::ivector::repair_buffer(this->p_buffer); } From 81bba3cc31f5c26da356f204c45ad65aab99bfce Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 29 Jun 2021 09:55:12 +0100 Subject: [PATCH 5/5] Updated Arduino examples --- .gitignore | 3 +++ arduino/create_arduino_library.py | 4 ++-- .../Example_0_import_etl.ino | 12 ++++++++++++ .../Example_Vector_1_simple_use.ino | 14 ++++++++++---- .../Example_0_import_etl.ino | 10 ---------- test/vs2019/etl.vcxproj | 2 ++ test/vs2019/etl.vcxproj.filters | 18 ++++++++++++++++++ 7 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 arduino/examples/Example_0_import_etl/Example_0_import_etl.ino rename {arduino_examples => arduino/examples}/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino (86%) delete mode 100644 arduino_examples/Example_0_import_etl/Example_0_import_etl.ino diff --git a/.gitignore b/.gitignore index 98dcbb02..cb627492 100644 --- a/.gitignore +++ b/.gitignore @@ -312,3 +312,6 @@ test/sanity-check/c++17/cmake_install.cmake test/sanity-check/c++17/CMakeCache.txt test/sanity-check/c++17/libt17.a test/sanity-check/c++17/Makefile +test/vs2019/Debug LLVM +test/vs2019/DebugLLVMNoSTL +test/vs2019/DebugNoSTL diff --git a/arduino/create_arduino_library.py b/arduino/create_arduino_library.py index 97924e7f..f7c7c7e9 100644 --- a/arduino/create_arduino_library.py +++ b/arduino/create_arduino_library.py @@ -28,7 +28,7 @@ include_dir = os.path.join(etl_dir, 'include') print('include_dir = ', include_dir) # Get the ETL arduino_examples folder -arduino_examples_dir = os.path.join(etl_dir, 'arduino_examples') +arduino_examples_dir = os.path.join(arduino_dir, 'examples') print('examples_dir = ', arduino_examples_dir) # Get the root folder of both repositories @@ -84,7 +84,7 @@ print('') # Copy the ETL arduino_examples source = arduino_examples_dir destination = etl_arduino_examples_dir -print('Copy the ETL examples_arduino') +print('Copy the ETL Arduino examples') print(' From :', source) print(' To :', destination) shutil.copytree(source, destination, dirs_exist_ok = True) diff --git a/arduino/examples/Example_0_import_etl/Example_0_import_etl.ino b/arduino/examples/Example_0_import_etl/Example_0_import_etl.ino new file mode 100644 index 00000000..24fa24a4 --- /dev/null +++ b/arduino/examples/Example_0_import_etl/Example_0_import_etl.ino @@ -0,0 +1,12 @@ +#include "Embedded_Template_Library.h" // This is required for any more etl import when using Arduino IDE + +void setup() +{ + +} + + +void loop() +{ + +} diff --git a/arduino_examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino b/arduino/examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino similarity index 86% rename from arduino_examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino rename to arduino/examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino index a0c92fc1..a707ce89 100644 --- a/arduino_examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino +++ b/arduino/examples/Vector_Examples/Example_Vector_1_simple_use/Example_Vector_1_simple_use.ino @@ -2,17 +2,22 @@ #include "etl/vector.h" template -void print_vector(etl::ivector const & vec_in){ +void print_vector(etl::ivector const & vec_in) +{ Serial.print(F("print vector content | size ")); Serial.print(vec_in.size()); Serial.print(F(" | capacity ")); Serial.println(vec_in.capacity()); Serial.print(F("content | ")); - for (T const & elem : vec_in) { + + for (T const & elem : vec_in) + { Serial.print(elem); Serial.print(F(" | ")); } + Serial.println(); } -void setup(){ +void setup() +{ Serial.begin(115200); delay(100); Serial.println(F("booted")); @@ -32,6 +37,7 @@ void setup(){ print_vector(vec_int); } -void loop(){ +void loop() +{ } diff --git a/arduino_examples/Example_0_import_etl/Example_0_import_etl.ino b/arduino_examples/Example_0_import_etl/Example_0_import_etl.ino deleted file mode 100644 index d208c463..00000000 --- a/arduino_examples/Example_0_import_etl/Example_0_import_etl.ino +++ /dev/null @@ -1,10 +0,0 @@ -#include "Embedded_Template_Library.h" // this is required for any more etl import when using Arduino IDE - -void setup(){ - -} - - -void loop(){ - -} diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index 102055ea..6c70ddf5 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -4982,6 +4982,8 @@ + + diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index 46c2f34d..cd5ef18a 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -106,6 +106,18 @@ {562466b5-677d-4448-9e9e-f70805cd71ad} + + {1d6ea286-57ad-4960-9343-9d2376087b24} + + + {5eace791-3e53-4205-a04d-2aba3bac6b47} + + + {2b770849-325e-4ec5-a7f3-9a192cd40dca} + + + {0e4d2126-b9b7-4eef-b5ca-18363b1e01ce} + @@ -2614,6 +2626,12 @@ Source Files\Scripts + + ETL\Arduino\Examples\Example_0_import_etl + + + ETL\Arduino\Examples\Vector_Examples\Example_Vector_1_simple_use +