对于不同类型的变量,这里定义了其最大最小值来提供给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. .AVLFile Extension

    .AVLFile Extension File Type 1ArcView Legend File   Developer ESRI Popularity           4.1 (7 Votes ...

  2. [转]PHP 汉字转拼音

    转自: https://git.oschina.net/wapznw/php-pinyin <?php /** * @package default * @copyright php-pinyi ...

  3. No identifier specified for entity: springboot-jpa报错No identifier specified for entity

    说明:此次学习使用了springboot框架,jpa注解映射实体类 1,No identifier specified for entity: com.tf.model.User 看到此错误第一反应百 ...

  4. 样条之EHMT插值函数

    核心代码: ////////////////////////////////////////////////////////////////////// // 埃特金插值 ////////////// ...

  5. easyloader分析与使用

    转载自:http://www.cnblogs.com/haogj/archive/2013/04/22/3036685.html 使用脚本库总要加载一大堆的样式表和脚本文件,在 easyui 中,除了 ...

  6. Vue背景图打包之后访问路径错误

    问题背景:项目里面有用到背景图片,开发模式下正常,打包之后发现报404错误.查看发现是背景图片引用路径出错. 解决方法: .map { width: %; height: 397px; backgro ...

  7. Android -- 混淆

    混淆本质 把原来有具体含义的类名,变量名,方法名,修改成让人看不懂的名字,例如方法名getxx混淆为方法名a. Android Studio中的混淆 Android工程目录下有个文件,proguard ...

  8. Android -- Annotation

    Override Annotation @Override public void onCreate(Bundle savedInstanceState){}; 概念 An annotation is ...

  9. spark0.8.0安装与学习

    spark0.8.0安装与学习       原文地址:http://www.yanjiuyanjiu.com/blog/20131017/ 环境:CentOS 6.4, Hadoop 1.1.2, J ...

  10. Red Hat Enterprise Linux AS release 4 yum源

    $sudo vim /etc/yum.conf [main] cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpoli ...