Back to index

nordugrid-arc-nox  1.1.0~rc6
job_desc.h
Go to the documentation of this file.
00001 #ifndef __ARC_GM_JOB_DESC_H__
00002 #define __ARC_GM_JOB_DESC_H__
00003 #include <string>
00004 #include <iostream>
00005 
00006 #include <arc/client/JobDescription.h>
00007 
00008 #include "users.h"
00009 #include "job.h"
00010 
00011 typedef enum {
00012   JobReqSuccess,
00013   JobReqInternalFailure,
00014   JobReqSyntaxFailure,
00015   JobReqMissingFailure,
00016   JobReqUnsupportedFailure,
00017   JobReqLogicalFailure
00018 } JobReqResult;
00019 
00029 bool get_arc_job_description(const std::string& fname, Arc::JobDescription& desc);
00030 bool write_grami(const Arc::JobDescription& arc_job_desc, const JobDescription& job_desc, const JobUser& user, const char* opt_add);
00031 JobReqResult get_acl(const Arc::JobDescription& arc_job_desc, std::string& acl);
00032 bool check(const Arc::JobDescription& arc_job_desc);
00033 bool set_execs(const Arc::JobDescription& desc, const std::string& session_dir);
00034 
00035 class value_for_shell {
00036  friend std::ostream& operator<<(std::ostream&,const value_for_shell&);
00037  private:
00038   const char* str;
00039   bool quote;
00040  public:
00041   value_for_shell(const char *str_,bool quote_):str(str_),quote(quote_) { };
00042   value_for_shell(const std::string &str_,bool quote_):str(str_.c_str()),quote(quote_) { };
00043 };
00044 std::ostream& operator<<(std::ostream &o,const value_for_shell &s);
00045 
00046 class numvalue_for_shell {
00047  friend std::ostream& operator<<(std::ostream&,const numvalue_for_shell&);
00048  private:
00049   long int n;
00050  public:
00051   numvalue_for_shell(const char *str) { n=0; sscanf(str,"%li",&n); };
00052   numvalue_for_shell(int n_) { n=n_; };
00053   numvalue_for_shell operator/(int d) { return numvalue_for_shell(n/d); };
00054   numvalue_for_shell operator*(int d) { return numvalue_for_shell(n*d); };
00055 };
00056 std::ostream& operator<<(std::ostream &o,const numvalue_for_shell &s);
00057 
00058 #define NG_RSL_DEFAULT_STDIN      const_cast<char*>("/dev/null")
00059 #define NG_RSL_DEFAULT_STDOUT     const_cast<char*>("/dev/null")
00060 #define NG_RSL_DEFAULT_STDERR     const_cast<char*>("/dev/null")
00061 
00062 #endif