/builddir/build/BUILD/infinispan-hotrod-cpp-6.2.1.Final-Source/include/infinispan/hotrod/Version.h

Go to the documentation of this file.
00001 #ifndef ISPN_HOTROD_VERSION_H
00002 #define ISPN_HOTROD_VERSION_H
00003 
00004 #include "infinispan/hotrod/portable.h"
00005 #include "infinispan/hotrod/ImportExport.h"
00006 #include <string>
00007 
00008 namespace infinispan {
00009 namespace hotrod {
00010 
00011 // The memory won't be ever released. It's even worse - the pointer is static,
00012 // therefore, it will be allocated anew for each compilation unit using this.
00013 // However, if we placed the pointers to the library, two differently compiled
00014 // modules could access the same data, causing memory corruption.
00015 static std::string *__protocolVersionPtr = NULL;
00016 static std::string *__versionPtr = NULL;
00017 
00022 class Version {
00023 private:
00024     HR_EXTERN static const char *PROTOCOL_VERSION;
00025     HR_EXTERN static const char *VERSION;
00026 
00027 public:
00033     static const char *getProtocolVersionCString() {
00034         return PROTOCOL_VERSION;
00035     }
00036 
00042     static const char *getVersionCString() {
00043         return VERSION;
00044     }
00045 
00049     static const std::string &getProtocolVersion() {
00050         if (__protocolVersionPtr == NULL) {
00051             __protocolVersionPtr = new std::string(PROTOCOL_VERSION);
00052         }
00053         return *__protocolVersionPtr;
00054     }
00055 
00059     static const std::string &getVersion() {
00060         if (__versionPtr == NULL) {
00061             __versionPtr = new std::string(VERSION);
00062         }
00063         return *__versionPtr;
00064     }
00065 };
00066 
00067 }}
00068 
00069 #endif // ISPN_HOTROD_VERSIONEDVALUE_H

Generated on 25 Mar 2015 for JBoss Data Grid HotRod C++ Client by  doxygen 1.4.7