From 30aa1bdeccb3ac52d8a4a17cf4ea091349c923ba Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sun, 9 Mar 2014 21:50:58 +0400 Subject: [PATCH] StaticIf<> renamed to much more appropriate and widely known name - Select<> --- .../include/uavcan/internal/marshal/array.hpp | 21 ++++++++----------- .../uavcan/internal/marshal/float_spec.hpp | 6 +++--- .../uavcan/internal/marshal/integer_spec.hpp | 14 ++++++------- .../include/uavcan/util/compile_time.hpp | 6 +++--- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/libuavcan/include/uavcan/internal/marshal/array.hpp b/libuavcan/include/uavcan/internal/marshal/array.hpp index bbce37ec12..c968cf6323 100644 --- a/libuavcan/include/uavcan/internal/marshal/array.hpp +++ b/libuavcan/include/uavcan/internal/marshal/array.hpp @@ -104,14 +104,12 @@ public: * Statically allocated array with optional dynamic-like behavior */ template -class ArrayImpl : public StaticIf, - StaticArrayBase >::Result +class ArrayImpl : public Select, StaticArrayBase >::Result { typedef ArrayImpl SelfType; - typedef typename StaticIf, - StaticArrayBase >::Result Base; + typedef typename Select, StaticArrayBase >::Result Base; public: enum @@ -181,11 +179,10 @@ public: template class ArrayImpl, ArrayMode, MaxSize> : public std::bitset - , public StaticIf, StaticArrayBase >::Result + , public Select, StaticArrayBase >::Result { - typedef typename StaticIf, - StaticArrayBase >::Result ArrayBase; + typedef typename Select, StaticArrayBase >::Result ArrayBase; public: enum { IsStringLike = 0 }; @@ -527,8 +524,8 @@ public: template static void stream(Stream& s, const ArrayType& array, int level) { - typedef typename StaticIf::Result, SelectorPrimitives, + typedef typename Select::Result, SelectorPrimitives, SelectorObjects>::Result >::Result Type; genericStreamImpl(s, array, level, Type()); } diff --git a/libuavcan/include/uavcan/internal/marshal/float_spec.hpp b/libuavcan/include/uavcan/internal/marshal/float_spec.hpp index 95042b6057..6bf371d23e 100644 --- a/libuavcan/include/uavcan/internal/marshal/float_spec.hpp +++ b/libuavcan/include/uavcan/internal/marshal/float_spec.hpp @@ -19,9 +19,9 @@ template struct NativeFloatSelector { struct ErrorNoSuchFloat; - typedef typename StaticIf<(sizeof(float) * 8 >= BitLen), float, - typename StaticIf<(sizeof(double) * 8 >= BitLen), double, - typename StaticIf<(sizeof(long double) * 8 >= BitLen), long double, + typedef typename Select<(sizeof(float) * 8 >= BitLen), float, + typename Select<(sizeof(double) * 8 >= BitLen), double, + typename Select<(sizeof(long double) * 8 >= BitLen), long double, ErrorNoSuchFloat>::Result>::Result>::Result Type; }; diff --git a/libuavcan/include/uavcan/internal/marshal/integer_spec.hpp b/libuavcan/include/uavcan/internal/marshal/integer_spec.hpp index 6f051dd5d3..432e858818 100644 --- a/libuavcan/include/uavcan/internal/marshal/integer_spec.hpp +++ b/libuavcan/include/uavcan/internal/marshal/integer_spec.hpp @@ -28,10 +28,10 @@ public: enum { MaxBitLen = BitLen }; enum { IsPrimitive = 1 }; - typedef typename StaticIf<(BitLen <= 8), typename StaticIf::Result, - typename StaticIf<(BitLen <= 16), typename StaticIf::Result, - typename StaticIf<(BitLen <= 32), typename StaticIf::Result, - typename StaticIf<(BitLen <= 64), typename StaticIf::Result, + typedef typename Select<(BitLen <= 8), typename Select::Result, + typename Select<(BitLen <= 16), typename Select::Result, + typename Select<(BitLen <= 32), typename Select::Result, + typename Select<(BitLen <= 64), typename Select::Result, ErrorNoSuchInteger>::Result>::Result>::Result>::Result StorageType; typedef typename IntegerSpec::StorageType UnsignedStorageType; @@ -59,7 +59,7 @@ private: static UnsignedStorageType mask() { return 0xFFFFFFFFFFFFFFFF; } }; - typedef typename StaticIf<(BitLen == 64), LimitsImpl64, LimitsImplGeneric>::Result Limits; + typedef typename Select<(BitLen == 64), LimitsImpl64, LimitsImplGeneric>::Result Limits; static void saturate(StorageType& value) { @@ -127,8 +127,8 @@ struct YamlStreamer > static void stream(Stream& s, const StorageType value, int) { // Get rid of character types - we want its integer representation, not ASCII code - typedef typename StaticIf<(sizeof(StorageType) >= sizeof(int)), StorageType, - typename StaticIf::Result >::Result TempType; + typedef typename Select<(sizeof(StorageType) >= sizeof(int)), StorageType, + typename Select::Result >::Result TempType; s << TempType(value); } }; diff --git a/libuavcan/include/uavcan/util/compile_time.hpp b/libuavcan/include/uavcan/util/compile_time.hpp index 48d9ca76e6..093c62f65a 100644 --- a/libuavcan/include/uavcan/util/compile_time.hpp +++ b/libuavcan/include/uavcan/util/compile_time.hpp @@ -53,16 +53,16 @@ struct EnableIfType { typedef R Type; }; template -struct StaticIf; +struct Select; template -struct StaticIf +struct Select { typedef TrueType Result; }; template -struct StaticIf +struct Select { typedef FalseType Result; };