#include <src/requestad/Ad.h>
Inheritance diagram for glite::jdl::Ad:
It allows the user to create a valid ClassAd instance utilizing native classes and retrieve any kind of information from it. It is utilised as a superclass for JobAd class
Get Methods | |
enum | { TYPE_UNKNOWN = classad::Value::ERROR_VALUE, TYPE_INTEGER = classad::Value::INTEGER_VALUE, TYPE_BOOLEAN = classad::Value::BOOLEAN_VALUE, TYPE_STRING = classad::Value::STRING_VALUE, TYPE_REAL = classad::Value::REAL_VALUE, TYPE_CLASSAD = classad::Value::CLASSAD_VALUE, TYPE_EXPRESSION = classad::Value::UNDEFINED_VALUE } |
int | getType (const std::string &attr_name) |
Retrieve the type of the value specified for attr_name. | |
void | addAttribute (const std::string &attr_name, int attr_value) |
Allow adding a value to an already set attribute of the JobAd instance (i.e. | |
void | addAttribute (const std::string &attr_name, double attr_value) |
Allow adding a value to an already set attribute of the JobAd instance (i.e. | |
void | addAttribute (const std::string &attr_name, bool attr_value) |
Allow adding a value to an already set attribute of the JobAd instance (i.e. | |
void | addAttribute (const std::string &attr_name, const std::string &attr_value) |
Allow adding a value to an already set attribute of the Ad instance (i.e. | |
void | addAttribute (const std::string &attr_name, const char *attr_value) |
Allow adding a value to an already set attribute of the Ad instance (i.e. | |
void | addAttribute (const std::string &attr_name, Ad *attr_value) |
Allow adding a value to an already set attribute of the JobAd instance (i.e. | |
virtual void | setAttributeExpr (const std::string &attr_name, const std::string &attr_value) |
Add The specified Expression Attribute to the jdl istance. | |
virtual void | setAttribute (const std::string &attr_name, int attr_value) |
Add The specified Integer Attribute to the jdl istance. | |
virtual void | setAttribute (const std::string &attr_name, const std::string &attr_value) |
Add The specified String Attribute to the jdl istance. | |
virtual void | setAttribute (const std::string &attr_name, const char *attr_value) |
Add The specified String Attribute to the jdl istance. | |
virtual void | setAttribute (const std::string &attr_name, double attr_value) |
Add The specified String Attribute to the jdl istance. | |
virtual void | setAttribute (const std::string &attr_name, bool attr_value) |
Add The specified String Attribute to the jdl istance. | |
virtual void | setAttribute (const std::string &attr_name, Ad *attr_value) |
Add The specified Integer Attribute to the jdl istance. | |
virtual void | setAttributeExpr (const std::string &attr_name, classad::ExprTree *attr_value) |
Add The specified Expression Attribute to the jdl istance. | |
virtual std::string | getAttributeExpr (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
std::vector< int > | getIntValue (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
std::vector< double > | getDoubleValue (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
std::vector< bool > | getBoolValue (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
virtual std::vector< std::string > | getStringValue (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
std::vector< std::vector< std::string > > | getStringList (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
virtual Ad | getAd (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
virtual std::string | getString (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
virtual int | getInt (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
virtual double | getDouble (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
virtual bool | getBool (const std::string &attr_name) |
Retreive the value of the specified attribute. | |
Public Member Functions | |
Constructors | |
Ad () | |
default Constructor | |
virtual | ~Ad () throw () |
Default Destructor. | |
Ad (const classad::ClassAd &classAd) | |
Constructor by ClassAd. | |
Ad (const std::string &jdl_string) | |
Constructor by string. | |
Ad (const Ad &jobad) | |
virtual void | operator= (const Ad &jobad) |
Operator "=" performs a deep copy of the Ad instance. | |
From methods | |
void | fromString (const std::string &jdl_string, std::string jdl_file="") |
Create an Ad instance from a string. | |
void | fromFile (const std::string &jdl_file) |
Create an Ad instacne from a file. | |
void | fromStream (std::istream &jdl_in) |
Create the JobAd object with the given input stream. | |
virtual void | fromClassAd (const classad::ClassAd &classAd) |
Create the JobAd object with the given classad. | |
To methods | |
virtual std::string | toString () |
Convert the Ad Instance into a single line string representation. | |
virtual std::string | toString (const std::string &attr_name) |
Convert an Ad attribute into its string representation. | |
virtual std::string | toLines () |
Convert the Ad Instance into a multi line indented string representation. | |
bool | isSet () |
Check whether the JobAd has been initialised. | |
void | clear () |
Reset the JobAd Instance. | |
general methods | |
classad::ClassAd *const | ad () |
Deep copy of Ad. | |
bool | hasAttribute (const std::string &attr_name) |
Check If the specified attribute has already been set. | |
virtual classad::ExprTree * | delAttribute (const std::string &attr_name) |
Delete an Attribute. | |
void | remAttribute (const std::string &attr_name) |
Delete an Attribute. | |
virtual classad::ExprTree * | lookUp (const std::string &attr_name) |
Returns an expression. | |
bool | hasAttribute (const std::string &attr_name, const std::string &attr_value) |
Check if the specified value is present in the specified attribute. | |
std::vector< std::string > | attributes () |
Retrieve the list of attribugtes present inside the instance. | |
void | merge (Ad source, bool overwrite=true) |
merge the attributes of the specified classad overriding the attribute with the same name Classad type attribute will be recoursively merged | |
Warnings Management | |
bool | hasWarnings () |
Determine whether there are any warning. | |
std::vector< std::string > | getWarnings () |
Retrieve all collected warnings Warnings may be due to usage of deprecated attributes, methods, procedures. | |
void | addWarning (const std::string &msg) |
Add a new warning message to Warnings may be due to usage of deprecated attributes, methods, procedures. | |
Protected Member Functions | |
virtual void | addAttribute (std::string attr_name, classad::Value val) |
Add a value to a list (if already present) or set the first value of this attribute. | |
virtual void | appendValue (classad::ExprTree *tree, const classad::Value &val, const std::string &attr_name) |
Append a value to a list. | |
virtual void | insertAttribute (const std::string &attr_name, classad::ExprTree *val) |
Insert a classad Exptression inside the Ad instance. | |
virtual void | insertAttribute (const std::string &attr_name, classad::Value val) |
Insert a classad Exptression inside the Ad instance. | |
virtual classad::Value | getTypeValue (const std::string &attr_name) |
Retrieve the Value of the specified attribute. | |
bool | hasAttribute (classad::ExprTree *tree, const std::string &attr_value) |
Check whether a value is present inside a classad Expression. | |
Protected Attributes | |
std::vector< std::string > | warning_messages_v |
Collection of all warning messages (if any). |
anonymous enum |
TYPE_UNKNOWN |
Unknown type.
|
TYPE_INTEGER |
Attribute Integer type value.
|
TYPE_BOOLEAN |
Attribute Boolean type value.
|
TYPE_STRING |
Attribute String type value.
|
TYPE_REAL |
Attribute Real/Double type value.
|
TYPE_CLASSAD |
Attribute Real/Double type value.
|
TYPE_EXPRESSION |
Attribute Expression type value.
|
glite::jdl::Ad::Ad | ( | ) |
default Constructor
virtual glite::jdl::Ad::~Ad | ( | ) | throw () [virtual] |
Default Destructor.
glite::jdl::Ad::Ad | ( | const classad::ClassAd & | classAd | ) |
glite::jdl::Ad::Ad | ( | const std::string & | jdl_string | ) |
glite::jdl::Ad::Ad | ( | const Ad & | jobad | ) |
classad::ClassAd* const glite::jdl::Ad::ad | ( | ) | [inline] |
virtual void glite::jdl::Ad::addAttribute | ( | std::string | attr_name, | |
classad::Value | val | |||
) | [protected, virtual] |
Add a value to a list (if already present) or set the first value of this attribute.
attr_name | a string representing the attribute name | |
val | The value of the attribute to be added |
AdMismatchException | The type of value is not allowed for the specified attribute name | |
AdFormatException | The type of value is not allowed for the specified attribute name |
void glite::jdl::Ad::addAttribute | ( | const std::string & | attr_name, | |
Ad * | attr_value | |||
) |
Allow adding a value to an already set attribute of the JobAd instance (i.e.
it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.
attr_name | a string representing the attribute name | |
attr_value | - The value of the attribute to be added |
AdMismatchException | - The type of value is not allowed for the specified attribute name | |
AdFormatException | The type of value is not allowed for the specified attribute name | |
AdSyntaxException | - Syntax error caught while trying to add the attribute |
void glite::jdl::Ad::addAttribute | ( | const std::string & | attr_name, | |
const char * | attr_value | |||
) | [inline] |
Allow adding a value to an already set attribute of the Ad instance (i.e.
it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.
attr_name | a string representing the attribute name | |
attr_value | - The value of the attribute to be added |
AdMismatchException | - The type of value is not allowed for the specified attribute name | |
AdFormatException | The type of value is not allowed for the specified attribute name | |
AdSyntaxException | - Syntax error caught while trying to add the attribute |
void glite::jdl::Ad::addAttribute | ( | const std::string & | attr_name, | |
const std::string & | attr_value | |||
) |
Allow adding a value to an already set attribute of the Ad instance (i.e.
it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.
attr_name | a string representing the attribute name | |
attr_value | - The value of the attribute to be added |
AdMismatchException | - The type of value is not allowed for the specified attribute name | |
AdFormatException | The type of value is not allowed for the specified attribute name | |
AdSyntaxException | - Syntax error caught while trying to add the attribute |
void glite::jdl::Ad::addAttribute | ( | const std::string & | attr_name, | |
bool | attr_value | |||
) |
Allow adding a value to an already set attribute of the JobAd instance (i.e.
it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.
attr_name | a string representing the attribute name | |
attr_value | - The value of the attribute to be added |
AdMismatchException | - The type of value is not allowed for the specified attribute name | |
AdSyntaxException | - Syntax error caught while trying to add the attribute |
void glite::jdl::Ad::addAttribute | ( | const std::string & | attr_name, | |
double | attr_value | |||
) |
Allow adding a value to an already set attribute of the JobAd instance (i.e.
it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.
attr_name | a string representing the attribute name | |
attr_value | - The value of the attribute to be added |
AdMismatchException | - The type of value is not allowed for the specified attribute name | |
AdSyntaxException | - Syntax error caught while trying to add the attribute |
void glite::jdl::Ad::addAttribute | ( | const std::string & | attr_name, | |
int | attr_value | |||
) |
Allow adding a value to an already set attribute of the JobAd instance (i.e.
it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.
attr_name | a string representing the attribute name | |
attr_value | - The value of the attribute to be added |
AdMismatchException | - The type of value is not allowed for the specified attribute name | |
AdSyntaxException | - Syntax error caught while trying to add the attribute |
void glite::jdl::Ad::addWarning | ( | const std::string & | msg | ) |
Add a new warning message to Warnings may be due to usage of deprecated attributes, methods, procedures.
msg | the warning message to be appended |
virtual void glite::jdl::Ad::appendValue | ( | classad::ExprTree * | tree, | |
const classad::Value & | val, | |||
const std::string & | attr_name | |||
) | [protected, virtual] |
Append a value to a list.
attr_name | a string representing the attribute name | |
val | - The value of the attribute to be added | |
tree | the current value (before appending) of the attribute |
std::vector<std::string> glite::jdl::Ad::attributes | ( | ) |
Retrieve the list of attribugtes present inside the instance.
void glite::jdl::Ad::clear | ( | ) |
Reset the JobAd Instance.
All the previous existing attributes will be deleted
virtual classad::ExprTree* glite::jdl::Ad::delAttribute | ( | const std::string & | attr_name | ) | [virtual] |
Delete an Attribute.
It fails if the attribute doesn't exist
AdEmptyException | attribute has not been set yet |
attr_name | The name of the attibute to be deleted |
Reimplemented in glite::jdl::JobAd.
virtual void glite::jdl::Ad::fromClassAd | ( | const classad::ClassAd & | classAd | ) | [virtual] |
Create the JobAd object with the given classad.
classAd | this is the job description passed as a classad |
Reimplemented in glite::jdl::JobAd.
void glite::jdl::Ad::fromFile | ( | const std::string & | jdl_file | ) |
Create an Ad instacne from a file.
jdl_file | the string representing the path containing the jdl to be parsed |
void glite::jdl::Ad::fromStream | ( | std::istream & | jdl_in | ) |
Create the JobAd object with the given input stream.
jdl_in | this is the job description passed in the form of a generic input stream so that it can be taken from a terminal input stream, file input stream, string streams etc. |
void glite::jdl::Ad::fromString | ( | const std::string & | jdl_string, | |
std::string | jdl_file = "" | |||
) |
virtual Ad glite::jdl::Ad::getAd | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The type of retrieved value is not allowed for the specified attribute name |
Reimplemented in glite::jdl::JobAd.
virtual std::string glite::jdl::Ad::getAttributeExpr | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | - The checked attribute has not been set yet | |
AdMismatchException | - The type of retrieved value is not allowed for the specified attribute name |
virtual bool glite::jdl::Ad::getBool | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The value is not a single bool |
Reimplemented in glite::jdl::JobAd.
std::vector<bool> glite::jdl::Ad::getBoolValue | ( | const std::string & | attr_name | ) |
Retreive the value of the specified attribute.
attr_name | The name of the attribute to be retrieved |
AdEmptyException | - The checked attribute has not been set yet | |
AdMismatchException | - The type of retrieved value is not allowed for the specified attribute name |
virtual double glite::jdl::Ad::getDouble | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The value is not a single double |
Reimplemented in glite::jdl::JobAd.
std::vector<double> glite::jdl::Ad::getDoubleValue | ( | const std::string & | attr_name | ) |
Retreive the value of the specified attribute.
attr_name | The name of the attribute to be retrieved |
AdEmptyException | - The checked attribute has not been set yet | |
AdMismatchException | - The type of retrieved value is not allowed for the specified attribute name |
virtual int glite::jdl::Ad::getInt | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The value is not a single int |
Reimplemented in glite::jdl::JobAd.
std::vector<int> glite::jdl::Ad::getIntValue | ( | const std::string & | attr_name | ) |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | - The checked attribute has not been set yet | |
AdMismatchException | - The type of retrieved value is not allowed for the specified attribute name |
virtual std::string glite::jdl::Ad::getString | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The value is not a single string |
Reimplemented in glite::jdl::JobAd.
std::vector<std::vector<std::string> > glite::jdl::Ad::getStringList | ( | const std::string & | attr_name | ) |
Retreive the value of the specified attribute.
attr_name | The name of the attribute to be retrieved |
AdEmptyException | - The checked attribute has not been set yet | |
AdMismatchException | - The type of retrieved value is not allowed for the specified attribute name |
virtual std::vector<std::string> glite::jdl::Ad::getStringValue | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute to be retrieved |
AdEmptyException | - The checked attribute has not been set yet | |
AdMismatchException | - The type of retrieved value is not allowed for the specified attribute name |
Reimplemented in glite::jdl::NodeAd, and glite::jdl::ParametricAd.
int glite::jdl::Ad::getType | ( | const std::string & | attr_name | ) |
Retrieve the type of the value specified for attr_name.
attr_name | the name of the attribute |
AdEmptyException | if the attribute is not present in the JobAd instance |
virtual classad::Value glite::jdl::Ad::getTypeValue | ( | const std::string & | attr_name | ) | [protected, virtual] |
Retrieve the Value of the specified attribute.
attr_name | a string representing the attribute name |
std::vector<std::string> glite::jdl::Ad::getWarnings | ( | ) |
Retrieve all collected warnings Warnings may be due to usage of deprecated attributes, methods, procedures.
bool glite::jdl::Ad::hasAttribute | ( | classad::ExprTree * | tree, | |
const std::string & | attr_value | |||
) | [protected] |
Check whether a value is present inside a classad Expression.
tree | the expression to be checked | |
attr_value | the value to be checked |
bool glite::jdl::Ad::hasAttribute | ( | const std::string & | attr_name, | |
const std::string & | attr_value | |||
) |
Check if the specified value is present in the specified attribute.
bool glite::jdl::Ad::hasAttribute | ( | const std::string & | attr_name | ) |
Check If the specified attribute has already been set.
attr_name | The name of the attibute to be looked for |
bool glite::jdl::Ad::hasWarnings | ( | ) |
Determine whether there are any warning.
Warnings may be due to usage of deprecated attributes, methods, procedures.
virtual void glite::jdl::Ad::insertAttribute | ( | const std::string & | attr_name, | |
classad::Value | val | |||
) | [protected, virtual] |
Insert a classad Exptression inside the Ad instance.
attr_name | a string representing the attribute name | |
val | - The value of the attribute to be added |
virtual void glite::jdl::Ad::insertAttribute | ( | const std::string & | attr_name, | |
classad::ExprTree * | val | |||
) | [protected, virtual] |
Insert a classad Exptression inside the Ad instance.
attr_name | a string representing the attribute name | |
val | - The value of the attribute to be added |
Reimplemented in glite::jdl::JobAd, glite::jdl::NodeAd, and glite::jdl::ParametricAd.
bool glite::jdl::Ad::isSet | ( | ) |
virtual classad::ExprTree* glite::jdl::Ad::lookUp | ( | const std::string & | attr_name | ) | [inline, virtual] |
Returns an expression.
NULL returned if the attribute doesn't exist
attr_name | The name of the attibute to be deleted |
void glite::jdl::Ad::merge | ( | Ad | source, | |
bool | overwrite = true | |||
) |
merge the attributes of the specified classad overriding the attribute with the same name Classad type attribute will be recoursively merged
virtual void glite::jdl::Ad::operator= | ( | const Ad & | jobad | ) | [virtual] |
Operator "=" performs a deep copy of the Ad instance.
void glite::jdl::Ad::remAttribute | ( | const std::string & | attr_name | ) |
Delete an Attribute.
It fails if the attribute doesn't exist
AdEmptyException | attribute has not been set yet |
attr_name | The name of the attibute to be deleted |
virtual void glite::jdl::Ad::setAttribute | ( | const std::string & | attr_name, | |
Ad * | attr_value | |||
) | [virtual] |
Add The specified Integer Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The value of the attribute to be added |
AdSyntaxException | - Syntax error caught while trying to add the attribute | |
AdEmptyException | - The attribute attr_name had been already set |
virtual void glite::jdl::Ad::setAttribute | ( | const std::string & | attr_name, | |
bool | attr_value | |||
) | [virtual] |
Add The specified String Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The value of the attribute to be added |
AdSyntaxException | - Syntax error caught while trying to add the attribute | |
AdEmptyException | - The attribute attr_name had been already set |
virtual void glite::jdl::Ad::setAttribute | ( | const std::string & | attr_name, | |
double | attr_value | |||
) | [virtual] |
Add The specified String Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The value of the attribute to be added |
AdSyntaxException | - Syntax error caught while trying to add the attribute | |
AdEmptyException | - The attribute attr_name had been already set |
virtual void glite::jdl::Ad::setAttribute | ( | const std::string & | attr_name, | |
const char * | attr_value | |||
) | [inline, virtual] |
Add The specified String Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The value of the attribute to be added |
AdEmptyException | - The attribute attr_name had been already set | |
AdFormatException | The type of value is not allowed for the specified attribute name |
virtual void glite::jdl::Ad::setAttribute | ( | const std::string & | attr_name, | |
const std::string & | attr_value | |||
) | [virtual] |
Add The specified String Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The value of the attribute to be added |
AdEmptyException | - The attribute attr_name had been already set | |
AdFormatException | The type of value is not allowed for the specified attribute name |
virtual void glite::jdl::Ad::setAttribute | ( | const std::string & | attr_name, | |
int | attr_value | |||
) | [virtual] |
Add The specified Integer Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The value of the attribute to be added |
AdSyntaxException | - Syntax error caught while trying to add the attribute | |
AdEmptyException | - The attribute attr_name had been already set |
virtual void glite::jdl::Ad::setAttributeExpr | ( | const std::string & | attr_name, | |
classad::ExprTree * | attr_value | |||
) | [virtual] |
Add The specified Expression Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The value of the attribute to be added |
AdSyntaxException | - Syntax error caught while trying to add the attribute | |
AdEmptyException | - The attribute attr_name had been already set |
virtual void glite::jdl::Ad::setAttributeExpr | ( | const std::string & | attr_name, | |
const std::string & | attr_value | |||
) | [virtual] |
Add The specified Expression Attribute to the jdl istance.
attr_name | - The Name of the attribute to be added | |
attr_value | - The string expression of the attribute to be added |
AdClassAdException | - a classAd method raised an error | |
AdEmptyException | - The attribute attr_name had been already set |
Reimplemented in glite::jdl::JobAd.
virtual std::string glite::jdl::Ad::toLines | ( | ) | [virtual] |
Convert the Ad Instance into a multi line indented string representation.
virtual std::string glite::jdl::Ad::toString | ( | const std::string & | attr_name | ) | [virtual] |
Convert an Ad attribute into its string representation.
attr_name | the attribute to be looked up |
virtual std::string glite::jdl::Ad::toString | ( | ) | [virtual] |
Convert the Ad Instance into a single line string representation.
std::vector<std::string> glite::jdl::Ad::warning_messages_v [protected] |
Collection of all warning messages (if any).