From dee32492bdb6349658d56d6a11d12bef3b7f2744 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 24 Jun 2021 18:14:25 +0100 Subject: [PATCH] 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