AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2version.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #include "ntv2version.h"
10 
11 #if !defined(NTV2_BUILDING_DRIVER)
12 
13  #include <sstream>
14 
15  // NOTE: AJA_GIT_COMMIT_HASH and AJA_GIT_COMMIT_HASH_SHORT are defined by the CMake build script:
16  // The hash should be precisely 40 characters, and the short hash 10 characters.
17  // Both hashes come from the git rev-parse command.
18 
19  const std::string & NTV2GitHash (void)
20  {
21  // This is ugly, but it's guaranteed thread-safe:
22  static const std::string sLongHash
23  #if defined(AJA_GIT_COMMIT_HASH)
24  (AJA_GIT_COMMIT_HASH)
25  #endif // defined(AJA_GIT_COMMIT_HASH)
26  ;
27  return sLongHash;
28  }
29 
30  const std::string & NTV2GitHashShort (void)
31  {
32  // This is ugly, but it's guaranteed thread-safe, anwith no mutex needed:
33  static const std::string sShortHash
34  #if defined(AJA_GIT_COMMIT_HASH_SHORT)
35  (AJA_GIT_COMMIT_HASH_SHORT)
36  #endif // defined(AJA_GIT_COMMIT_HASH_SHORT)
37  ;
38  return sShortHash;
39  }
40 
41  std::string NTV2Version (const bool inDetailed)
42  {
43  std::ostringstream oss;
44  if (inDetailed)
45  oss << "NTV2 SDK version ";
46  else
47  oss << "v";
49  << "." << AJA_NTV2_SDK_BUILD_NUMBER;
50  if (inDetailed)
51  oss << " built " << AJA_NTV2_SDK_BUILD_DATETIME << " from " << ::NTV2GitHash();
52  else
53  oss << " (" << ::NTV2GitHashShort() << ")";
54  return oss.str();
55  }
56 #endif // !defined(NTV2_BUILDING_DRIVER)
AJA_NTV2_SDK_BUILD_DATETIME
#define AJA_NTV2_SDK_BUILD_DATETIME
The date and time the SDK was built, in ISO-8601 format.
Definition: ntv2version.h:17
NTV2Version
std::string NTV2Version(const bool inDetailed)
Definition: ntv2version.cpp:41
AJA_NTV2_SDK_VERSION_POINT
#define AJA_NTV2_SDK_VERSION_POINT
The SDK "point" release version, an unsigned decimal integer.
Definition: ntv2version.h:15
NTV2GitHashShort
const std::string & NTV2GitHashShort(void)
Definition: ntv2version.cpp:30
ntv2version.h
Defines for the NTV2 SDK version number, used by ajantv2/includes/ntv2enums.h. See the ajantv2/includ...
AJA_NTV2_SDK_VERSION_MAJOR
#define AJA_NTV2_SDK_VERSION_MAJOR
The SDK major version number, an unsigned decimal integer.
Definition: ntv2version.h:13
AJA_NTV2_SDK_BUILD_NUMBER
#define AJA_NTV2_SDK_BUILD_NUMBER
The SDK build number, an unsigned decimal integer.
Definition: ntv2version.h:16
AJA_NTV2_SDK_VERSION_MINOR
#define AJA_NTV2_SDK_VERSION_MINOR
The SDK minor version number, an unsigned decimal integer.
Definition: ntv2version.h:14
NTV2GitHash
const std::string & NTV2GitHash(void)
Definition: ntv2version.cpp:19