00001 #ifndef EDG_WORKLOAD_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00002 #define EDG_WORKLOAD_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00003
00004
00005
00006
00007
00008
00009 #include <list>
00010 #include <string>
00011 #include <vector>
00012 #include <stdlib.h>
00013 #include <algorithm>
00014 #include "edg/workload/common/requestad/requestad_namespace.h"
00015
00016 #include "classad_distribution.h"
00017
00018
00019 #define JDL_ARRAY 30
00020 #define JDLATTR_SET_METHOD(method) string METHOD = method
00021
00022 COMMON_REQUESTAD_NAMESPACE_BEGIN
00023
00024
00031 class JdlAttributeList{
00032 public:
00033
00034 JdlAttributeList();
00035 virtual ~JdlAttributeList() throw() {};
00036
00037
00038 bool findBool(const std::string& attr_name) {return findAttr (attr_name , boolAttrs ); };
00039 bool findInt(const std::string& attr_name) {return findAttr (attr_name , intAttrs ); };
00040 bool findString(const std::string& attr_name) {return findAttr (attr_name , stringAttrs); };
00041 bool findDouble(const std::string& attr_name){return findAttr (attr_name , doubleAttrs); };
00042 bool findAd(const std::string& attr_name) {return findAttr (attr_name , adAttrs); };
00043 bool findList(const std::string& attr_name) {return findAttr (attr_name , listAttrs ); };
00044 bool findExpr(const std::string& attr_name) {return findAttr (attr_name , exprAttrs ); };
00045 bool findCheck(const std::string& attr_name){ return findAttr (attr_name , checkAttrs ); };
00046
00047 bool findAttribute(const std::string& attr_name) ;
00048 bool findAttr (const std::string& attr_name , std::vector<std::string> ) const ;
00049 static std::string toLower ( const std::string & source) ;
00050
00051
00058 void checkInt(const std::string& attr_name, int attr_value) ;
00063 void checkDouble(const std::string& attr_name, const double& attr_value) ;
00068 void checkBool(const std::string& attr_name, const bool& attr_value) ;
00073 void checkString(const std::string& attr_name, const std::string& attr_value) ;
00078 void checkAd(const std::string& attr_name, classad::ClassAd* attr_value) ;
00084 void checkExpr(const std::string& attr_name, const std::string& attr_value) ;
00085 enum Attr {
00086 JOBTYPE_MPICH_REQ_RTE,
00087 JOBTYPE_MPICH_REQ_CPU,
00088 JOBTYPE_MPICH_RANK_FREE,
00089 REQ_DEFAULT,
00090 RANK_DEFAULT,
00091 MAX_ATTR
00092 } ;
00093 void setDefault ( Attr attr_name , const std::string& attr_value) ;
00094
00095 private:
00096 std::vector<std::string> defaultAttrs ;
00097 std::vector<std::string> stringAttrs ;
00098 std::vector<std::string> intAttrs ;
00099 std::vector<std::string> doubleAttrs;
00100 std::vector<std::string> boolAttrs;
00101 std::vector<std::string> adAttrs;
00102 std::vector<std::string> listAttrs;
00103 std::vector<std::string> exprAttrs;
00104 std::vector<std::string> checkAttrs;
00105
00106
00107
00108 bool checking ;
00109
00110 friend class JobAd ;
00111 };
00112 }
00113 COMMON_NAMESPACE_END }
00114 #endif
00115
00116
00117