QxOrm 1.1.8
C++ Object Relational Mapping library
QxTransaction.h
Go to the documentation of this file.
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_TRANSACTION_H_
00028 #define _QX_SERVICE_TRANSACTION_H_
00029 
00030 #ifdef _MSC_VER
00031 #pragma once
00032 #endif
00033 
00041 #include <QtNetwork/qtcpsocket.h>
00042 
00043 #include <QxCommon/QxBool.h>
00044 
00045 #include <QxRegister/QxRegisterInternalHelper.h>
00046 
00047 #include <QxService/IxService.h>
00048 #include <QxService/IxParameter.h>
00049 
00050 namespace qx {
00051 namespace service {
00052 
00059 class QX_DLL_EXPORT QxTransaction
00060 {
00061 
00062    QX_REGISTER_FRIEND_CLASS(qx::service::QxTransaction)
00063 
00064 protected:
00065 
00066    QString              m_sTransactionId;                   
00067    quint32              m_uiInputTransactionSize;           
00068    quint32              m_uiOutputTransactionSize;          
00069    QDateTime            m_dtTransactionBegin;               
00070    QDateTime            m_dtTransactionRequestSent;         
00071    QDateTime            m_dtTransactionRequestReceived;     
00072    QDateTime            m_dtTransactionReplySent;           
00073    QDateTime            m_dtTransactionReplyReceived;       
00074    QDateTime            m_dtTransactionEnd;                 
00075    QString              m_sIpSource;                        
00076    QString              m_sIpTarget;                        
00077    long                 m_lPortSource;                      
00078    long                 m_lPortTarget;                      
00079    QString              m_sServiceName;                     
00080    QString              m_sServiceMethod;                   
00081    qx_bool              m_bMessageReturn;                   
00082    IxParameter_ptr      m_pInputParameter;                  
00083    IxParameter_ptr      m_pOutputParameter;                 
00084    IxService_ptr        m_pServiceInstance;                 
00085 
00086 public:
00087 
00088    QxTransaction() : m_uiInputTransactionSize(0), m_uiOutputTransactionSize(0), m_lPortSource(0), m_lPortTarget(0) { ; }
00089    virtual ~QxTransaction() { ; }
00090 
00091    QString getTransactionId() const                      { return m_sTransactionId; }
00092    quint32 getInputTransactionSize() const               { return m_uiInputTransactionSize; }
00093    quint32 getOutputTransactionSize() const              { return m_uiOutputTransactionSize; }
00094    QDateTime getTransactionBegin() const                 { return m_dtTransactionBegin; }
00095    QDateTime getTransactionRequestSent() const           { return m_dtTransactionRequestSent; }
00096    QDateTime getTransactionRequestReceived() const       { return m_dtTransactionRequestReceived; }
00097    QDateTime getTransactionReplySent() const             { return m_dtTransactionReplySent; }
00098    QDateTime getTransactionReplyReceived() const         { return m_dtTransactionReplyReceived; }
00099    QDateTime getTransactionEnd() const                   { return m_dtTransactionEnd; }
00100    QString getIpSource() const                           { return m_sIpSource; }
00101    QString getIpTarget() const                           { return m_sIpTarget; }
00102    long getPortSource() const                            { return m_lPortSource; }
00103    long getPortTarget() const                            { return m_lPortTarget; }
00104    QString getServiceName() const                        { return m_sServiceName; }
00105    QString getServiceMethod() const                      { return m_sServiceMethod; }
00106    qx_bool getMessageReturn() const                      { return m_bMessageReturn; }
00107    IxParameter_ptr getInputParameter() const             { return m_pInputParameter; }
00108    IxParameter_ptr getOutputParameter() const            { return m_pOutputParameter; }
00109 
00110    void setTransactionId(const QString & s)                    { m_sTransactionId = s; }
00111    void setInputTransactionSize(quint32 ui)                    { m_uiInputTransactionSize = ui; }
00112    void setOutputTransactionSize(quint32 ui)                   { m_uiOutputTransactionSize = ui; }
00113    void setTransactionBegin(const QDateTime & dt)              { m_dtTransactionBegin = dt; }
00114    void setTransactionRequestSent(const QDateTime & dt)        { m_dtTransactionRequestSent = dt; }
00115    void setTransactionRequestReceived(const QDateTime & dt)    { m_dtTransactionRequestReceived = dt; }
00116    void setTransactionReplySent(const QDateTime & dt)          { m_dtTransactionReplySent = dt; }
00117    void setTransactionReplyReceived(const QDateTime & dt)      { m_dtTransactionReplyReceived = dt; }
00118    void setTransactionEnd(const QDateTime & dt)                { m_dtTransactionEnd = dt; }
00119    void setIpSource(const QString & s)                         { m_sIpSource = s; }
00120    void setIpTarget(const QString & s)                         { m_sIpTarget = s; }
00121    void setPortSource(long l)                                  { m_lPortSource = l; }
00122    void setPortTarget(long l)                                  { m_lPortTarget = l; }
00123    void setServiceName(const QString & s)                      { m_sServiceName = s; }
00124    void setServiceMethod(const QString & s)                    { m_sServiceMethod = s; }
00125    void setMessageReturn(const qx_bool & b)                    { m_bMessageReturn = b; }
00126    void setInputParameter(IxParameter_ptr p)                   { m_pInputParameter = p; }
00127    void setOutputParameter(IxParameter_ptr p)                  { m_pOutputParameter = p; }
00128 
00129 public:
00130 
00131    void executeServer();
00132    void executeClient(IxService * pService, const QString & sMethod);
00133 
00134 protected:
00135 
00136    qx_bool writeSocket(QTcpSocket & socket);
00137    qx_bool readSocket(QTcpSocket & socket);
00138 
00139 };
00140 
00141 typedef boost::shared_ptr<QxTransaction> QxTransaction_ptr;
00142 QX_DLL_EXPORT void execute_client(IxService * pService, const QString & sMethod);
00143 
00144 } // namespace service
00145 } // namespace qx
00146 
00147 QX_REGISTER_INTERNAL_HELPER_HPP(QX_DLL_EXPORT, qx::service::QxTransaction, 0)
00148 
00149 #endif // _QX_SERVICE_TRANSACTION_H_
00150 #endif // _QX_ENABLE_QT_NETWORK_DEPENDENCY
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines