!Compile: header and meta::naming rework in the rest of lib
This commit is contained in:
parent
031349a44d
commit
1ac1e0bf73
@ -21,10 +21,10 @@
|
||||
#ifndef __utl_com_1wire_h__
|
||||
#define __utl_com_1wire_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/com/_1wire_id.h>
|
||||
#include <utl/meta/meta.h>
|
||||
|
||||
|
||||
namespace utl {
|
||||
@ -681,27 +681,27 @@ namespace _1wire_i_det {
|
||||
|
||||
//! Primary template to catch any non 1-wire interface types
|
||||
template <typename _Tp, typename =void>
|
||||
struct is_1wire_ : false_ {};
|
||||
struct is_1wire_ : meta::false_ {};
|
||||
|
||||
//! template to catch a proper 1-wire interface type
|
||||
template <typename _Tp>
|
||||
struct is_1wire_ <_Tp,
|
||||
void_t <
|
||||
meta::void_t <
|
||||
// typename _Tp::Speed,
|
||||
// typename _Tp::Command,
|
||||
use_if_same_t <try_reset_t <_Tp>, bool>,
|
||||
use_if_same_t <try_rx1_t <_Tp>, byte_t>,
|
||||
//use_if_same_t <try_rx2_t <_Tp>, size_t>,
|
||||
use_if_same_t <try_tx1_t <_Tp>, byte_t>,
|
||||
//use_if_same_t <try_tx2_t <_Tp>, size_t>,
|
||||
use_if_same_t <try_match_t<_Tp>, void>,
|
||||
use_if_same_t <try_match_n_ovdr_t<_Tp>, void>,
|
||||
use_if_same_t <try_skip_t<_Tp>, void>,
|
||||
use_if_same_t <try_skip_n_ovdr_t<_Tp>, void>,
|
||||
use_if_same_t <try_first_t <_Tp>, _1wire_id_t>,
|
||||
use_if_same_t <try_next_t <_Tp>, _1wire_id_t>
|
||||
meta::use_if_same_t <try_reset_t <_Tp>, bool>,
|
||||
meta::use_if_same_t <try_rx1_t <_Tp>, byte_t>,
|
||||
//meta::use_if_same_t <try_rx2_t <_Tp>, size_t>,
|
||||
meta::use_if_same_t <try_tx1_t <_Tp>, byte_t>,
|
||||
//meta::use_if_same_t <try_tx2_t <_Tp>, size_t>,
|
||||
meta::use_if_same_t <try_match_t<_Tp>, void>,
|
||||
meta::use_if_same_t <try_match_n_ovdr_t<_Tp>, void>,
|
||||
meta::use_if_same_t <try_skip_t<_Tp>, void>,
|
||||
meta::use_if_same_t <try_skip_n_ovdr_t<_Tp>, void>,
|
||||
meta::use_if_same_t <try_first_t <_Tp>, _1wire_id_t>,
|
||||
meta::use_if_same_t <try_next_t <_Tp>, _1wire_id_t>
|
||||
> //!^ SFINAE may apply
|
||||
> : true_ {};
|
||||
> : meta::true_ {};
|
||||
} // namespace _1wire_i_det
|
||||
|
||||
/*!
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef __utl_com_1wire_id_h__
|
||||
#define __utl_com_1wire_id_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/container/id.h>
|
||||
|
||||
namespace utl {
|
||||
|
@ -29,8 +29,8 @@
|
||||
#ifndef __utl_com_1wire_uart_h__
|
||||
#define __utl_com_1wire_uart_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/com/_1wire.h>
|
||||
|
||||
namespace utl {
|
||||
|
@ -21,9 +21,9 @@
|
||||
#ifndef _utl_com_i2c_h__
|
||||
#define _utl_com_i2c_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/meta/meta.h>
|
||||
|
||||
namespace utl {
|
||||
|
||||
@ -254,21 +254,21 @@ namespace utl {
|
||||
|
||||
//! Primary template to catch any non I2C interface types
|
||||
template <typename _Tp, typename =void>
|
||||
struct is_i2c_ : false_ { };
|
||||
struct is_i2c_ : meta::false_ { };
|
||||
|
||||
//! template to catch a proper I2C interface type
|
||||
template <typename _Tp>
|
||||
struct is_i2c_ <_Tp,
|
||||
void_t <
|
||||
meta::void_t <
|
||||
typename _Tp::Sequence,
|
||||
use_if_same_t <uint32_t,try_cclk_t <_Tp>>,
|
||||
use_if_same_t <void, try_clk_t <_Tp>>,
|
||||
use_if_same_t <void, try_start_t <_Tp>>,
|
||||
use_if_same_t <void, try_stop_t <_Tp>>,
|
||||
use_if_same_t <byte_t, try_rx_data_t <_Tp>>,
|
||||
use_if_same_t <bool, try_tx_data_t <_Tp>>
|
||||
meta::use_if_same_t <uint32_t,try_cclk_t <_Tp>>,
|
||||
meta::use_if_same_t <void, try_clk_t <_Tp>>,
|
||||
meta::use_if_same_t <void, try_start_t <_Tp>>,
|
||||
meta::use_if_same_t <void, try_stop_t <_Tp>>,
|
||||
meta::use_if_same_t <byte_t, try_rx_data_t <_Tp>>,
|
||||
meta::use_if_same_t <bool, try_tx_data_t <_Tp>>
|
||||
>
|
||||
> : true_ { };
|
||||
> : meta::true_ { };
|
||||
}
|
||||
/*!
|
||||
* Value meta-programming function alias for I2C interface checking
|
||||
|
@ -22,8 +22,8 @@
|
||||
#ifndef __utl_com_i2c_bb_h__
|
||||
#define __utl_com_i2c_bb_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/com/i2c.h>
|
||||
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
#ifndef _utl_com_spi_h__
|
||||
#define _utl_com_spi_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/meta/meta.h>
|
||||
|
||||
namespace utl {
|
||||
|
||||
@ -302,19 +302,19 @@ namespace utl {
|
||||
|
||||
//! Primary template to catch any non SPI interface types
|
||||
template <typename _Tp, typename =void>
|
||||
struct is_spi_ : false_ {};
|
||||
struct is_spi_ : meta::false_ {};
|
||||
|
||||
//! template to catch a proper SPI interface type
|
||||
template <typename _Tp>
|
||||
struct is_spi_ <
|
||||
_Tp,
|
||||
void_t <
|
||||
use_if_same_t <try_cclock_t<_Tp>, uint32_t>,
|
||||
use_if_same_t <try_clock_t<_Tp>, void>,
|
||||
use_if_same_t <try_tx_t<_Tp>, byte_t>,
|
||||
use_if_same_t <try_rx_t<_Tp>, byte_t>
|
||||
meta::void_t <
|
||||
meta::use_if_same_t <try_cclock_t<_Tp>, uint32_t>,
|
||||
meta::use_if_same_t <try_clock_t<_Tp>, void>,
|
||||
meta::use_if_same_t <try_tx_t<_Tp>, byte_t>,
|
||||
meta::use_if_same_t <try_rx_t<_Tp>, byte_t>
|
||||
>
|
||||
> : true_ {};
|
||||
> : meta::true_ {};
|
||||
}
|
||||
/*!
|
||||
* Value meta-programming function for SPI interface checking
|
||||
|
@ -22,10 +22,10 @@
|
||||
#ifndef __utl_com_spi_bb_h__
|
||||
#define __utl_com_spi_bb_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/com/spi.h>
|
||||
#include <utl/meta/meta.h>
|
||||
|
||||
|
||||
namespace utl {
|
||||
@ -75,9 +75,9 @@ namespace utl {
|
||||
//! \name SPI implementation specific functions
|
||||
//!@{
|
||||
template <spi::bitOrder B =BitOrder> constexpr
|
||||
use_if_t <(B == spi::bitOrder::LSB_First), void> shift (byte_t& b) { b <<=1; }
|
||||
meta::use_if_t <(B == spi::bitOrder::LSB_First), void> shift (byte_t& b) { b <<=1; }
|
||||
template <spi::bitOrder B =BitOrder> constexpr
|
||||
use_if_t <(B == spi::bitOrder::MSB_First), void> shift (byte_t& b) { b >>=1; }
|
||||
meta::use_if_t <(B == spi::bitOrder::MSB_First), void> shift (byte_t& b) { b >>=1; }
|
||||
template <spi::cpol C =CPOL> static constexpr bool clkHigh () {
|
||||
return !static_cast<bool>(C);
|
||||
}
|
||||
@ -113,9 +113,9 @@ namespace utl {
|
||||
byte_t _tx_data (byte_t out) { return _tx_data_impl (out); }
|
||||
|
||||
template <spi::cpha C =CPHA>
|
||||
use_if_t <(C == spi::cpha::LOW), byte_t> _tx_data_impl (byte_t out);
|
||||
meta::use_if_t <(C == spi::cpha::LOW), byte_t> _tx_data_impl (byte_t out);
|
||||
template <spi::cpha C =CPHA>
|
||||
use_if_t <(C == spi::cpha::HIGH), byte_t> _tx_data_impl (byte_t out);
|
||||
meta::use_if_t <(C == spi::cpha::HIGH), byte_t> _tx_data_impl (byte_t out);
|
||||
//!@}
|
||||
|
||||
//! Data members
|
||||
@ -134,7 +134,7 @@ namespace utl {
|
||||
*/
|
||||
template <typename impl_t, spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
|
||||
template <spi::cpha C>
|
||||
use_if_t <(C == spi::cpha::LOW), byte_t>
|
||||
meta::use_if_t <(C == spi::cpha::LOW), byte_t>
|
||||
spi_bb_i<impl_t, CPOL, CPHA, BitOrder>::_tx_data_impl (byte_t out) {
|
||||
byte_t in {};
|
||||
SCLK (clkL_);
|
||||
@ -158,7 +158,7 @@ namespace utl {
|
||||
*/
|
||||
template <typename impl_t, spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
|
||||
template <spi::cpha C>
|
||||
use_if_t <(C == spi::cpha::HIGH), byte_t>
|
||||
meta::use_if_t <(C == spi::cpha::HIGH), byte_t>
|
||||
spi_bb_i<impl_t, CPOL, CPHA, BitOrder>::_tx_data_impl (byte_t out) {
|
||||
byte_t in {};
|
||||
SCLK (clkL_);
|
||||
@ -207,9 +207,9 @@ namespace utl {
|
||||
//! \name SPI implementation specific functions
|
||||
//!@{
|
||||
template <spi::bitOrder B =BitOrder> constexpr
|
||||
use_if_t <(B == spi::bitOrder::LSB_First), void> shift (byte_t& b) { b <<=1; }
|
||||
meta::use_if_t <(B == spi::bitOrder::LSB_First), void> shift (byte_t& b) { b <<=1; }
|
||||
template <spi::bitOrder B =BitOrder> constexpr
|
||||
use_if_t <(B == spi::bitOrder::MSB_First), void> shift (byte_t& b) { b >>=1; }
|
||||
meta::use_if_t <(B == spi::bitOrder::MSB_First), void> shift (byte_t& b) { b >>=1; }
|
||||
template <spi::cpol C =CPOL> static constexpr bool clkHigh () {
|
||||
return !static_cast<bool>(C);
|
||||
}
|
||||
@ -241,9 +241,9 @@ namespace utl {
|
||||
byte_t _tx_data (byte_t out) final { return _tx_data_impl (out); }
|
||||
|
||||
template <spi::cpha C =CPHA>
|
||||
use_if_t <(C == spi::cpha::LOW), byte_t> _tx_data_impl (byte_t out);
|
||||
meta::use_if_t <(C == spi::cpha::LOW), byte_t> _tx_data_impl (byte_t out);
|
||||
template <spi::cpha C =CPHA>
|
||||
use_if_t <(C == spi::cpha::HIGH), byte_t> _tx_data_impl (byte_t out);
|
||||
meta::use_if_t <(C == spi::cpha::HIGH), byte_t> _tx_data_impl (byte_t out);
|
||||
//!@}
|
||||
|
||||
//! Data members
|
||||
@ -262,7 +262,7 @@ namespace utl {
|
||||
*/
|
||||
template <spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
|
||||
template <spi::cpha C>
|
||||
use_if_t <(C == spi::cpha::LOW), byte_t>
|
||||
meta::use_if_t <(C == spi::cpha::LOW), byte_t>
|
||||
spi_bb_i<virtual_tag, CPOL, CPHA, BitOrder>::_tx_data_impl (byte_t out) {
|
||||
byte_t in {};
|
||||
SCLK (clkL_);
|
||||
@ -286,7 +286,7 @@ namespace utl {
|
||||
*/
|
||||
template <spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
|
||||
template <spi::cpha C>
|
||||
use_if_t <(C == spi::cpha::HIGH), byte_t>
|
||||
meta::use_if_t <(C == spi::cpha::HIGH), byte_t>
|
||||
spi_bb_i<virtual_tag, CPOL, CPHA, BitOrder>::_tx_data_impl (byte_t out) {
|
||||
byte_t in {};
|
||||
SCLK (clkL_);
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef __utl_container_array_h__
|
||||
#define __utl_container_array_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace utl {
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __utl_container_id_h__
|
||||
#define __utl_container_id_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/container/array.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef __utl_impl_crtp_h__
|
||||
#define __utl_impl_crtp_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/core/impl.h>
|
||||
|
||||
/*!
|
||||
* \defgroup crtp CRTP idiom support header
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* \file /utl/impl/impl.h
|
||||
* \brief Implementation detail main header
|
||||
* \file /utl/core/impl.h
|
||||
* \brief Implementation detail main forward header
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
@ -18,17 +18,13 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef __utl_impl_impl_h__
|
||||
#define __utl_impl_impl_h__
|
||||
#ifndef __utl_core_impl_h__
|
||||
#define __utl_core_impl_h__
|
||||
|
||||
|
||||
// Include implementation details once
|
||||
#include <utl/impl/version.h>
|
||||
#include <utl/impl/concepts.h>
|
||||
#include <utl/impl/types.h>
|
||||
|
||||
// STL dependency
|
||||
#include <type_traits>
|
||||
// FWD include implementation details once
|
||||
#include <utl/core/version.h>
|
||||
#include <utl/core/types.h>
|
||||
|
||||
|
||||
#endif /* __utl_impl_impl_h__ */
|
||||
#endif /* __utl_core_impl_h__ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* \file /utl/impl/types.h
|
||||
* \file /utl/core/types.h
|
||||
* \brief Basic type alias support
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
@ -18,15 +18,25 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef __utl_impl_types_h__
|
||||
#define __utl_impl_types_h__
|
||||
#ifndef __utl_core_types_h__
|
||||
#define __utl_core_types_h__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace utl {
|
||||
//! @{ \name byte and word types
|
||||
using byte_t = uint8_t; //!< 8 bits wide
|
||||
using word_t = uint16_t; //!< 16 bits wide
|
||||
using dword_t = uint32_t; //!< 32 bits wide
|
||||
//! @}
|
||||
|
||||
typedef uint8_t byte_t; /*!< 8 bits wide */
|
||||
typedef uint16_t word_t; /*!< 16 bits wide */
|
||||
typedef uint32_t dword_t; /*!< 32 bits wide */
|
||||
//! @{ \name size and index
|
||||
using size_t = std::size_t;
|
||||
using index_t = size_t; //!< index_t and size_t mend to be interchangeable
|
||||
|
||||
using ptrdiff_t= std::ptrdiff_t;
|
||||
//! @}
|
||||
}
|
||||
|
||||
#endif /* __utl_impl_types_h__ */
|
||||
#endif /* __utl_core_types_h__ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* \file /utl/impl/version.h
|
||||
* \brief version and cpp version check
|
||||
* \file /utl/core/version.h
|
||||
* \brief version and cpp version checks
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
@ -18,23 +18,88 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef __utl_impl_version_h__
|
||||
#define __utl_impl_version_h__
|
||||
#ifndef __utl_core_version_h__
|
||||
#define __utl_core_version_h__
|
||||
|
||||
//!\defgroup version version
|
||||
//! Definitions of the utl version
|
||||
//!\ingroup impl
|
||||
//!@{
|
||||
|
||||
#define UTL_VERSION "0.0.0"
|
||||
//! utl version
|
||||
#define UTL_VERSION "0.0.1"
|
||||
#define UTL_VERSION_MAJOR 0
|
||||
#define UTL_VERSION_MINOR 0
|
||||
#define UTL_VERSION_PATCH 0
|
||||
#define UTL_VERSION_PATCH 1
|
||||
#define UTL_VERSION_VALUE ( (UTL_VERSION_MAJOR * 10000) \
|
||||
+ (UTL_VERSION_MINOR * 100) \
|
||||
+ UTL_VERSION_PATCH)
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
//! C++ versions
|
||||
#define CXX_VER __cplusplus
|
||||
#define CXX_VER_STD_11 201103L
|
||||
#define CXX_VER_STD_14 201402L
|
||||
#define CXX_VER_STD_17 201703L
|
||||
|
||||
//#include <type_traits>
|
||||
|
||||
//! Check for variable templates
|
||||
#ifndef CXX_VARIABLE_TEMPLATES
|
||||
#ifdef __cpp_variable_templates
|
||||
#define CXX_VARIABLE_TEMPLATES __cpp_variable_templates
|
||||
#else
|
||||
#define CXX_VARIABLE_TEMPLATES (CXX_VER >= CXX_VER_STD_14)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! Check integer sequence
|
||||
#ifndef CXX_INTEGER_SEQUENCE
|
||||
#ifdef __cpp_lib_integer_sequence
|
||||
#define CXX_INTEGER_SEQUENCE __cpp_lib_integer_sequence
|
||||
#else
|
||||
#define CXX_INTEGER_SEQUENCE (CXX_VER >= CXX_VER_STD_14)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! Check concepts
|
||||
#ifndef CXX_CONCEPTS
|
||||
#ifdef __cpp_concepts
|
||||
#define CXX_CONCEPTS __cpp_concepts
|
||||
#else
|
||||
#define CXX_CONCEPTS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! Check for inline variables
|
||||
#ifndef CXX_INLINE_VARIABLES
|
||||
#ifdef __cpp_inline_variables
|
||||
#define CXX_INLINE_VARIABLES __cpp_inline_variables
|
||||
#else
|
||||
#define CXX_INLINE_VARIABLES (CXX_VER >= CXX_VER_STD_17)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CXX_FOLD_EXPRESSIONS
|
||||
#ifdef __cpp_fold_expressions
|
||||
#define CXX_FOLD_EXPRESSIONS __cpp_fold_expressions
|
||||
#else
|
||||
#define CXX_FOLD_EXPRESSIONS (CXX_VER >= CXX_VER_STD_17)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Workaround inspection
|
||||
*/
|
||||
#if defined(__GNUC__) && (__GNUC__ < 5)
|
||||
// https://wg21.link/cwg1558
|
||||
#define UTL_WORKAROUND_CWG_1558
|
||||
#endif
|
||||
|
||||
|
||||
//! Base library requirement
|
||||
#if __cplusplus < CXX_VER_STD_11
|
||||
#error "uTL requires C++11"
|
||||
#endif
|
||||
|
||||
#endif /* __utl_impl_version_h__ */
|
||||
//!@}
|
||||
#endif /* #ifndef __utl_core_version_h__ */
|
||||
|
@ -278,23 +278,23 @@ namespace utl {
|
||||
|
||||
//! Primary template to catch any non SPI interface types
|
||||
template <typename _Tp, typename =void>
|
||||
struct is_outdev_it_ : false_ {};
|
||||
struct is_outdev_it_ : meta::false_ {};
|
||||
|
||||
//! template to catch a proper SPI interface type
|
||||
template <typename _Tp>
|
||||
struct is_outdev_it_ <
|
||||
_Tp,
|
||||
void_t <
|
||||
typename T::value_type,
|
||||
typename T::difference_type,
|
||||
typename T::pointer,
|
||||
typename T::reference,
|
||||
use_if_same_t <
|
||||
typename T::iterator_category,
|
||||
meta::void_t <
|
||||
typename _Tp::value_type,
|
||||
typename _Tp::difference_type,
|
||||
typename _Tp::pointer,
|
||||
typename _Tp::reference,
|
||||
meta::use_if_same_t <
|
||||
typename _Tp::iterator_category,
|
||||
std::output_iterator_tag
|
||||
>
|
||||
>
|
||||
> : true_ {};
|
||||
> : meta::true_ {};
|
||||
}
|
||||
/*!
|
||||
* Value meta-programming function for SPI interface checking
|
||||
@ -525,23 +525,23 @@ namespace utl {
|
||||
|
||||
//! Primary template to catch any non SPI interface types
|
||||
template <typename _Tp, typename =void>
|
||||
struct is_indev_it_ : false_ {};
|
||||
struct is_indev_it_ : meta::false_ {};
|
||||
|
||||
//! template to catch a proper SPI interface type
|
||||
template <typename _Tp>
|
||||
struct is_indev_it_ <
|
||||
_Tp,
|
||||
void_t <
|
||||
typename T::value_type,
|
||||
typename T::difference_type,
|
||||
typename T::pointer,
|
||||
typename T::reference,
|
||||
use_if_same_t <
|
||||
typename T::iterator_category,
|
||||
meta::void_t <
|
||||
typename _Tp::value_type,
|
||||
typename _Tp::difference_type,
|
||||
typename _Tp::pointer,
|
||||
typename _Tp::reference,
|
||||
meta::use_if_same_t <
|
||||
typename _Tp::iterator_category,
|
||||
std::input_iterator_tag
|
||||
>
|
||||
>
|
||||
> : true_ {};
|
||||
> : meta::true_ {};
|
||||
}
|
||||
/*!
|
||||
* Value meta-programming function for SPI interface checking
|
||||
@ -821,23 +821,23 @@ namespace utl {
|
||||
|
||||
//! Primary template to catch any non SPI interface types
|
||||
template <typename _Tp, typename =void>
|
||||
struct is_idxdev_it_ : false_ {};
|
||||
struct is_idxdev_it_ : meta::false_ {};
|
||||
|
||||
//! template to catch a proper SPI interface type
|
||||
template <typename _Tp>
|
||||
struct is_idxdev_it_ <
|
||||
_Tp,
|
||||
void_t <
|
||||
typename T::value_type,
|
||||
typename T::difference_type,
|
||||
typename T::pointer,
|
||||
typename T::reference,
|
||||
use_if_same_t <
|
||||
typename T::iterator_category,
|
||||
meta::void_t <
|
||||
typename _Tp::value_type,
|
||||
typename _Tp::difference_type,
|
||||
typename _Tp::pointer,
|
||||
typename _Tp::reference,
|
||||
meta::use_if_same_t <
|
||||
typename _Tp::iterator_category,
|
||||
std::input_iterator_tag
|
||||
>
|
||||
>
|
||||
> : true_ {};
|
||||
> : meta::true_ {};
|
||||
}
|
||||
/*!
|
||||
* Value meta-programming function for SPI interface checking
|
||||
|
@ -22,10 +22,10 @@
|
||||
#ifndef __utl_dev_idx_dev_h__
|
||||
#define __utl_dev_idx_dev_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/dev/dev_iterators.h>
|
||||
#include <utl/meta/meta.h>
|
||||
|
||||
namespace utl {
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
#ifndef __utl_dev_in_dev_h__
|
||||
#define __utl_dev_in_dev_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/dev/dev_iterators.h>
|
||||
#include <utl/meta/meta.h>
|
||||
|
||||
namespace utl {
|
||||
|
||||
|
@ -22,10 +22,10 @@
|
||||
#ifndef __utl_dev_inbuf_dev_h__
|
||||
#define __utl_dev_inbuf_dev_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/helper/crtp.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
#include <utl/core/impl.h>
|
||||
#include <utl/core/crtp.h>
|
||||
#include <utl/dev/dev_iterators.h>
|
||||
#include <utl/meta/meta.h>
|
||||
|
||||
namespace utl {
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*!
|
||||
* \file bool.h
|
||||
* \brief Template meta-programming bool integral constant
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __utl_meta_bool_h__
|
||||
#define __utl_meta_bool_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/meta/integral.h>
|
||||
|
||||
/*!
|
||||
* \ingroup meta
|
||||
* \defgroup bool
|
||||
* boolean constant type support header
|
||||
*/
|
||||
//! @{
|
||||
|
||||
namespace utl {
|
||||
|
||||
//! bool_ type
|
||||
template<bool _v>
|
||||
using bool_ = integral_<bool, _v>;
|
||||
|
||||
//! The type used as a compile-time boolean with true value.
|
||||
typedef bool_<true> true_;
|
||||
|
||||
//! The type used as a compile-time boolean with false value.
|
||||
typedef bool_<false> false_;
|
||||
|
||||
}
|
||||
|
||||
//! @}
|
||||
#endif /* __utl_meta_bool_h__ */
|
@ -1,70 +0,0 @@
|
||||
/*!
|
||||
* \file utl/meta/detect.h
|
||||
* \brief Template meta-programming void helpers
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __utl_meta_detect_h__
|
||||
#define __utl_meta_detect_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/meta/sfinae.h>
|
||||
|
||||
/*!
|
||||
* \ingroup meta
|
||||
* \defgroup detect
|
||||
* Implementation of the detection idiom
|
||||
*/
|
||||
//! @{
|
||||
|
||||
namespace utl {
|
||||
|
||||
//! detection idiom (negative case).
|
||||
template <typename _Def,
|
||||
typename _AlwaysVoid,
|
||||
template<typename...> class _Op,
|
||||
typename... _Args>
|
||||
struct detector_ {
|
||||
using value_ = false_;
|
||||
using type = _Def;
|
||||
};
|
||||
|
||||
//! detection idiom (positive case).
|
||||
template <typename _Def,
|
||||
template<typename...> class _Op,
|
||||
typename... _Args>
|
||||
struct detector_ <_Def, void_t<_Op<_Args...>>, _Op, _Args...> {
|
||||
using value_ = true_;
|
||||
using type = _Op<_Args...>;
|
||||
};
|
||||
|
||||
// Detect whether _Op<_Args...> is a valid type, use _Def if not.
|
||||
template <typename _Def,
|
||||
template<typename...> class _Op,
|
||||
typename... _Args>
|
||||
using detected_or_ = detector_ <_Def, void, _Op, _Args...>;
|
||||
|
||||
// template alias
|
||||
template <typename _Def,
|
||||
template<typename...> class _Op,
|
||||
typename... _Args>
|
||||
using detected_or_t = typename detected_or_<_Def, _Op, _Args...>::type;
|
||||
|
||||
|
||||
|
||||
}
|
||||
//! @}
|
||||
#endif /* __utl_meta_detect_h__ */
|
@ -1,59 +0,0 @@
|
||||
/*!
|
||||
* \file if.h
|
||||
* \brief Template meta-programming conditional helpers
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __utl_meta_if_h__
|
||||
#define __utl_meta_if_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \ingroup meta
|
||||
* \defgroup if
|
||||
* conditional type support header
|
||||
*/
|
||||
//! @{
|
||||
namespace utl {
|
||||
|
||||
//! select _T1 or _T2 based on _Sel
|
||||
//! @{
|
||||
template <bool _Sel, typename _T1, typename _T2>
|
||||
struct select_ {
|
||||
typedef _T1 type;
|
||||
};
|
||||
|
||||
template <typename _T1, typename _T2>
|
||||
struct select_ <false, _T1, _T2> {
|
||||
typedef _T2 type;
|
||||
};
|
||||
//! @}
|
||||
|
||||
//! select _Tp if _Check is true, else SFINAE
|
||||
//! @{
|
||||
template <bool _Check, typename _Tp = void>
|
||||
struct if_ {
|
||||
typedef _Tp type;
|
||||
};
|
||||
template<typename _Tp> // Partial specialization for false.
|
||||
struct if_ <false, _Tp> { };
|
||||
|
||||
}
|
||||
|
||||
//! @}
|
||||
#endif /* __utl_meta_if_h__ */
|
@ -1,63 +0,0 @@
|
||||
/*!
|
||||
* \file void.h
|
||||
* \brief Template meta-programming void helpers
|
||||
*
|
||||
* Copyright (C) 2018 Christos Choutouridis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __utl_meta_void_h__
|
||||
#define __utl_meta_void_h__
|
||||
|
||||
#include <utl/impl/impl.h>
|
||||
#include <utl/meta/bool.h>
|
||||
|
||||
/*! \ingroup meta
|
||||
* \defgroup void
|
||||
* void_ support header
|
||||
*/
|
||||
//! @{
|
||||
|
||||
namespace utl {
|
||||
|
||||
/*!
|
||||
* Like boost::mpl we made void_ a complete type to allow it to be
|
||||
* instantiated so that it can be passed in as an object that can be
|
||||
* used to select an overloaded function.
|
||||
*/
|
||||
struct void_ {
|
||||
typedef void_ type;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct is_void_
|
||||
: false_ { };
|
||||
|
||||
template<>
|
||||
struct is_void_ <void_>
|
||||
: true_ { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct is_not_void_
|
||||
: true_ { };
|
||||
|
||||
template<>
|
||||
struct is_not_void_<void_>
|
||||
: false_ { };
|
||||
|
||||
}
|
||||
|
||||
//!@}
|
||||
|
||||
#endif /* __utl_meta_void_h__ */
|
@ -18,12 +18,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include <gtest.h>
|
||||
#include <iostream>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
GTEST_API_ int main(int argc, char **argv) {
|
||||
std::cout << "Running tests from main.cpp\n";
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include <gtest.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <utl/com/_1wire_uart.h>
|
||||
|
||||
/*!
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include <gtest.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <utl/com/i2c_bb.h>
|
||||
|
||||
/*!
|
||||
|
@ -17,9 +17,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include <gtest.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <utl/com/spi_bb.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \warning
|
||||
* This is not right way of testing communication interfaces. We have to
|
||||
|
Loading…
x
Reference in New Issue
Block a user