QxOrm 1.1.6
C++ Object Relational Mapping library
QxService.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_H_
00028 #define _QX_SERVICE_H_
00029 
00030 #ifdef _MSC_VER
00031 #pragma once
00032 #endif
00033 
00041 #include <QxRegister/QxClass.h>
00042 
00043 #include <QxService/IxService.h>
00044 
00045 namespace qx {
00046 namespace service {
00047 
00054 template <class INPUT, class OUTPUT>
00055 class QxService : public IxService
00056 {
00057 
00058 protected:
00059 
00060    enum { is_input_parameter = boost::is_base_of<IxParameter, INPUT>::value };
00061    enum { is_output_parameter = boost::is_base_of<IxParameter, OUTPUT>::value };
00062    enum { is_input_registered = qx::trait::is_qx_registered<INPUT>::value };
00063    enum { is_output_registered = qx::trait::is_qx_registered<OUTPUT>::value };
00064    enum { is_valid_parameter = (is_input_parameter && is_output_parameter && is_input_registered && is_output_registered) };
00065 
00066    typedef boost::shared_ptr<INPUT> INPUT_ptr;
00067    typedef boost::shared_ptr<OUTPUT> OUTPUT_ptr;
00068 
00069 public:
00070 
00071    QxService(const QString & sServiceName) : IxService(sServiceName) { BOOST_STATIC_ASSERT(is_valid_parameter); }
00072    virtual ~QxService() { ; }
00073 
00074    INPUT_ptr getInputParameter() const    { return boost::static_pointer_cast<INPUT>(m_pInputParameter); }
00075    OUTPUT_ptr getOutputParameter() const  { return boost::static_pointer_cast<OUTPUT>(m_pOutputParameter); }
00076 
00077    virtual void registerClass() const { qx::QxClass<INPUT>::getSingleton(); qx::QxClass<OUTPUT>::getSingleton(); }
00078 
00079 };
00080 
00081 } // namespace service
00082 } // namespace qx
00083 
00084 #endif // _QX_SERVICE_H_
00085 #endif // _QX_ENABLE_QT_NETWORK_DEPENDENCY
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines