jdl-api-cpp-3.4.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JdlAttributeList.h
Go to the documentation of this file.
1 /*
2 Copyright (c) Members of the EGEE Collaboration. 2004.
3 See http://www.eu-egee.org/partners/ for details on the
4 copyright holders.
5 
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 */
19 
20 #ifndef GLITE_WMS_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
21 #define GLITE_WMS_COMMON_REQUESTAD_JDLATTRIBUTELIST_H
22 /*
23  * JdlAttributeList.h
24  * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
25  * Contributors are mentioned in the code where appropriate.
26  *
27  */
28 #include <list>
29 #include <string>
30 #include <vector>
31 #include <stdlib.h>
32 #include <algorithm>
33 #include <classad_distribution.h>
34 
35 #define JDL_ARRAY 30
36 #define JDLATTR_SET_METHOD(method) string METHOD = method
37 
38 namespace glite {
39 namespace jdl {
40 
48 public:
49  //Constuctor
51  virtual ~JdlAttributeList() throw() {};
52 
58  bool findBool(const std::string& attr_name) {return findAttr (attr_name , boolAttrs ); };
64  bool findInt(const std::string& attr_name) {return findAttr (attr_name , intAttrs ); };
70  bool findString(const std::string& attr_name) {return findAttr (attr_name , stringAttrs); };
76  bool findDouble(const std::string& attr_name){return findAttr (attr_name , doubleAttrs); };
82  bool findAd(const std::string& attr_name) {return findAttr (attr_name , adAttrs); };
88  bool findList(const std::string& attr_name) {return findAttr (attr_name , listAttrs ); };
94  bool findExpr(const std::string& attr_name) {return findAttr (attr_name , exprAttrs ); };
100  bool findCheck(const std::string& attr_name){ return findAttr (attr_name , checkAttrs ); };
106  bool findAttribute(const std::string& attr_name) ;
114  bool findAttr (const std::string& attr_name , std::vector<std::string> values) const ;
122  bool findTail (const std::string& attr_name , std::vector<std::string> values) const ;
129  void checkInt(const std::string& attr_name, int attr_value) ;
134  void checkDouble(const std::string& attr_name, const double& attr_value) ;
139  void checkBool(const std::string& attr_name, const bool& attr_value) ;
144  void checkString(const std::string& attr_name, const std::string& attr_value) ;
149  void checkAd(const std::string& attr_name, classad::ClassAd* attr_value) ;
155  void checkExpr(const std::string& attr_name, const std::string& attr_value) ;
156 
158  enum Attr {
165  } ;
171  void setDefault ( Attr attr_name , const std::string& attr_value) ;
172 
173  private:
174  std::vector<std::string> defaultAttrs ;
175  std::vector<std::string> stringAttrs ;
176  std::vector<std::string> intAttrs ;
177  std::vector<std::string> doubleAttrs;
178  std::vector<std::string> boolAttrs;
179  std::vector<std::string> adAttrs;
180  std::vector<std::string> listAttrs;
181  std::vector<std::string> exprAttrs;
182  std::vector<std::string> checkAttrs;
183  // JobAd is allowed to access to all JdlAttributeList members
184  friend class JobAd ;
185 };
186 
187 } // jdl namespace
188 } // glite namespace
189 
190 #endif
191 
192 
193 
Definition: JdlAttributeList.h:162
Definition: JdlAttributeList.h:159
bool findCheck(const std::string &attr_name)
Definition: JdlAttributeList.h:100
void checkBool(const std::string &attr_name, const bool &attr_value)
bool findAttribute(const std::string &attr_name)
bool findDouble(const std::string &attr_name)
Definition: JdlAttributeList.h:76
Provides a representation of the job description in the JDL language.
Definition: JobAd.h:55
bool findAd(const std::string &attr_name)
Definition: JdlAttributeList.h:82
Definition: JdlAttributeList.h:160
virtual ~JdlAttributeList()
Definition: JdlAttributeList.h:51
bool findInt(const std::string &attr_name)
Definition: JdlAttributeList.h:64
bool findAttr(const std::string &attr_name, std::vector< std::string > values) const
bool findExpr(const std::string &attr_name)
Definition: JdlAttributeList.h:94
Definition: JdlAttributeList.h:47
bool findBool(const std::string &attr_name)
Definition: JdlAttributeList.h:58
void checkString(const std::string &attr_name, const std::string &attr_value)
void setDefault(Attr attr_name, const std::string &attr_value)
void checkDouble(const std::string &attr_name, const double &attr_value)
bool findTail(const std::string &attr_name, std::vector< std::string > values) const
void checkInt(const std::string &attr_name, int attr_value)
Attr
Definition: JdlAttributeList.h:158
void checkExpr(const std::string &attr_name, const std::string &attr_value)
Definition: JdlAttributeList.h:164
Definition: JdlAttributeList.h:163
bool findList(const std::string &attr_name)
Definition: JdlAttributeList.h:88
bool findString(const std::string &attr_name)
Definition: JdlAttributeList.h:70
void checkAd(const std::string &attr_name, classad::ClassAd *attr_value)