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

Ad.h

Go to the documentation of this file.
00001 #ifndef  EDG_WORKLOAD_COMMON_REQUESTAD_AD_H
00002 #define EDG_WORKLOAD_COMMON_REQUESTAD_AD_H
00003 /*
00004  * Ad.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 #include  "edg/workload/common/requestad/requestad_namespace.h"
00009 #include "classad_distribution.h"
00010 
00011 COMMON_REQUESTAD_NAMESPACE_BEGIN  //Defining UserInterFace NameSpace
00022 class Ad : protected classad::ClassAd{
00023         public :
00028                 Ad() ;
00031                 virtual ~Ad() throw();
00035                 Ad(const classad::ClassAd& classAd );
00039                 Ad(const std::string& jdl_string) ;
00042                 classad::ClassAd* ad() {  return Copy() ;  } ;
00044 
00049                 virtual void fromString(const std::string& jdl_string) ;
00050 
00054                 virtual void fromFile(const std::string& jdl_file) ;
00056 
00060                 virtual std::string toString();
00064                 virtual std::string toString( const std::string& attr_name );
00068                 virtual std::string toLines();
00071                 bool isSet() ;
00073                 void clear();
00075 
00080                 bool hasAttribute(const std::string& attr_name);
00084                 virtual classad::ExprTree* delAttribute(const std::string& attr_name) ;
00085 
00088                 bool hasAttribute(const std::string& attr_name, const std::string& attr_value);
00092                 std::vector<std::string> attributes() ;
00094 
00097                 enum {
00098                 TYPE_UNKNOWN = classad::Value::ERROR_VALUE,
00101                 TYPE_INTEGER =classad::Value::INTEGER_VALUE,
00104                 TYPE_BOOLEAN =classad::Value::BOOLEAN_VALUE,
00107                 TYPE_STRING =classad::Value::STRING_VALUE,
00110                 TYPE_REAL =classad::Value::REAL_VALUE,
00113                 TYPE_EXPRESSION =classad::Value::UNDEFINED_VALUE
00114                 };
00126                 int getType (const std::string& attr_name )   ;
00127 
00128 
00129 
00137                 void  addAttribute (const std::string& attr_name, int attr_value)          ;
00138 
00146                 void  addAttribute (const std::string& attr_name, double attr_value)       ;
00154                 void  addAttribute (const std::string& attr_name, bool attr_value)         ;
00163                 void  addAttribute (const std::string& attr_name, const std::string& attr_value);
00164 
00173                 void  addAttribute (const std::string& attr_name, Ad* attr_value);
00174 
00175 
00183                 virtual void  setAttributeExpr (const std::string& attr_name, const std::string& attr_value);
00184 
00185 
00193                 virtual void  setAttribute (const std::string& attr_name, int attr_value) ;
00200                 virtual void  setAttribute (const std::string& attr_name, const std::string& attr_value) ;
00208                 virtual void  setAttribute (const std::string& attr_name, double attr_value)   ;
00216                 virtual void  setAttribute (const std::string& attr_name, bool attr_value)   ;
00224                 virtual void  setAttribute (const std::string& attr_name, Ad* attr_value) ;
00231                 virtual std::string  getAttributeExpr (const std::string& attr_name)    ;
00232 
00239                 std::vector<int> getIntValue(const std::string& attr_name) ;
00246                 std::vector<double> getDoubleValue(const std::string& attr_name) ;
00253                 std::vector<bool> getBoolValue(const std::string& attr_name) ;
00260                 std::vector<std::string> getStringValue(const std::string& attr_name) ;
00267                 std::vector<std::vector<std::string> > getStringList(const std::string& attr_name) ;
00269 
00270         protected:
00275                 std::string toLower ( const std::string &src) ;
00283                 virtual void addAttribute(std::string attr_name , classad::Value val) ;
00290                 virtual void appendValue(classad::ExprTree* tree , const classad::Value& val, const std::string& attr_name) ;
00296                 virtual void insertAttribute(const std::string& attr_name , classad::ExprTree* val);
00302                 virtual void insertAttribute(const std::string& attr_name , classad::Value val);
00308                 virtual classad::Value getTypeValue(const std::string& attr_name);
00313                 bool hasAttribute( classad::ExprTree* tree ,  const std::string& attr_value);
00314         private:
00315                 // meaningless: utilised for future implementation (like DAG)
00316                 friend class ExpDagAd ;
00317                 virtual classad::ClassAd* fromString(const std::string& father , std::string& jdl_string , std::string& fxm  ) ;
00318                 virtual classad::ExprList* fromList(const std::string& father , std::string& jdl_string, std::string& fxm) ;
00319                 virtual classad::ExprTree* readValue(const std::string& father , std::string& jdl_string, std::string& fxm) ;
00320 };
00321 }  // requestad namespace
00322 COMMON_NAMESPACE_END } //Closing  UserInterFace NameSpace
00323 #endif
00324 
00325 //EOF
00326 

Generated on Wed Mar 1 00:37:54 2006 for COMMON API - configuration, jobid, ldif2classadi, logger, process, requestad, socket++i, task, utilities by doxygen 1.3.5