icedb  version 0.5.1
Snow particle scattering database API
Namespaces | Classes | Typedefs | Functions
icedb::versioning Namespace Reference

Namespaces

 internal
 

Classes

struct  versionInfo
 

Typedefs

typedef std::shared_ptr< const versionInfoversionInfo_p
 

Functions

ICEDB_ver_match compareVersions (const versionInfo_p a, const versionInfo_p b)
 
void getLibVersionInfo (versionInfo &out)
 
versionInfo_p getLibVersionInfo ()
 
void genVersionInfo (versionInfo &out)
 Calculates version string based on compile-time version of external code. More...
 
versionInfo_p genVersionInfo ()
 
void debug_preamble (const versionInfo &v, std::ostream &out=std::cerr)
 Provides information about the build environment during compilation. More...
 
void debug_preamble (std::ostream &out=std::cerr)
 

Typedef Documentation

◆ versionInfo_p

typedef std::shared_ptr<const versionInfo> icedb::versioning::versionInfo_p

Definition at line 43 of file versioningForwards.hpp.

Function Documentation

◆ compareVersions()

DL_ICEDB ICEDB_ver_match icedb::versioning::compareVersions ( const versionInfo_p  a,
const versionInfo_p  b 
)

Definition at line 9 of file versioning.cpp.

References ICEDB_VER_COMPATIBLE_1, ICEDB_VER_COMPATIBLE_2, ICEDB_VER_COMPATIBLE_3, ICEDB_VER_EXACT_MATCH, ICEDB_VER_INCOMPATIBLE, tryBool, tryNum, tryNumB, and tryStr.

Referenced by ICEDB_CompareVersions().

10  {
12  if (!a || !b) return res;
13 
14 #define tryNum(x) if (a->vn[versionInfo:: x] != b->vn[versionInfo:: x]) return res;
15 #define tryBool(x) if (a->vb[versionInfo:: x] != b->vb[versionInfo:: x]) return res;
16 #define tryStr(x) if (std::strncmp(a-> x, b-> x, versionInfo::charmax ) != 0) return res;
17 #define tryNumB(x) if ((a->vn[versionInfo:: x] != b->vn[versionInfo:: x]) && a->vn[versionInfo:: x]) return res;
18  // First filter the incompatible stuff
19  tryNum(V_VERSIONINFO);
20  tryStr(vassembly);
21  tryNum(V_MAJOR);
22  tryNum(V_MINOR);
23  tryBool(V_AMD64);
24  tryBool(V_X64);
25  tryBool(V_UNIX);
26  tryBool(V_APPLE);
27  tryBool(V_WIN32);
28  tryStr(vboost);
29  tryNum(V_MSCVER);
30 
32  tryNumB(V_GNUC_MAJ);
33  tryNumB(V_MINGW_MAJ);
34  tryNumB(V_SUNPRO);
35  tryNumB(V_PATHCC_MAJ);
36  tryNumB(V_CLANG_MAJ);
37  tryNumB(V_INTEL);
38 
40  tryNumB(V_GNUC_MIN);
41  tryNumB(V_MINGW_MIN);
42  tryNumB(V_PATHCC_MIN);
43  tryNumB(V_CLANG_MIN);
44  tryNum(V_REVISION);
45 
47  tryBool(V_OPENMP);
48  tryNum(V_SVNREVISION);
49  tryStr(vgithash);
50 
52  return res;
53 #undef tryNum
54 #undef tryBool
55 #undef tryStr
56 #undef tryNumB
57  }
#define tryNum(x)
#define tryBool(x)
#define tryNumB(x)
#define tryStr(x)
ICEDB_ver_match
Here is the caller graph for this function:

◆ debug_preamble() [1/2]

void icedb::versioning::debug_preamble ( const versionInfo v,
std::ostream &  out = std::cerr 
)
inline

Provides information about the build environment during compilation.

This function is designed to provide information on a compiler's build environment. It is a header function because it is designed to reflect the compiler variables of an external project's code.

Parameters
outThe output stream that receives the information.

Definition at line 116 of file versioning.hpp.

References icedb::versioning::versionInfo::vb, icedb::versioning::versionInfo::vboost, icedb::versioning::versionInfo::vdate, icedb::versioning::versionInfo::vgitbranch, icedb::versioning::versionInfo::vgithash, icedb::versioning::versionInfo::vn, icedb::versioning::versionInfo::vsdate, icedb::versioning::versionInfo::vssource, icedb::versioning::versionInfo::vsuuid, and icedb::versioning::versionInfo::vtime.

Referenced by ICEDB_WriteLibVersionInfoCC().

117  {
118  out << "Compiled on " << v.vdate << " at " << v.vtime << std::endl;
119  out << "Version " << v.vn[versionInfo::V_MAJOR] << "." << v.vn[versionInfo::V_MINOR]
120  << "." << v.vn[versionInfo::V_REVISION] << std::endl;
121  if (v.vgitbranch[0] != '\0') out << "GIT Branch " << v.vgitbranch << std::endl;
122  if (v.vgithash[0] != '\0') out << "GIT Hash " << v.vgithash << std::endl;
123  if (v.vn[versionInfo::V_SVNREVISION]) out << "SVN Revision " << v.vn[versionInfo::V_SVNREVISION] << std::endl;
124  if (v.vsdate[0] != '\0') out << "SVN Revision Date: " << v.vsdate << std::endl;
125  if (v.vssource[0] != '\0') out << "SVN Source: " << v.vssource << std::endl;
126  if (v.vsuuid[0] != '\0') out << "SVN UUID: " << v.vsuuid << std::endl;
127  if (v.vb[versionInfo::V_DEBUG]) out << "Debug Version" << std::endl;
128  else out << "Release Version" << std::endl;
129  if (v.vb[versionInfo::V_OPENMP]) out << "OpenMP enabled in Compiler" << std::endl;
130  else out << "OpenMP disabled in Compiler" << std::endl;
131  if (v.vb[versionInfo::V_AMD64] || v.vb[versionInfo::V_X64]) out << "64-bit build" << std::endl;
132  if (v.vb[versionInfo::V_UNIX]) out << "Unix / Linux Compile" << std::endl;
133  if (v.vb[versionInfo::V_APPLE]) out << "Mac Os X Compile" << std::endl;
134  if (v.vb[versionInfo::V_WIN32]) out << "Windows Compile" << std::endl;
135 
136  if (v.vn[versionInfo::V_GNUC_MAJ])
137  out << "GNU Compiler Suite " << v.vn[versionInfo::V_GNUC_MAJ] << "."
138  << v.vn[versionInfo::V_GNUC_MIN] << "." << v.vn[versionInfo::V_GNUC_PATCH] << std::endl;
139  if (v.vn[versionInfo::V_MINGW_MAJ])
140  out << "MinGW Compiler Suite " << v.vn[versionInfo::V_MINGW_MAJ] << "."
141  << v.vn[versionInfo::V_MINGW_MIN] << std::endl;
142  if (v.vn[versionInfo::V_SUNPRO])
143  out << "Sun Studio Compiler Suite " << v.vn[versionInfo::V_SUNPRO] << std::endl;
144  if (v.vn[versionInfo::V_PATHCC_MAJ])
145  out << "EKOPath Compiler " << v.vn[versionInfo::V_PATHCC_MAJ] << "."
146  << v.vn[versionInfo::V_PATHCC_MIN] << "." << v.vn[versionInfo::V_PATHCC_PATCH] << std::endl;
147  if (v.vb[versionInfo::V_LLVM]) out << "LLVM Compiler Suite" << std::endl;
148  if (v.vn[versionInfo::V_CLANG_MAJ])
149  out << "clang compiler " << v.vn[versionInfo::V_CLANG_MAJ] << "."
150  << v.vn[versionInfo::V_CLANG_MIN] << "." << v.vn[versionInfo::V_CLANG_PATCH] << std::endl;
151  if (v.vn[versionInfo::V_INTEL])
152  out << "Intel Suite " << v.vn[versionInfo::V_INTEL]
153  << " Date " << v.vn[versionInfo::V_INTEL_DATE] << std::endl;
154  if (v.vn[versionInfo::V_MSCVER])
155  out << "Microsoft Visual Studio Compiler Version " << v.vn[versionInfo::V_MSCVER] << std::endl;
156  if (v.vboost[0]) out << "Boost version " << v.vboost << std::endl;
157 
158 
159  out << std::endl;
160  out << std::endl;
161  }
Here is the caller graph for this function:

◆ debug_preamble() [2/2]

void icedb::versioning::debug_preamble ( std::ostream &  out = std::cerr)
inline

Definition at line 163 of file versioning.hpp.

References genVersionInfo().

164  {
165  versionInfo v;
166  genVersionInfo(v);
167  debug_preamble(v, out);
168  }
versionInfo_p genVersionInfo()
Definition: versioning.hpp:101
void debug_preamble(std::ostream &out=std::cerr)
Definition: versioning.hpp:163
Here is the call graph for this function:

◆ genVersionInfo() [1/2]

void icedb::versioning::genVersionInfo ( versionInfo out)
inline

Calculates version string based on compile-time version of external code.

Definition at line 27 of file versioning.hpp.

References ICEDB_COMPAT_strncpy_s(), icedb::versioning::versionInfo::vassembly, icedb::versioning::versionInfo::vb, icedb::versioning::versionInfo::vboost, icedb::versioning::versionInfo::vdate, icedb::versioning::versionInfo::vgitbranch, icedb::versioning::versionInfo::vgithash, icedb::versioning::versionInfo::vn, icedb::versioning::versionInfo::vsdate, icedb::versioning::versionInfo::vssource, icedb::versioning::versionInfo::vsuuid, and icedb::versioning::versionInfo::vtime.

Referenced by getLibVersionInfo().

