Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GLITE_WMS_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00021 #define GLITE_WMS_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00022
00023
00024
00025
00026
00027
00028 #include <list>
00029 #include <string>
00030 #include <vector>
00031 #include <stdlib.h>
00032 #include <algorithm>
00033 #include <classad_distribution.h>
00034
00035 #define JDL_ARRAY 30
00036 #define JDLATTR_SET_METHOD(method) string METHOD = method
00037
00038 namespace glite {
00039 namespace jdl {
00040
00047 class JdlAttributeList{
00048 public:
00049
00050 JdlAttributeList();
00051 virtual ~JdlAttributeList() throw() {};
00052
00058 bool findBool(const std::string& attr_name) {return findAttr (attr_name , boolAttrs ); };
00064 bool findInt(const std::string& attr_name) {return findAttr (attr_name , intAttrs ); };
00070 bool findString(const std::string& attr_name) {return findAttr (attr_name , stringAttrs); };
00076 bool findDouble(const std::string& attr_name){return findAttr (attr_name , doubleAttrs); };
00082 bool findAd(const std::string& attr_name) {return findAttr (attr_name , adAttrs); };
00088 bool findList(const std::string& attr_name) {return findAttr (attr_name , listAttrs ); };
00094 bool findExpr(const std::string& attr_name) {return findAttr (attr_name , exprAttrs ); };
00100 bool findCheck(const std::string& attr_name){ return findAttr (attr_name , checkAttrs ); };
00106 bool findAttribute(const std::string& attr_name) ;
00114 bool findAttr (const std::string& attr_name , std::vector<std::string> values) const ;
00122 bool findTail (const std::string& attr_name , std::vector<std::string> values) const ;
00129 void checkInt(const std::string& attr_name, int attr_value) ;
00134 void checkDouble(const std::string& attr_name, const double& attr_value) ;
00139 void checkBool(const std::string& attr_name, const bool& attr_value) ;
00144 void checkString(const std::string& attr_name, const std::string& attr_value) ;
00149 void checkAd(const std::string& attr_name, classad::ClassAd* attr_value) ;
00155 void checkExpr(const std::string& attr_name, const std::string& attr_value) ;
00156
00158 enum Attr {
00159 JOBTYPE_MPICH_REQ_RTE,
00160 JOBTYPE_MPICH_REQ_CPU,
00161 JOBTYPE_MPICH_RANK_FREE,
00162 REQ_DEFAULT,
00163 RANK_DEFAULT,
00164 MAX_ATTR
00165 } ;
00171 void setDefault ( Attr attr_name , const std::string& attr_value) ;
00172
00173 private:
00174 std::vector<std::string> defaultAttrs ;
00175 std::vector<std::string> stringAttrs ;
00176 std::vector<std::string> intAttrs ;
00177 std::vector<std::string> doubleAttrs;
00178 std::vector<std::string> boolAttrs;
00179 std::vector<std::string> adAttrs;
00180 std::vector<std::string> listAttrs;
00181 std::vector<std::string> exprAttrs;
00182 std::vector<std::string> checkAttrs;
00183
00184 friend class JobAd ;
00185 };
00186
00187 }
00188 }
00189
00190 #endif
00191
00192
00193