ACE中对于不同类型数据的最大值最小值管理ACE_Numeric_Limits
对于不同类型的变量,这里定义了其最大最小值来提供给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的更多相关文章
- asp.net mvc视图中使用entitySet类型数据时提示出错
asp.net mvc5视图中使用entitySet类型数据时提示以下错误 检查了一下引用,发现已经引用了System.Data.Linq了,可是还是一直提示出错, 后来发现还需要在Views文件夹下 ...
- 【Spring】SpringMVC中浅析Date类型数据的传递
在控制器中加入如下代码: @InitBinder public void initBinder(ServletRequestDataBinder bin){ SimpleDateFormat sdf ...
- 关于数据库中varchar/nvarchar类型数据的获取注意事项
当在页面后台获取数据库表中某字段的数据时,需注意该数据的类型.防止因实际数据的字符长度因达不到指定数据类型规定的字符长度而导致空格的占位符. 比如: MSSQL中某一表的结构如下: 表中的数据: ...
- C#中的double类型数据向SQL sqerver 存储与读取问题
1.存储 由于double类型在SQLsever中并没有对应数据,试过对应float.real类型,发现小数位都存在四舍五入的现象,目前我使用的是decimal类型,用此类型时个人觉得小数位数应该比自 ...
- java通过poi读取excel中的日期类型数据或自定义类型日期
Java 读取Excel表格日期类型数据的时候,读出来的是这样的 12-十月-2019,而Excel中输入的是 2019/10/12 或 2019-10-12 poi处理excel时,当excel没 ...
- 在oracle中存入date类型数据遇到的问题及其解决方法(利用java.sql.date和Timestamp)
转自:https://blog.csdn.net/ShadowerWArden/article/details/80652377 1. 使用JDBC操作Oracle数据库时,使用java.sql.Da ...
- Python(Redis 中 Set/Zset 类型数据和其他操作)
1.redis 基本操作命令 Set 操作 Set 集合就是不允许重复的列表 无序集合 sadd(name,values) 给 name 对应的集合中添加 1 个或多个元素 import redis ...
- Oracle数据库获取一行记录中某几个字段的最大值/最小值函数
在数据库的开发过程中,我们可能会遇到这样的需求,获取一行记录中某几个字段的最大值或者是最小值,oracle给我们提供了解决这种需求的函数,如下所示: greatest(col1, col2, co ...
- 读写SQLServer数据库中的image类型数据(简单)
1.将double类型的数据存储于image类型的变量中: (1). char *CManualForecastResultBll::DoubleArray2Binary(std::vector< ...
随机推荐
- ios之gcd浅析
A.普通的GCD异步运行与主线程更新写法: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, ), ^ ...
- Android之找回打包key密码的方法
昨天准备给自己的应用发布一个新版本,在apk打包时,发现之前的用的keystore密码忘了.蛋碎了一地,我把我所能想到的密码都试了一遍(注:我平常在各个门户网站注册基本上用的都是那几个字母和数字组合做 ...
- 在MFC内竟然不可以解析“Mat”
调试了好久,在MFC内竟然不可以解析“Mat” 总是显示"Mat"没有定义,改动include.lib.依赖库, 不断地改动: #include "opencv2/img ...
- C#如何判断线程池中所有的线程是否已经完成(转)
其 实很简单用ThreadPool.RegisterWaitForSingleObject方法注册一个定时检查线程池的方法,在检查线程的方法内调用 ThreadPool.GetAvailableThr ...
- 【cocos2dx中Node类getParent和getChildByTag()】学习体会
參考http://cn.cocos2d-x.org/doc/cocos2d-x-3.0/d3/d82/classcocos2d_1_1_node.html 当中和child.parent有关的成员函数 ...
- (转)mobile cpu上禁用alpha test的相关总结
转自:http://www.cnblogs.com/TracePlus/p/4037165.html 因为,每家芯片的特性不同,根据向framebuffer写法的不同,分为tile-based的mob ...
- [Spring Boot] Introduce to Mockito
We have the implemetion: @SpringBootApplication public class MockitoDemoApplication { public static ...
- Solidworks直接打开SWB文件报错怎么办
- mycat 不得不说的缘分
.尾声.左兄与任正非.leader-us与马云 新成立的公司里面.有个左兄,非常传奇,大一在大学入伍,然后复员专业.来上海学IT.年纪轻轻,睡在地铁站,苦心专研数据库.系统.中间件,如今已经成为了业界 ...
- 使用jsp内置对象request获取表单提交中文内容乱码的解决办法
page1.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pag ...