JBoss Data Grid HotRod C++ Client  6.6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Version.h
Go to the documentation of this file.
1 #ifndef ISPN_HOTROD_VERSION_H
2 #define ISPN_HOTROD_VERSION_H
3 
6 #include <string>
7 
8 namespace infinispan {
9 namespace hotrod {
10 
11 // The memory won't be ever released. It's even worse - the pointer is static,
12 // therefore, it will be allocated anew for each compilation unit using this.
13 // However, if we placed the pointers to the library, two differently compiled
14 // modules could access the same data, causing memory corruption.
15 static std::string *__protocolVersionPtr = NULL;
16 static std::string *__versionPtr = NULL;
17 
22 class Version {
23 private:
24  HR_EXTERN static const char *PROTOCOL_VERSION;
25  HR_EXTERN static const char *VERSION;
26 
27 public:
33  static const char *getProtocolVersionCString() {
34  return PROTOCOL_VERSION;
35  }
36 
42  static const char *getVersionCString() {
43  return VERSION;
44  }
45 
49  static const std::string &getProtocolVersion() {
50  if (__protocolVersionPtr == NULL) {
51  __protocolVersionPtr = new std::string(PROTOCOL_VERSION);
52  }
53  return *__protocolVersionPtr;
54  }
55 
59  static const std::string &getVersion() {
60  if (__versionPtr == NULL) {
61  __versionPtr = new std::string(VERSION);
62  }
63  return *__versionPtr;
64  }
65 };
66 
67 }}
68 
69 #endif // ISPN_HOTROD_VERSIONEDVALUE_H
static const char * getProtocolVersionCString()
Definition: Version.h:33
#define HR_EXTERN
Definition: ImportExport.h:35
Definition: Version.h:22
static const std::string & getVersion()
Definition: Version.h:59
static const char * getVersionCString()
Definition: Version.h:42
static const std::string & getProtocolVersion()
Definition: Version.h:49