Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

JdlAttributeList.h

00001 #ifndef  EDG_WORKLOAD_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00002 #define EDG_WORKLOAD_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00003 /*
00004  * JdlAttributeList.h
00005  * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
00006  * Contributors are mentioned in the code where appropriate.
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 // #include  "edg/workload/common/common_namespace.h"
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 // COMMON_NAMESPACE_BEGIN{
00024 // namespace requestad{
00031 class  JdlAttributeList{
00032 public:
00033     //Constuctor
00034     JdlAttributeList();
00035     virtual ~JdlAttributeList() throw() {};
00036 
00037     //Find Methods
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     //This funcion finds a string out of a list of strings
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     // bool  findString(const std::string& attr_name , std::list<std::string> vect );  //TBD DEPRECATED
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     //This function is called by Find methods
00107     // bool  findAttr (const std::string& attr_name , std::string lis[]) const ;
00108     bool checking ;
00109     // JobAd is allowed to access to all JdlAttributeList members
00110     friend class JobAd ; //TBD needed????
00111 };
00112 }   // requestad namespace
00113 COMMON_NAMESPACE_END } //Closing  UserInterFace NameSpace
00114 #endif
00115 
00116 
00117 

Generated on Fri May 14 14:18:25 2004 for COMMON API - configuration, jobid, ldif2classadi, logger, process, requestad, socket++i, task, utilities by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002