![]() |
QxOrm 1.1.6
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** http://www.qxorm.com/ 00004 ** http://sourceforge.net/projects/qxorm/ 00005 ** Original file by Lionel Marty 00006 ** 00007 ** This file is part of the QxOrm library 00008 ** 00009 ** This software is provided 'as-is', without any express or implied 00010 ** warranty. In no event will the authors be held liable for any 00011 ** damages arising from the use of this software. 00012 ** 00013 ** GNU Lesser General Public License Usage 00014 ** This file must be used under the terms of the GNU Lesser 00015 ** General Public License version 2.1 as published by the Free Software 00016 ** Foundation and appearing in the file 'license.lgpl.txt' included in the 00017 ** packaging of this file. Please review the following information to 00018 ** ensure the GNU Lesser General Public License version 2.1 requirements 00019 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00020 ** 00021 ** If you have questions regarding the use of this file, please contact : 00022 ** contact@qxorm.com 00023 ** 00024 ****************************************************************************/ 00025 00026 #if _QX_ENABLE_QT_NETWORK_DEPENDENCY 00027 #ifndef _QX_SERVICE_CONNECT_H_ 00028 #define _QX_SERVICE_CONNECT_H_ 00029 00030 #ifdef _MSC_VER 00031 #pragma once 00032 #endif 00033 00041 #include <QxSingleton/QxSingleton.h> 00042 00043 #if _QX_SERIALIZE_BINARY 00044 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_binary 00045 #elif _QX_SERIALIZE_WIDE_BINARY 00046 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_wide_binary 00047 #elif _QX_SERIALIZE_PORTABLE_BINARY 00048 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_portable_binary 00049 #elif _QX_SERIALIZE_POLYMORPHIC 00050 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_polymorphic_binary 00051 #elif _QX_SERIALIZE_TEXT 00052 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_text 00053 #elif _QX_SERIALIZE_XML 00054 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_xml 00055 #elif _QX_SERIALIZE_WIDE_TEXT 00056 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_wide_text 00057 #elif _QX_SERIALIZE_WIDE_XML 00058 #define QX_SERVICE_DEFAULT_SERIALIZATION_TYPE serialization_wide_xml 00059 #endif // _QX_SERIALIZE_BINARY 00060 00061 namespace qx { 00062 namespace service { 00063 00070 class QX_DLL_EXPORT QxConnect : public qx::QxSingleton<QxConnect> 00071 { 00072 00073 friend class qx::QxSingleton<QxConnect>; 00074 00075 public: 00076 00077 enum serialization_type { serialization_binary, serialization_xml, serialization_text, serialization_portable_binary, 00078 serialization_wide_binary, serialization_wide_xml, serialization_wide_text, 00079 serialization_polymorphic_binary, serialization_polymorphic_xml, serialization_polymorphic_text }; 00080 00081 protected: 00082 00083 QString m_sIp; 00084 long m_lPort; 00085 serialization_type m_eSerializationType; 00086 long m_lThreadCount; 00087 int m_iMaxWait; 00088 bool m_bCompressData; 00089 00090 public: 00091 00092 QxConnect() : qx::QxSingleton<QxConnect>("qx::service::QxConnect"), m_lPort(0), m_eSerializationType(QX_SERVICE_DEFAULT_SERIALIZATION_TYPE), m_lThreadCount(30), m_iMaxWait(30000), m_bCompressData(false) { ; } 00093 virtual ~QxConnect(); 00094 00095 QString getIp() const { return m_sIp; } 00096 long getPort() const { return m_lPort; } 00097 serialization_type getSerializationType() const { return m_eSerializationType; } 00098 long getThreadCount() const { return m_lThreadCount; } 00099 int getMaxWait() const { return m_iMaxWait; } 00100 bool getCompressData() const { return m_bCompressData; } 00101 00102 void setIp(const QString & s) { m_sIp = s; } 00103 void setPort(long l) { m_lPort = l; } 00104 void setSerializationType(serialization_type e) { m_eSerializationType = e; } 00105 void setThreadCount(long l) { qAssert(l > 0); m_lThreadCount = l; } 00106 void setMaxWait(int i) { qAssert(i > 0); m_iMaxWait = i; } 00107 void setCompressData(bool b) { m_bCompressData = b; } 00108 00109 }; 00110 00111 } // namespace service 00112 } // namespace qx 00113 00114 QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::service::QxConnect) 00115 00116 #endif // _QX_SERVICE_CONNECT_H_ 00117 #endif // _QX_ENABLE_QT_NETWORK_DEPENDENCY