SAGA Adaptor CPI v.1.0
|
00001 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00002 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/service.cpp") 00003 #endif 00004 // Copyright (c) 2005-2009 Hartmut Kaiser 00005 // Copyright (c) 2008 Andre Merzky (andre@merzky.net) 00006 // 00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00009 00010 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00011 #pragma wave option(output: null) 00012 #endif 00013 00014 // include service api and implementation 00015 #include <saga/saga/cpr.hpp> 00016 #include <saga/impl/cpr.hpp> 00017 #include <saga/saga/adaptors/task.hpp> 00018 #include <saga/saga/detail/call.hpp> 00019 00020 #ifdef SAGA_DEBUG 00021 #include <saga/saga/packages/cpr/preprocessed/service.cpp> 00022 #else 00023 00024 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00025 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/service.cpp") 00026 #endif 00027 00028 namespace saga 00029 { 00030 namespace cpr { 00031 00032 service::service (session const &s, saga::url rm) 00033 : saga::job::service (new saga::impl::cpr_job_service (s, rm)) 00034 { 00035 this->saga::object::get_impl()->init(); 00036 } 00037 00038 service::service (saga::url rm) 00039 : saga::job::service (new saga::impl::cpr_job_service(detail::get_the_session(), rm)) 00040 { 00041 this->saga::object::get_impl()->init(); 00042 } 00043 00044 service::service (saga::object const& o) 00045 : saga::job::service (o) 00046 { 00047 if (this->get_type() != saga::object::CPRJobService) 00048 { 00049 SAGA_THROW("Bad type conversion.", saga::BadParameter); 00050 } 00051 } 00052 00053 service::service (saga::impl::cpr_job_service *impl) 00054 : saga::job::service (impl) 00055 { 00056 } 00057 00058 service::service (int) 00059 { 00060 } 00061 00062 service::~service (void) 00063 { 00064 } 00065 00066 service &service::operator= (saga::object const& o) 00067 { 00068 if (this != &o) 00069 this->saga::object::operator=(o); 00070 return *this; 00071 } 00072 00073 saga::impl::cpr_job_service* service::get_impl() const 00074 { 00075 typedef saga::object base_type; 00076 return static_cast<saga::impl::cpr_job_service*>(this->base_type::get_impl()); 00077 } 00078 00079 TR1::shared_ptr <saga::impl::cpr_job_service> service::get_impl_sp(void) const 00080 { 00081 // FIXME: this needs documentation 00082 typedef saga::object base_type; 00083 return TR1::static_pointer_cast <saga::impl::cpr_job_service> ( 00084 this->base_type::get_impl_sp()); 00085 } 00086 00087 // methods of the service 00089 // factory 00090 SAGA_CALL_CREATE_IMP_2(service, impl::cpr_job_service, session const&, saga::url) 00091 00092 SAGA_CALL_IMP_1 (service, create_job, saga::cpr::description); 00093 SAGA_CALL_IMP_2_EX (service, create_job, create_job_cpr, saga::cpr::description, saga::cpr::description); 00094 SAGA_CALL_IMP_5 (service, run_job, std::string, std::string, 00095 saga::job::ostream &, 00096 saga::job::istream &, 00097 saga::job::istream &); 00098 SAGA_CALL_IMP_2_EX (service, run_job, run_job_noio, std::string, std::string); 00100 } 00101 00102 } // namespace saga 00104 00105 #endif 00106