![]() |
QxOrm
1.4.1
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** http://www.qxorm.com/ 00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com) 00005 ** 00006 ** This file is part of the QxOrm library 00007 ** 00008 ** This software is provided 'as-is', without any express or implied 00009 ** warranty. In no event will the authors be held liable for any 00010 ** damages arising from the use of this software 00011 ** 00012 ** Commercial Usage 00013 ** Licensees holding valid commercial QxOrm licenses may use this file in 00014 ** accordance with the commercial license agreement provided with the 00015 ** Software or, alternatively, in accordance with the terms contained in 00016 ** a written agreement between you and Lionel Marty 00017 ** 00018 ** GNU General Public License Usage 00019 ** Alternatively, this file may be used under the terms of the GNU 00020 ** General Public License version 3.0 as published by the Free Software 00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the 00022 ** packaging of this file. Please review the following information to 00023 ** ensure the GNU General Public License version 3.0 requirements will be 00024 ** met : http://www.gnu.org/copyleft/gpl.html 00025 ** 00026 ** If you are unsure which license is appropriate for your use, or 00027 ** if you have questions regarding the use of this file, please contact : 00028 ** contact@qxorm.com 00029 ** 00030 ****************************************************************************/ 00031 00032 #ifdef _QX_ENABLE_QT_NETWORK 00033 #ifndef _IX_SERVICE_H_ 00034 #define _IX_SERVICE_H_ 00035 00036 #ifdef _MSC_VER 00037 #pragma once 00038 #endif 00039 00047 #include <QtCore/qdatastream.h> 00048 00049 #include <QxCommon/QxBool.h> 00050 00051 #include <QxRegister/QxRegisterInternalHelper.h> 00052 00053 #include <QxService/IxParameter.h> 00054 00055 namespace qx { 00056 namespace service { 00057 class QxTransaction; 00058 class IxService; 00059 } // namespace service 00060 } // namespace qx 00061 00062 QX_DLL_EXPORT QDataStream & operator<< (QDataStream & stream, const qx::service::IxService & t) BOOST_USED; 00063 QX_DLL_EXPORT QDataStream & operator>> (QDataStream & stream, qx::service::IxService & t) BOOST_USED; 00064 00065 namespace qx { 00066 namespace service { 00067 00074 class QX_DLL_EXPORT IxService 00075 { 00076 00077 friend QDataStream & ::operator<< (QDataStream & stream, const qx::service::IxService & t); 00078 friend QDataStream & ::operator>> (QDataStream & stream, qx::service::IxService & t); 00079 00080 protected: 00081 00082 QString m_sServiceName; 00083 QString m_sServiceMethodName; 00084 IxParameter_ptr m_pInputParameter; 00085 IxParameter_ptr m_pOutputParameter; 00086 qx_bool m_bMessageReturn; 00087 qx_shared_ptr<QxTransaction> m_pTransaction; 00088 00089 public: 00090 00091 IxService(); 00092 IxService(const QString & sServiceName); 00093 virtual ~IxService(); 00094 00095 QString getServiceName() const { return m_sServiceName; } 00096 QString getServiceMethodName() const { return m_sServiceMethodName; } 00097 IxParameter_ptr getInputParameter_BaseClass() const { return m_pInputParameter; } 00098 IxParameter_ptr getOutputParameter_BaseClass() const { return m_pOutputParameter; } 00099 qx_bool getMessageReturn() const { return m_bMessageReturn; } 00100 qx_shared_ptr<QxTransaction> getTransaction() const; 00101 00102 void setServiceName(const QString & s) { qAssert(! s.isEmpty()); m_sServiceName = s; } 00103 void setServiceMethodName(const QString & s) { qAssert(! s.isEmpty()); m_sServiceMethodName = s; } 00104 void setInputParameter(IxParameter_ptr p) { m_pInputParameter = p; } 00105 void setOutputParameter(IxParameter_ptr p) { m_pOutputParameter = p; } 00106 void setMessageReturn(const qx_bool & b) { m_bMessageReturn = b; } 00107 void setMessageReturn(long l, const QString & s) { m_bMessageReturn = qx_bool(l, s); } 00108 void setTransaction(const qx_shared_ptr<QxTransaction> & p); 00109 00110 bool isValid() const { return m_bMessageReturn.getValue(); } 00111 bool isValidWithOutput() const { return (isValid() && (m_pOutputParameter.get() != NULL)); } 00112 00113 virtual void registerClass() const { qDebug("[QxOrm] qx::service::IxService : %s", "need to override 'registerClass()' method"); qAssert(false); } 00114 virtual void onBeforeProcess() { ; } 00115 virtual void onAfterProcess() { ; } 00116 00117 }; 00118 00119 typedef qx_shared_ptr<IxService> IxService_ptr; 00120 00121 } // namespace service 00122 } // namespace qx 00123 00124 QX_REGISTER_INTERNAL_HELPER_HPP(QX_DLL_EXPORT, qx::service::IxService, 0) 00125 00126 #endif // _IX_SERVICE_H_ 00127 #endif // _QX_ENABLE_QT_NETWORK