glite/jdl/JdlAttributeList.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) Members of the EGEE Collaboration. 2004.
00003 See http://www.eu-egee.org/partners/ for details on the
00004 copyright holders.
00005 
00006 Licensed under the Apache License, Version 2.0 (the "License");
00007 you may not use this file except in compliance with the License.
00008 You may obtain a copy of the License at
00009 
00010     http://www.apache.org/licenses/LICENSE-2.0
00011 
00012 Unless required by applicable law or agreed to in writing, software
00013 distributed under the License is distributed on an "AS IS" BASIS,
00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
00015 either express or implied.
00016 See the License for the specific language governing permissions and
00017 limitations under the License.
00018 */
00019 
00020 #ifndef GLITE_WMS_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00021 #define GLITE_WMS_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
00022 /*
00023  * JdlAttributeList.h
00024  * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
00025  * Contributors are mentioned in the code where appropriate.
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     //Constuctor
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     // JobAd is allowed to access to all JdlAttributeList members
00184     friend class JobAd ;
00185 };
00186 
00187 } // jdl namespace
00188 } // glite namespace
00189 
00190 #endif
00191 
00192 
00193 

Generated on 9 Feb 2014 for jdl-api-cpp-3.4.3 by  doxygen 1.4.7