28  {
29  for (size_t i = 0; i < versionInfo::V_MAX_INTS; ++i) out.vn[i] = 0;
30  for (size_t i = 0; i < versionInfo::V_MAX_BOOLS; ++i) out.vb[i] = false;
31  out.vn[versionInfo::V_VERSIONINFO] = 1; // Change this if the structure is modified. Differences are ALWAYS incompatible.
32  out.vsdate[0] = '\0'; out.vssource[0] = '\0'; out.vsuuid[0] = '\0';
33  out.vboost[0] = '\0'; out.vassembly[0] = '\0';
34  ICEDB_COMPAT_strncpy_s(out.vdate, versionInfo::charmax, __DATE__, versionInfo::charmax);
35  ICEDB_COMPAT_strncpy_s(out.vtime, versionInfo::charmax, __TIME__, versionInfo::charmax);
36  ICEDB_COMPAT_strncpy_s(out.vgithash, versionInfo::charmax, libicedb_GitHash, versionInfo::charmax);
37  ICEDB_COMPAT_strncpy_s(out.vgitbranch, versionInfo::charmax, libicedb_GitBranch, versionInfo::charmax);
38 
39  out.vn[versionInfo::V_MAJOR] = libicedb_MAJOR;
40  out.vn[versionInfo::V_MINOR] = libicedb_MINOR;
41  out.vn[versionInfo::V_REVISION] = libicedb_REVISION;
42 
43 
44 #ifdef __GNUC__
45  out.vn[versionInfo::V_GNUC_MAJ] = __GNUC__;
46  out.vn[versionInfo::V_GNUC_MIN] = __GNUC_MINOR__;
47  out.vn[versionInfo::V_GNUC_PATCH] = __GNUC_PATCHLEVEL__;
48 #endif
49 #ifdef __MINGW32__
50  out.vn[versionInfo::V_MINGW_MAJ] = __MINGW32_MAJOR_VERSION;
51  out.vn[versionInfo::V_MINGW_MIN] = __MINGW32_MINOR_VERSION;
52 #endif
53 #ifdef __SUNPRO_CC
54  out.vn[versionInfo::V_SUNPRO] = __SUNPRO_CC;
55 #endif
56 #ifdef __PATHCC__
57  out.vn[versionInfo::V_PATHCC_MAJ] = __PATHCC__;
58  out.vn[versionInfo::V_PATHCC_MIN] = __PATHCC_MINOR__;
59  out.vn[versionInfo::V_PATHCC_PATCH] = __PATHCC_PATCHLEVEL__;
60 #endif
61 #ifdef __llvm__
62  out.vb[versionInfo::V_LLVM] = true;
63 #endif
64 #ifdef __clang__
65  out.vn[versionInfo::V_CLANG_MAJ] = __clang_major__;
66  out.vn[versionInfo::V_CLANG_MIN] = __clang_minor__;
67  out.vn[versionInfo::V_CLANG_PATCH] = __clang_patchlevel__;
68 #endif
69 #ifdef __INTEL_COMPILER
70  out.vn[versionInfo::V_INTEL] = __INTEL_COMPILER;
71  out.vn[versionInfo::V_INTEL_DATE] = __INTEL_COMPILER_BUILD_DATE;
72 #endif
73 #ifdef _MSC_FULL_VER
74  out.vn[versionInfo::V_MSCVER] = _MSC_FULL_VER;
75 #endif
76 #ifdef BOOST_LIB_VERSION
77  inline_strncpy_s(out.vboost, versionInfo::charmax, BOOST_LIB_VERSION, versionInfo::charmax);
78 #endif
79 #ifdef _DEBUG
80  out.vb[versionInfo::V_DEBUG] = true;
81 #endif
82 #ifdef _OPENMP
83  out.vb[versionInfo::V_OPENMP] = true;
84 #endif
85 #ifdef __amd64
86  out.vb[versionInfo::V_AMD64] = true;
87 #endif
88 #ifdef _M_X64
89  out.vb[versionInfo::V_X64] = true;
90 #endif
91 #ifdef __unix__
92  out.vb[versionInfo::V_UNIX] = true;
93 #endif
94 #ifdef __APPLE__
95  out.vb[versionInfo::V_APPLE] = true;
96 #endif
97 #ifdef _WIN32
98  out.vb[versionInfo::V_WIN32] = true;
99 #endif
100  }
ICEDB_BEGIN_DECL_C ICEDB_SYMBOL_SHARED size_t ICEDB_COMPAT_strncpy_s(char *dest, size_t destSz, const char *src, size_t srcSz)
Definition: util.cpp:14
Here is the call graph for this function:
Here is the caller graph for this function:

◆ genVersionInfo() [2/2]

versionInfo_p icedb::versioning::genVersionInfo ( )
inline

Definition at line 101 of file versioning.hpp.

Referenced by debug_preamble().

101  {
102  std::shared_ptr<versionInfo> res(new versionInfo);
103  genVersionInfo(*(res.get()));
104  versionInfo_p r(res);
105  return r;
106  }
versionInfo_p genVersionInfo()
Definition: versioning.hpp:101
std::shared_ptr< const versionInfo > versionInfo_p
Here is the caller graph for this function:

◆ getLibVersionInfo() [1/2]

void icedb::versioning::getLibVersionInfo ( versionInfo out)

Definition at line 59 of file versioning.cpp.

References genVersionInfo().

Referenced by getLibVersionInfo(), and ICEDB_getLibVersionInfo().

60  {
61  genVersionInfo(out);
62  }
void genVersionInfo(versionInfo &out)
Calculates version string based on compile-time version of external code.
Definition: versioning.hpp:27
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLibVersionInfo() [2/2]

DL_ICEDB versionInfo_p icedb::versioning::getLibVersionInfo ( )

Definition at line 64 of file versioning.cpp.

References getLibVersionInfo(), ICEDB_BEGIN_DECL_C, and icedb::versioning::internal::ver_int.

65  {
67  std::shared_ptr<versionInfo> vi(new versionInfo);
68  getLibVersionInfo(*(vi.get()));
69  internal::ver_int = vi;
70  return internal::ver_int;
71  }
versionInfo_p getLibVersionInfo()
Definition: versioning.cpp:64
Here is the call graph for this function: