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

Go to the documentation of this file.
00001 #ifndef ISPN_HOTROD_CONFIGURATION_H
00002 #define ISPN_HOTROD_CONFIGURATION_H
00003 
00004 
00005 
00006 #include <string>
00007 #include <vector>
00008 #include "infinispan/hotrod/portable.h"
00009 #include "infinispan/hotrod/ImportExport.h"
00010 #include "ConnectionPoolConfiguration.h"
00011 #include "ServerConfiguration.h"
00012 #include "SslConfiguration.h"
00013 
00014 namespace infinispan {
00015 namespace hotrod {
00016 
00022 // TODO: should we really return references?
00023 class Configuration
00024 {
00025   public:
00026     HR_EXTERN static const char* PROTOCOL_VERSION_10;
00027     HR_EXTERN static const char* PROTOCOL_VERSION_11;
00028     HR_EXTERN static const char* PROTOCOL_VERSION_12;
00029 
00030     Configuration(const std::string &_protocolVersion,
00031             const ConnectionPoolConfiguration& _connectionPoolConfiguration,
00032             int _connectionTimeout,
00033             bool _forceReturnValue,
00034             int _keySizeEstimate,
00035             bool _pingOnStartup,
00036             std::vector<ServerConfiguration> _serversConfiguration,
00037             int _socketTimeout,
00038             const SslConfiguration _sslConfiguration,
00039             bool _tcpNoDelay,
00040             int _valueSizeEstimate):
00041                 protocolVersion(_protocolVersion), protocolVersionPtr(),
00042                 connectionPoolConfiguration(_connectionPoolConfiguration),
00043                 connectionTimeout(_connectionTimeout), forceReturnValue(_forceReturnValue),
00044                 keySizeEstimate(_keySizeEstimate), pingOnStartup(_pingOnStartup), servers(_serversConfiguration),
00045                 socketTimeout(_socketTimeout), sslConfiguration(_sslConfiguration),tcpNoDelay(_tcpNoDelay),
00046                 valueSizeEstimate(_valueSizeEstimate) {}
00047 
00052     HR_EXTERN const std::string &getProtocolVersion() const {
00053         if (protocolVersionPtr.get() == NULL) {
00054             const_cast<Configuration *>(this)->protocolVersionPtr
00055                     .set(new std::string(protocolVersion.c_string()), &deleteString);
00056         }
00057         return *(protocolVersionPtr.get());
00058     }
00059 
00067     HR_EXTERN const char *getProtocolVersionCString() const;
00068 
00074     HR_EXTERN const ConnectionPoolConfiguration& getConnectionPoolConfiguration() const;
00075 
00081     HR_EXTERN const int& getConnectionTimeout() const;
00082 
00090     HR_EXTERN const bool& isForceReturnValue() const;
00091 
00097     HR_EXTERN const int& getKeySizeEstimate() const;
00098 
00105     HR_EXTERN const bool& isPingOnStartup() const;
00106 
00113     std::vector<ServerConfiguration> getServersConfiguration() const {
00114         return servers.std_vector();
00115     }
00116 
00122     HR_EXTERN const int& getSocketTimeout() const;
00123 
00129     HR_EXTERN const SslConfiguration& getSslConfiguration() const;
00130 
00136     HR_EXTERN const bool& isTcpNoDelay() const;
00137 
00143     HR_EXTERN const int& getValueSizeEstimate() const;
00144 
00145 private:
00146     portable::string protocolVersion;
00147     portable::local_ptr<std::string> protocolVersionPtr;
00148     ConnectionPoolConfiguration connectionPoolConfiguration;
00149     int connectionTimeout;
00150     bool forceReturnValue;
00151     int keySizeEstimate;
00152     bool pingOnStartup;
00153     portable::vector<ServerConfiguration> servers;
00154     int socketTimeout;
00155     SslConfiguration sslConfiguration;
00156     bool tcpNoDelay;
00157     int valueSizeEstimate;
00158 
00159     static void deleteString(std::string *str) { delete str; }
00160 };
00161 
00162 }} // namespace
00163 
00164 #endif /* ISPN_HOTROD_CONFIGURATION_H */

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