CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
BcfConsts.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24#ifndef _BCF_CONSTS_H
25#define _BCF_CONSTS_H
26
27#include "BcfCommon.h"
28
29#define STL_USING_LIMITS
30#include "OdaSTL.h"
31
35namespace OdBcf
36{
40 namespace Consts
41 {
42 // This function should be tested on different platform. After successful tests we should move it to OdPlatfrom.h
43
48 template<class RealType>
49 inline RealType nanIEEERealCreate()
50 {
51 /*
52 int inf = 0x7F800000;
53 int nan = 0x7F800001;
54 */
55 union nanType
56 {
57 RealType nan;
58 unsigned char buf[sizeof(RealType)];
59 };
60
61 nanType nanGenerator = { 0 };
62
63#ifdef ODA_BIGENDIAN
64 nanGenerator.buf[0] = 0x7F;
65 nanGenerator.buf[1] = 0xF0;
66 nanGenerator.buf[sizeof(RealType) - 1] = 0x1;
67#else
68 nanGenerator.buf[sizeof(RealType) - 1] = 0x7F;
69 nanGenerator.buf[sizeof(RealType) - 2] = 0xF0;
70 nanGenerator.buf[0] = 0x1;
71#endif
72
73 return nanGenerator.nan;
74 }
75
76#ifdef USE_LIB_NAN
80 static const double OdNan = nan("");
81
85 static const float OdNanf = nanf("");
86#else
90 static const double OdNan = nanIEEERealCreate<double>();
91
95 static const float OdNanf = nanIEEERealCreate<float>();
96#endif
97
101 static const long OdLongUnset = std::numeric_limits<long>::max();
102
106 static const int OdIntUnset = std::numeric_limits<int>::max();
107
111 static const char OdStringUnset[] = "\xff";
112
116 static const size_t OdStringUnsetLength = strlen(OdStringUnset);
117
121 static const OdAnsiString AnsiStringUnset(OdBcf::Consts::OdStringUnset);
122 }
123}
124
125#endif // _BCF_CONSTS_H
RealType nanIEEERealCreate()
Definition: BcfConsts.h:49