对于不同类型的变量,这里定义了其最大最小值来提供给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. JQuery攻略(三)数组与字符串

    在上两章,JQuery攻略(一) 基础知识——选择器 与 DOM 和 JQuery攻略(二) Jquery手册 我们为后面的章节打好了基础,在这一章节中,我们继续. 在这一章节中,我们记录的是JQue ...

  2. Android中的输入法

    提起输入法我就想到了Edittext,输入法可以自动根据inputType来改变键盘的布局,在支付钱包中还特别隐藏的系统自带的输入法,直接让用户用软件自己的输入法,提高了安全性.所以,我们应该对输入法 ...

  3. Node.js SDK与fabric链码交互开发

    1.本篇背景 前面已经对链码开发作了比较详细的介绍,并且对官方提供的 fabcar 链码进行了解读,本篇将介绍如何使用 Node.js SDK 与区块链网络中的链码进行交互. 本篇内容基本来自官方 H ...

  4. CPLUSPLUS 获得 一个源文件的头文件依赖。即该文件所需要的所有头文件

    核心命令:gcc -M *.h.*.cpp 转: 自动处理头文件的依赖关系 http://blog.csdn.net/su_ocean16/article/details/5374696 现在我们的M ...

  5. 混沌分形之逻辑斯蒂(Logistic)映射系统

    前几天,有个同事看到我生成的一幅逻辑斯蒂分岔图像后,问我:“这是咪咪吗?”我回答:“淫者见淫.”好吧,这里将生成几种分岔映射图形,包括逻辑斯蒂映射系统,正弦映射系统和曼德勃罗映射系统.实际上这几种图形 ...

  6. android获取sd卡路径方法

    public String getSDPath(){  File sdDir = null;  boolean sdCardExist = Environment.getExternalStorage ...

  7. linux服务器上面部署ShowDoc 安装Composer

    1.安装Composer Composer 是 PHP 的一个依赖管理工具,功能上类似于Java 的 Maven,Python 的 pip,Ruby的 gem,Nodejs 的 npm.详细介绍可参考 ...

  8. 基于PU-Learning的恶意URL检测

    https://xz.aliyun.com/t/2190 Ya-Lin Zhang, Longfei Li, Jun Zhou, Xiaolong Li, Yujiang Liu, Yuanchao ...

  9. C# Winform 未能加载文件或程序集"System.Data.SQLite"或它的某一个依赖项。试图加载格式不正确的程序

    在使用Winform 开发了一个小软件,其中使用了SQLite作为数据库 但在我的Win7 64位系统上却出现了以下错误: System.BadImageFormatException: 未能加载文件 ...

  10. Eclipse 文件太长,导致着色异常问题

    1. 把C/C++ ->Editor->Scalability, 对应红框中的数字调大.