对于不同类型的变量,这里定义了其最大最小值来提供给ACE_Utils等使用

 template <typename T> struct ACE_Numeric_Limits;

 // ------------------------------------------
// Special cases.
template<>
struct ACE_Export ACE_Numeric_Limits<char>
{
static char min (void) { return CHAR_MIN; }
static char max (void) { return CHAR_MAX; }
}; // ------------------------------------------
// Signed integers. template<>
struct ACE_Export ACE_Numeric_Limits<signed char>
{
static signed char min (void) { return SCHAR_MIN; }
static signed char max (void) { return SCHAR_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<signed short>
{
static signed short min (void) { return SHRT_MIN; }
static signed short max (void) { return SHRT_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<signed int>
{
static signed int min (void) { return INT_MIN; }
static signed int max (void) { return INT_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<signed long>
{
static signed long min (void) { return LONG_MIN; }
static signed long max (void) { return LONG_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<signed long long>
{
#if defined (LLONG_MIN)
# define ACE_LLONG_MIN LLONG_MIN
#elif defined (LONG_LONG_MIN)
# define ACE_LLONG_MIN LONG_LONG_MIN
#elif defined (LONGLONG_MIN)
# define ACE_LLONG_MIN LONGLONG_MIN
#else
# error Unable to determine minimum signed long long value.
#endif /* LLONG_MIN */ #if defined (LLONG_MAX)
# define ACE_LLONG_MAX LLONG_MAX
#elif defined (LONG_LONG_MAX)
# define ACE_LLONG_MAX LONG_LONG_MAX
#elif defined (LONGLONG_MAX)
# define ACE_LLONG_MAX LONGLONG_MAX
#else
# error Unable to determine maximum signed long long value.
#endif /* LLONG_MAX */ static signed long long min (void) { return ACE_LLONG_MIN; }
static signed long long max (void) { return ACE_LLONG_MAX; }
}; // ------------------------------------------
// Unsigned integers
template<>
struct ACE_Export ACE_Numeric_Limits<unsigned char>
{
static unsigned char min (void) { return ; }
static unsigned char max (void) { return UCHAR_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<unsigned short>
{
static unsigned short min (void) { return ; }
static unsigned short max (void) { return USHRT_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<unsigned int>
{
static unsigned int min (void) { return ; }
static unsigned int max (void) { return UINT_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<unsigned long>
{
static unsigned long min (void) { return ; }
static unsigned long max (void) { return ULONG_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<unsigned long long>
{
static unsigned long long min (void) { return ; }
static unsigned long long max (void)
{
# if defined (ULLONG_MAX)
return ULLONG_MAX;
# elif defined (ULONGLONG_MAX)
return ULONGLONG_MAX;
# else
# error Unable to determine maximum unsigned long long value.
# endif /* ULLONG_MAX */
}
}; // ------------------------------------------
// Floating point types template<>
struct ACE_Export ACE_Numeric_Limits<float>
{
static float min (void) { return FLT_MIN; }
static float max (void) { return FLT_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<double>
{
static double min (void) { return DBL_MIN; }
static double max (void) { return DBL_MAX; }
}; template<>
struct ACE_Export ACE_Numeric_Limits<long double>
{
static long double min (void) { return LDBL_MIN; }
static long double max (void) { return LDBL_MAX; }
}; #else // std::numeric_limits<> has all of the necessary specializations.
// Just wrap it. template <typename T>
struct ACE_Numeric_Limits
{
static T min (void) { return std::numeric_limits<T>::min (); }
static T max (void) { return std::numeric_limits<T>::max (); }
}; # if (defined (ACE_WIN64) && defined (_MSC_VER) && _MSC_VER <= ) \
|| defined (ACE_LACKS_NUMERIC_LIMITS_64_BIT_TYPES)
// The Microsoft Platform SDK does not provide std::numeric_limits<>
// specializations for 64 bit integers so we need to explicitly provide
// ACE_Numeric_Limits<> specializations to compensate for this
// deficiency.
//
// Unfortunately there is no way to tell if the platform SDK is being
// used so we specialize for the ACE_WIN64 + MSVC++ 7.1 case, which is
// the configuration that exhibits this problem. It also happens to
// be a fairly isolated configuration since 64-bit support in MSVC++
// 7.1 was not very good to begin with.
template<>
struct ACE_Numeric_Limits<LONGLONG>
{
static LONGLONG min (void) { return _I64_MIN; }
static LONGLONG max (void) { return _I64_MAX; }
}; template<>
struct ACE_Numeric_Limits<ULONGLONG>
{
static ULONGLONG min (void) { return ; }
static ULONGLONG max (void) { return _UI64_MAX; }
};
# endif /* ACE_WIN64 && _MSC_VER <= 1310 */

ACE中对于不同类型数据的最大值最小值管理ACE_Numeric_Limits的更多相关文章

  1. asp.net mvc视图中使用entitySet类型数据时提示出错

    asp.net mvc5视图中使用entitySet类型数据时提示以下错误 检查了一下引用,发现已经引用了System.Data.Linq了,可是还是一直提示出错, 后来发现还需要在Views文件夹下 ...

  2. 【Spring】SpringMVC中浅析Date类型数据的传递

    在控制器中加入如下代码: @InitBinder public void initBinder(ServletRequestDataBinder bin){ SimpleDateFormat sdf ...

  3. 关于数据库中varchar/nvarchar类型数据的获取注意事项

    当在页面后台获取数据库表中某字段的数据时,需注意该数据的类型.防止因实际数据的字符长度因达不到指定数据类型规定的字符长度而导致空格的占位符. 比如: MSSQL中某一表的结构如下:   表中的数据: ...

  4. C#中的double类型数据向SQL sqerver 存储与读取问题

    1.存储 由于double类型在SQLsever中并没有对应数据,试过对应float.real类型,发现小数位都存在四舍五入的现象,目前我使用的是decimal类型,用此类型时个人觉得小数位数应该比自 ...

  5. java通过poi读取excel中的日期类型数据或自定义类型日期

    Java 读取Excel表格日期类型数据的时候,读出来的是这样的  12-十月-2019,而Excel中输入的是 2019/10/12 或 2019-10-12 poi处理excel时,当excel没 ...

  6. 在oracle中存入date类型数据遇到的问题及其解决方法(利用java.sql.date和Timestamp)

    转自:https://blog.csdn.net/ShadowerWArden/article/details/80652377 1. 使用JDBC操作Oracle数据库时,使用java.sql.Da ...

  7. Python(Redis 中 Set/Zset 类型数据和其他操作)

    1.redis 基本操作命令 Set 操作 Set 集合就是不允许重复的列表 无序集合 sadd(name,values) 给 name 对应的集合中添加 1 个或多个元素 import redis ...

  8. Oracle数据库获取一行记录中某几个字段的最大值/最小值函数

    在数据库的开发过程中,我们可能会遇到这样的需求,获取一行记录中某几个字段的最大值或者是最小值,oracle给我们提供了解决这种需求的函数,如下所示:   greatest(col1, col2, co ...

  9. 读写SQLServer数据库中的image类型数据(简单)

    1.将double类型的数据存储于image类型的变量中: (1). char *CManualForecastResultBll::DoubleArray2Binary(std::vector< ...

随机推荐

  1. mongodb centos7上的安装

    1,下载安装包 下载mongoDB的安装文件地址:https://www.mongodb.org/downloads#production 选择Linux 64-bit legacy 版本,下载到目标 ...

  2. 《C#本质论(第4版)》

    <C#本质论(第4版)> 基本信息 作者: (美)Mark Michaelis    Eric Lippert 译者: 周靖 出版社:人民邮电出版社 ISBN:9787115336750 ...

  3. Variational Inference

    作者:孙九爷链接:https://www.zhihu.com/question/41765860/answer/101915528来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  4. verilog语法实例学习(1)

    本文档中通过verilog实例来学习verilog语法.Verilog是一种硬件描述语言,它具有并发性和时序性.并发性是指不同硬件模块的同时操作,时序性是指信号的赋值或操作在时钟的边沿进行.由于作者本 ...

  5. Home Assistant 安装Samba和SSH server 插件

    安装 Samba 插件 Samba 是 SMB/CIFS 网络协议的重新实现, 它作为 NFS 的补充使得在 Linux 和 Windows 系统中进行文件共享.打印机共享更容易实现. Smaba 服 ...

  6. 轻松搞定 easyui datagrid 二次加载的问题(转)

    对于使用url方式的初学者,经常碰到重复请求的问题,这个问题的根源是因为一旦设置了url参数,Datagrid组件在实例化的时候就会做请求,如何避免二次加载这样问题呢,个人觉得注意以下两点基本就可以防 ...

  7. jquery的$.extend和$.fn.extend作用及区别,兼它们的一些小细节

    $.extend(obj);是为了扩展jquery本身,为类添加新的方法   $.fn.extend(obj);给JQUERY对象添加方法.如(1): $.extend({ add:function( ...

  8. WINDOWS 逻辑坐标 设备坐标 屏幕坐标 客户区坐标

    转自:http://blog.csdn.net/lovesunshine2008/article/details/4048158 设置坐标映射    (1)Windows坐标系统 Windows坐标系 ...

  9. Redis集群搭建最佳实践

    要搭建Redis集群.首先得考虑以下的几个问题; Redis集群搭建的目的是什么?或者说为什么要搭建Redis集群? Redis集群搭建的目的事实上也就是集群搭建的目的.全部的集群主要都是为了解决一个 ...

  10. Direct2D教程VI——转换(Transform)

    目前博客园中成系列的Direct2D的教程有 1.万一的 Direct2D 系列,用的是Delphi 2009 2.zdd的 Direct2D 系列,用的是VS中的C++ 3.本文所在的 Direct ...