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_AD_H
00021 #define GLITE_WMS_COMMON_REQUESTAD_AD_H
00022
00023
00024
00025
00026
00027
00028
00051 #include "classad_distribution.h"
00052
00053 namespace glite {
00054 namespace jdl {
00055
00067 class Ad : protected classad::ClassAd{
00068 public :
00073 Ad() ;
00076 virtual ~Ad() throw();
00080 Ad(const classad::ClassAd& classAd );
00084 Ad(const std::string& jdl_string) ;
00085 Ad(const Ad& jobad);
00087 virtual void operator=(const Ad& jobad);
00088
00090
00096 void fromString(const std::string& jdl_string, std::string jdl_file= "") ;
00100 void fromFile(const std::string& jdl_file) ;
00105 void fromStream(std::istream& jdl_in) ;
00109 virtual void fromClassAd(const classad::ClassAd& classAd);
00111
00116 virtual std::string toString();
00120 virtual std::string toString( const std::string& attr_name );
00124 virtual std::string toLines();
00127 bool isSet() ;
00129 void clear();
00131
00135 classad::ClassAd* const ad(){return static_cast<ClassAd*>(Copy());}
00139 bool hasAttribute(const std::string& attr_name);
00145 virtual classad::ExprTree* delAttribute(const std::string& attr_name) ;
00150 void remAttribute(const std::string& attr_name) ;
00155 virtual classad::ExprTree* lookUp(const std::string& attr_name){ return Lookup(attr_name);};
00156
00159 bool hasAttribute(const std::string& attr_name, const std::string& attr_value);
00164 std::vector<std::string> attributes() ;
00171 void merge (Ad source, bool overwrite=true);
00173
00175 enum {
00178 TYPE_UNKNOWN = classad::Value::ERROR_VALUE,
00181 TYPE_INTEGER =classad::Value::INTEGER_VALUE,
00184 TYPE_BOOLEAN =classad::Value::BOOLEAN_VALUE,
00187 TYPE_STRING =classad::Value::STRING_VALUE,
00190 TYPE_REAL =classad::Value::REAL_VALUE,
00193 TYPE_CLASSAD =classad::Value::CLASSAD_VALUE,
00196 TYPE_EXPRESSION =classad::Value::UNDEFINED_VALUE
00197 };
00210 int getType (const std::string& attr_name ) ;
00218 void addAttribute (const std::string& attr_name, int attr_value) ;
00226 void addAttribute (const std::string& attr_name, double attr_value) ;
00234 void addAttribute (const std::string& attr_name, bool attr_value) ;
00243 void addAttribute (const std::string& attr_name, const std::string& attr_value);
00252 void addAttribute (const std::string& attr_name, const char *attr_value){addAttribute(attr_name , std::string(attr_value));}
00261 void addAttribute (const std::string& attr_name, Ad* attr_value);
00268 virtual void setAttributeExpr (const std::string& attr_name, const std::string& attr_value);
00275 virtual void setAttribute (const std::string& attr_name, int attr_value) ;
00282 virtual void setAttribute (const std::string& attr_name, const std::string& attr_value) ;
00289 virtual void setAttribute (const std::string& attr_name, const char *attr_value ) { setAttribute (attr_name , std::string(attr_value) ); }
00296 virtual void setAttribute (const std::string& attr_name, double attr_value) ;
00303 virtual void setAttribute (const std::string& attr_name, bool attr_value) ;
00310 virtual void setAttribute (const std::string& attr_name, Ad* attr_value) ;
00317 virtual void setAttributeExpr (const std::string& attr_name, classad::ExprTree* attr_value) ;
00324 virtual std::string getAttributeExpr (const std::string& attr_name) ;
00331 std::vector<int> getIntValue(const std::string& attr_name) ;
00338 std::vector<double> getDoubleValue(const std::string& attr_name) ;
00345 std::vector<bool> getBoolValue(const std::string& attr_name) ;
00352 virtual std::vector<std::string> getStringValue(const std::string& attr_name) ;
00359 std::vector<std::vector<std::string> > getStringList(const std::string& attr_name) ;
00366 virtual Ad getAd(const std::string& attr_name);
00373 virtual std::string getString(const std::string& attr_name) ;
00380 virtual int getInt(const std::string& attr_name) ;
00387 virtual double getDouble(const std::string& attr_name) ;
00394 virtual bool getBool(const std::string& attr_name) ;
00396
00404 bool hasWarnings();
00411 std::vector<std::string> getWarnings();
00418 void addWarning(const std::string &msg);
00420 protected:
00428 virtual void addAttribute(std::string attr_name , classad::Value val) ;
00435 virtual void appendValue(classad::ExprTree* tree , const classad::Value& val, const std::string& attr_name) ;
00441 virtual void insertAttribute(const std::string& attr_name , classad::ExprTree* val);
00447 virtual void insertAttribute(const std::string& attr_name , classad::Value val);
00453 virtual classad::Value getTypeValue(const std::string& attr_name);
00458 bool hasAttribute( classad::ExprTree* tree , const std::string& attr_value);
00460 std::vector<std::string> warning_messages_v ;
00461
00462 };
00463
00464
00465
00466
00467 std::string glite_wms_jdl_toLower ( const std::string &src);
00468 }
00469 }
00470
00471 #endif
00472
00473
00474