Renamed IntegerInfo to IntegerSpec, few minor naming fixes

This commit is contained in:
Pavel Kirienko
2014-02-22 11:00:42 +04:00
parent 0e28a0826c
commit ac2a31b087
4 changed files with 52 additions and 35 deletions
@@ -0,0 +1,12 @@
/*
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
namespace uavcan
{
enum CastMode { CastModeSaturate, CastModeTruncate };
}
@@ -8,7 +8,7 @@
#include <limits>
#include <uavcan/internal/util.hpp>
#include <uavcan/internal/marshalling/scalar_codec.hpp>
#include <uavcan/internal/marshalling/types.hpp>
#include <uavcan/internal/marshalling/cast_mode.hpp>
namespace uavcan
{
@@ -16,7 +16,7 @@ namespace uavcan
enum Signedness { SignednessUnsigned, SignednessSigned };
template <unsigned int BitLen_, Signedness Signedness, CastMode CastMode>
class IntegerInfo
class IntegerSpec
{
enum { IsSigned = Signedness == SignednessSigned };
@@ -32,9 +32,9 @@ public:
ErrorNoSuchInteger>::Result>::Result>::Result>::Result StorageType;
private:
typedef typename IntegerInfo<BitLen, SignednessUnsigned, CastMode>::StorageType UnsignedStorageType;
typedef typename IntegerSpec<BitLen, SignednessUnsigned, CastMode>::StorageType UnsignedStorageType;
IntegerInfo() { }
IntegerSpec() { }
struct ExactSizeLimits
{
@@ -98,6 +98,6 @@ public:
};
template <CastMode CastMode>
class IntegerInfo<1, SignednessSigned, CastMode>; // Invalid instantiation
class IntegerSpec<1, SignednessSigned, CastMode>; // Invalid instantiation
}
@@ -5,20 +5,24 @@
#pragma once
#include <uavcan/internal/util.hpp>
#include <uavcan/internal/marshalling/scalar_codec.hpp>
#include <uavcan/internal/marshalling/integer_spec.hpp>
namespace uavcan
{
enum CastMode { CastModeSaturate, CastModeTruncate };
template <typename T, typename Enable = void>
struct AddStorageTypeImpl { typedef T StorageType; };
struct StorageTypeImpl { typedef T StorageType; };
template <typename T>
struct AddStorageTypeImpl<T, typename EnableIfType<typename T::StorageType>::Type> { };
struct StorageTypeImpl<T, typename EnableIfType<typename T::StorageType>::Type>
{
typedef typename T::StorageType Type;
};
template <typename T>
struct AddStorageType : public T, public AddStorageTypeImpl<T> { };
struct StorageType : public T
{
typedef typename StorageTypeImpl<T>::Type Type;
};
}