00001 #ifndef SAGA_PACKAGES_JOB_JOB_SERVICE_HPP
00002 #define SAGA_PACKAGES_JOB_JOB_SERVICE_HPP
00003
00004 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/job_service.hpp")
00006 #endif
00007
00008
00009
00010
00011
00012
00013 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00014 #pragma wave option(output: null)
00015 #endif
00016
00017 #include <string>
00018 #include <vector>
00019
00020
00021 #include <saga/saga/util.hpp>
00022 #include <saga/saga/base.hpp>
00023 #include <saga/saga/types.hpp>
00024 #include <saga/saga/session.hpp>
00025 #include <saga/saga/call.hpp>
00026 #include <saga/saga/url.hpp>
00027
00028 #include <saga/saga/packages/job/config.hpp>
00029 #include <saga/saga/job.hpp>
00030
00031
00032 #if defined(BOOST_MSVC)
00033 #pragma warning(push)
00034 #pragma warning(disable: 4251 4231 4275 4660)
00035 #endif
00036
00037 #ifdef SAGA_DEBUG
00038 #include <saga/saga/packages/job/preprocessed/job_service.hpp>
00039 #else
00040
00041 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00042 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/job_service.hpp")
00043 #endif
00045 namespace saga
00046 {
00047 namespace job {
00048
00056 class SAGA_JOB_PACKAGE_EXPORT service
00057 : public saga::object
00058 {
00059 private:
00060 SAGA_CALL_PRIV_1(create_job, description);
00061 SAGA_CALL_PRIV_5(run_job, std::string, std::string,
00062 saga::job::ostream&, saga::job::istream&, saga::job::istream&);
00063 SAGA_CALL_PRIV_2(run_job, std::string, std::string)
00064 SAGA_CALL_PRIV_0(list);
00065 SAGA_CALL_PRIV_1(get_job, std::string);
00066 SAGA_CALL_PRIV_0(get_self);
00067
00068 protected:
00070
00071 friend class saga::impl::job_service;
00072 TR1::shared_ptr <saga::impl::job_service> get_impl (void) const;
00073 explicit service(saga::impl::job_service *impl);
00075
00076 public:
00081 explicit service (session const& s, saga::url rm = saga::url());
00082
00087 explicit service (saga::url rm = saga::url());
00088
00093 explicit service (saga::object const& o);
00094
00099 ~service (void);
00100
00105 service& operator= (saga::object const& o);
00106
00113 job create_job(description job_desc)
00114 {
00115 saga::task t = create_jobpriv(job_desc, saga::task_base::Sync());
00116 return t.get_result<saga::job::job>();
00117 }
00118 SAGA_CALL_PUB_1_DEF_0(create_job, description)
00119
00120
00126 job run_job(std::string hostname, std::string commandline,
00127 saga::job::ostream& stdin_stream, saga::job::istream& stdout_stream,
00128 saga::job::istream& stderr_stream)
00129 {
00130 saga::task t = run_jobpriv(hostname, commandline, stdin_stream,
00131 stdout_stream, stderr_stream, saga::task_base::Sync());
00132 return t.get_result<saga::job::job>();
00133 }
00135 SAGA_CALL_PUB_5_DEF_0(run_job, std::string, std::string,
00136 saga::job::ostream&, saga::job::istream&, saga::job::istream&)
00138
00139 job run_job(std::string hostname, std::string commandline)
00140 {
00141 saga::task t = run_jobpriv(hostname, commandline, saga::task_base::Sync());
00142 return t.get_result<saga::job::job>();
00143 }
00145 SAGA_CALL_PUB_2_DEF_0(run_job, std::string, std::string)
00147
00148
00149
00155 std::vector<std::string> list(void)
00156 {
00157 saga::task t = listpriv(saga::task_base::Sync());
00158 return t.get_result<std::vector<std::string> >();
00159 }
00160 SAGA_CALL_PUB_0_DEF_0(list)
00161
00162
00169 job get_job(std::string job_id)
00170 {
00171 saga::task t = get_jobpriv(job_id, saga::task_base::Sync());
00172 return t.get_result<saga::job::job>();
00173 }
00175 SAGA_CALL_PUB_1_DEF_0(get_job, std::string);
00177
00184 saga::job::self get_self()
00185 {
00186 saga::task t = get_selfpriv(saga::task_base::Sync());
00187 return t.get_result<saga::job::self>();
00188 }
00189 SAGA_CALL_PUB_0_DEF_0(get_self)
00190
00191 };
00192
00193 }}
00194
00196 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00197 #pragma wave option(output: null)
00198 #endif
00199
00200 #endif // !defined(SAGA_DEBUG)
00201
00202
00203 #if defined(BOOST_MSVC)
00204 #pragma warning(pop)
00205 #endif
00206
00207 #endif // !defined(SAGA_PACKAGES_JOB_JOB_SERVICE_HPP)
00208