对于不同类型的变量,这里定义了其最大最小值来提供给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. Latex:多个公式使用同一个编号(右对齐)

    \usepackage{amsmath} \begin{equation}\begin{aligned}equation 1 ... \\equation 2 ... \\equation 3 ... ...

  2. 单页面应用SPA和多页面应用MPA

    单页面应用(SinglePage Web Application,SPA) 只有一张Web页面的应用,是一种从Web服务器加载的富客户端,单页面跳转仅刷新局部资源 ,公共资源(js.css等)仅需加载 ...

  3. Netty 中 IOException: Connection reset by peer 与 java.nio.channels.ClosedChannelException: null

    最近发现系统中出现了很多 IOException: Connection reset by peer 与 ClosedChannelException: null 深入看了看代码, 做了些测试, 发现 ...

  4. 【手机网络游戏 编程】C#异步socketAPI调用 处理数据的流程

    之前客户端在网络条件好的时候,运行没问题.但是有时候手机的网络不稳定,接受数据可能不稳定,导致接受数据错误,一直都不知道,原来是接受数据处理的不够好! 现在更改过后的接受数据的逻辑如下: //接收 p ...

  5. Go语言之进阶篇爬百度贴吧并发版

    1.爬百度贴吧并发版 示例: package main import ( "fmt" "net/http" "os" "strco ...

  6. Windows server 2008 SSD性能测试

    过渡到windows 7.windows8是趋势,老迈的windows xp .windows server 2003已经快到淘汰的阶段,安装了windows server 2008 R2 ,测试了下 ...

  7. easyui datagrid列使用按钮的一些心得 .

    以前,用easyui的datagrid,有时候会用到一些操作选项,比如代码如下: $('#datagrid').datagrid({ border:false, fitColumns:true, si ...

  8. 手把手实现腾讯qq拖拽删去效果(二)

    这节,就一个任务如何把上节自定义的翻页动画控件整进下拉列表中去. 由于是自定义的下拉列表控件,我们需要自定义能够上啦下滑的listview,这势必会造成这个问题,上拉刷新要响应相应touch事件,拖拽 ...

  9. 不能从const char *转换为LPCWSTR --VS经常碰到

    不能从const char *转换为LPCWSTR 在VC 6.0中编译成功的项目在VS2005 vs2005.vs2008.vs2010中常会出现类型错误. 经常出现的错误是:不能从const ch ...

  10. Android -- Handling back button press Inside Fragments

    干货(1) 首先创建一个抽象类BackHandledFragment,该类有一个抽象方法onBackPressed(),所有BackHandledFragment的子类在onBackPressed方法 ...