QxOrm  1.2.9
C++ Object Relational Mapping library
IxService.h
Go to the documentation of this file.
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 #if _QX_ENABLE_QT_NETWORK_DEPENDENCY
00033 #ifndef _IX_SERVICE_H_
00034 #define _IX_SERVICE_H_
00035 
00036 #ifdef _MSC_VER
00037 #pragma once
00038 #endif
00039 
00047 #include <QxCommon/QxBool.h>
00048 
00049 #include <QxRegister/QxRegisterInternalHelper.h>
00050 
00051 #include <QxService/IxParameter.h>
00052 
00053 namespace qx {
00054 namespace service {
00055 
00056 class QxTransaction;
00057 
00064 class QX_DLL_EXPORT IxService
00065 {
00066 
00067 protected:
00068 
00069    QString m_sServiceName;                            
00070    QString m_sServiceMethodName;                      
00071    IxParameter_ptr m_pInputParameter;                 
00072    IxParameter_ptr m_pOutputParameter;                
00073    qx_bool m_bMessageReturn;                          
00074    boost::shared_ptr<QxTransaction> m_pTransaction;   
00075 
00076 public:
00077 
00078    IxService();
00079    IxService(const QString & sServiceName);
00080    virtual ~IxService();
00081 
00082    QString getServiceName() const                              { return m_sServiceName; }
00083    QString getServiceMethodName() const                        { return m_sServiceMethodName; }
00084    IxParameter_ptr getInputParameter_BaseClass() const         { return m_pInputParameter; }
00085    IxParameter_ptr getOutputParameter_BaseClass() const        { return m_pOutputParameter; }
00086    qx_bool getMessageReturn() const                            { return m_bMessageReturn; }
00087    boost::shared_ptr<QxTransaction> getTransaction() const;
00088 
00089    void setServiceName(const QString & s)                               { qAssert(! s.isEmpty()); m_sServiceName = s; }
00090    void setServiceMethodName(const QString & s)                         { qAssert(! s.isEmpty()); m_sServiceMethodName = s; }
00091    void setInputParameter(IxParameter_ptr p)                            { m_pInputParameter = p; }
00092    void setOutputParameter(IxParameter_ptr p)                           { m_pOutputParameter = p; }
00093    void setMessageReturn(const qx_bool & b)                             { m_bMessageReturn = b; }
00094    void setMessageReturn(long l, const QString & s)                     { m_bMessageReturn = qx_bool(l, s); }
00095    void setTransaction(const boost::shared_ptr<QxTransaction> & p);
00096 
00097    bool isValid() const             { return m_bMessageReturn.getValue(); }
00098    bool isValidWithOutput() const   { return (isValid() && (m_pOutputParameter.get() != NULL)); }
00099 
00100    virtual void registerClass() const  { qDebug("[QxOrm] qx::service::IxService : %s", "need to override 'registerClass()' method"); qAssert(false); }
00101    virtual void onBeforeProcess()      { ; }
00102    virtual void onAfterProcess()       { ; }
00103 
00104 };
00105 
00106 typedef boost::shared_ptr<IxService> IxService_ptr;
00107 
00108 } // namespace service
00109 } // namespace qx
00110 
00111 QX_REGISTER_INTERNAL_HELPER_HPP(QX_DLL_EXPORT, qx::service::IxService, 0)
00112 
00113 #endif // _IX_SERVICE_H_
00114 #endif // _QX_ENABLE_QT_NETWORK_DEPENDENCY