SAGA C++ API 1.6
rpc.hpp
Go to the documentation of this file.
00001 //  Copyright (c) 2005-2009 Hartmut Kaiser
00002 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
00003 // 
00004 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00005 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00006 
00007 #ifndef SAGA_PACKAGES_COMM_RPC_RPC_HPP
00008 #define SAGA_PACKAGES_COMM_RPC_RPC_HPP
00009 
00010 // include stl
00011 #include <string>
00012 #include <vector>
00013 
00014 // include dependent spec sections
00015 #include <saga/saga/util.hpp>
00016 #include <saga/saga/base.hpp>
00017 #include <saga/saga/types.hpp>
00018 #include <saga/saga/session.hpp>
00019 #include <saga/saga/call.hpp>
00020 #include <saga/saga/task.hpp>
00021 #include <saga/saga/url.hpp>
00022 
00023 #include <saga/saga/detail/permissions.hpp>
00024 
00025 #include <saga/saga/packages/rpc/config.hpp>
00026 #include <saga/saga/packages/rpc/parameter.hpp>
00027 
00028 // suppress warnings about dependent classes not being exported from the dll
00029 #if defined(BOOST_MSVC)
00030 #pragma warning(push)
00031 #pragma warning(disable: 4251 4231 4275 4660)
00032 #endif
00033 
00034 namespace saga
00035 {
00040     namespace rpc {
00041  
00048      class SAGA_RPC_PACKAGE_EXPORT rpc 
00049         : public saga::object,
00050           public saga::detail::permissions<rpc>
00051     {
00052     protected:
00054 
00055         TR1::shared_ptr <saga::impl::rpc> get_impl_sp(void) const;
00056         saga::impl::rpc* get_impl (void) const;
00057         friend struct saga::detail::permissions<rpc>;
00058         friend class saga::impl::rpc;
00059         explicit rpc(saga::impl::rpc *impl);
00061 
00062     private:
00063         // factory
00064         SAGA_CALL_CREATE_PRIV_2(session const&, saga::url)
00065 
00066         SAGA_CALL_PRIV_1(call, std::vector<parameter>&)
00067         SAGA_CALL_PRIV_1(close, double)
00068 
00069     public:
00075         explicit rpc (session const& s, saga::url name = saga::url());
00076 
00081         explicit rpc (saga::url name);
00082 
00087         rpc (void);
00088 
00093         ~rpc (void);
00094 
00098         static rpc create(session const& s, saga::url name = saga::url())
00099         {
00100             return rpc(s, name);
00101         }
00103         SAGA_CALL_CREATE_2_DEF_1(session const&, saga::url, saga::url())
00105 
00108         static rpc create(saga::url name = saga::url())
00109         {
00110             return rpc(name);
00111         }
00112         template <typename Tag>
00113         static saga::task create(saga::url name = saga::url())
00114         {
00115             return create<Tag>(detail::get_the_session(), name);
00116         }
00117 
00122         void call(std::vector<parameter> parameters) 
00123         {
00124             saga::task t = callpriv(parameters, saga::task_base::Sync()); 
00125             t.get_result ();
00126         }
00128         SAGA_CALL_PUB_1_DEF_0(call, std::vector<parameter>&)
00130 
00135         void close(double timeout = 0.0) 
00136         {
00137             saga::task t = closepriv(timeout, saga::task_base::Sync()); 
00138             t.get_result ();
00139         }
00141         SAGA_CALL_PUB_1_DEF_1(close, double, 0.0)
00143     }; 
00144 
00145 }}
00146 
00147 // re-enable warnings about dependent classes not being exported from the dll
00148 #if defined(BOOST_MSVC)
00149 #pragma warning(pop)
00150 #endif
00151 
00152 #endif // SAGA_PACKAGES_COMM_RPC_RPC_HPP
00153 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines