mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 08:33:34 +08:00
Renamed IntegerInfo to IntegerSpec, few minor naming fixes
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
enum CastMode { CastModeSaturate, CastModeTruncate };
|
||||
|
||||
}
|
||||
+5
-5
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user