jdl-api-cpp-3.4.4
|
#include <glite/jdl/Ad.h>
Public Member Functions | |
Constructors | |
Ad () | |
virtual | ~Ad () throw () |
Ad (const classad::ClassAd &classAd) | |
Ad (const std::string &jdl_string) | |
Ad (const Ad &jobad) | |
virtual void | operator= (const Ad &jobad) |
From methods | |
void | fromString (const std::string &jdl_string, std::string jdl_file="") |
void | fromFile (const std::string &jdl_file) |
void | fromStream (std::istream &jdl_in) |
virtual void | fromClassAd (const classad::ClassAd &classAd) |
To methods | |
virtual std::string | toString () |
virtual std::string | toString (const std::string &attr_name) |
virtual std::string | toLines () |
bool | isSet () |
void | clear () |
general methods | |
classad::ClassAd *const | ad () |
bool | hasAttribute (const std::string &attr_name) |
virtual classad::ExprTree * | delAttribute (const std::string &attr_name) |
void | remAttribute (const std::string &attr_name) |
virtual classad::ExprTree * | lookUp (const std::string &attr_name) |
bool | hasAttribute (const std::string &attr_name, const std::string &attr_value) |
std::vector< std::string > | attributes () |
void | merge (Ad source, bool overwrite=true) |
Warnings Management | |
bool | hasWarnings () |
std::vector< std::string > | getWarnings () |
void | addWarning (const std::string &msg) |
Protected Member Functions | |
virtual void | addAttribute (std::string attr_name, classad::Value val) |
virtual void | appendValue (classad::ExprTree *tree, const classad::Value &val, const std::string &attr_name) |
virtual void | insertAttribute (const std::string &attr_name, classad::ExprTree *val) |
virtual void | insertAttribute (const std::string &attr_name, classad::Value val) |
virtual classad::Value | getTypeValue (const std::string &attr_name) |
bool | hasAttribute (classad::ExprTree *tree, const std::string &attr_value) |
Protected Attributes | |
std::vector< std::string > | warning_messages_v |
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) |
void | addAttribute (const std::string &attr_name, int attr_value) |
void | addAttribute (const std::string &attr_name, double attr_value) |
void | addAttribute (const std::string &attr_name, bool attr_value) |
void | addAttribute (const std::string &attr_name, const std::string &attr_value) |
void | addAttribute (const std::string &attr_name, const char *attr_value) |
void | addAttribute (const std::string &attr_name, Ad *attr_value) |
virtual void | setAttributeExpr (const std::string &attr_name, const std::string &attr_value) |
virtual void | setAttribute (const std::string &attr_name, int attr_value) |
virtual void | setAttribute (const std::string &attr_name, const std::string &attr_value) |
virtual void | setAttribute (const std::string &attr_name, const char *attr_value) |
virtual void | setAttribute (const std::string &attr_name, double attr_value) |
virtual void | setAttribute (const std::string &attr_name, bool attr_value) |
virtual void | setAttribute (const std::string &attr_name, Ad *attr_value) |
virtual void | setAttributeExpr (const std::string &attr_name, classad::ExprTree *attr_value) |
virtual std::string | getAttributeExpr (const std::string &attr_name) |
std::vector< int > | getIntValue (const std::string &attr_name) |
std::vector< double > | getDoubleValue (const std::string &attr_name) |
std::vector< bool > | getBoolValue (const std::string &attr_name) |
virtual std::vector< std::string > | getStringValue (const std::string &attr_name) |
std::vector< std::vector < std::string > > | getStringList (const std::string &attr_name) |
virtual Ad | getAd (const std::string &attr_name) |
virtual std::string | getString (const std::string &attr_name) |
virtual int | getInt (const std::string &attr_name) |
virtual double | getDouble (const std::string &attr_name) |
virtual bool | getBool (const std::string &attr_name) |
Provides a common interface for all Ad components. 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
anonymous enum |
Enumerator | |
---|---|
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 |
Default Destructor
glite::jdl::Ad::Ad | ( | const classad::ClassAd & | classAd | ) |
Constructor by ClassAd
classAd | the classad source where to create the Ad instance from |
glite::jdl::Ad::Ad | ( | const std::string & | jdl_string | ) |
Constructor by string
jdl_string | the Ad string representation |
glite::jdl::Ad::Ad | ( | const Ad & | jobad | ) |
|
inline |
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::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, |
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, |
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 |
|
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 |
References addAttribute().
Referenced by addAttribute().
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 |
|
protectedvirtual |
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::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 |
|
protectedvirtual |
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 |
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 |
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 = "" |
||
) |
Create an Ad instance from a string
jdl_string | the ad string representation |
jdl_file | path of the jdl file |
Referenced by glite::jdl::NodeAd::NodeAd(), and glite::jdl::ParametricAd::ParametricAd().
|
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 |
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 |
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 |
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 |
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 |
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 |
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 |
|
protectedvirtual |
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 | ( | 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::hasAttribute | ( | const std::string & | attr_name, |
const std::string & | attr_value | ||
) |
Check if the specified value is present in the specified attribute
|
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::hasWarnings | ( | ) |
Determine whether there are any warning. Warnings may be due to usage of deprecated attributes, methods, procedures.
|
protectedvirtual |
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.
|
protectedvirtual |
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 |
bool glite::jdl::Ad::isSet | ( | ) |
|
inlinevirtual |
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 |
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 |
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 |
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 |
|
inlinevirtual |
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 |
References setAttribute().
Referenced by setAttribute().
|
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 |
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 |
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 |
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 |
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 |
Convert the Ad Instance into a multi line indented string representation
|
virtual |
Convert the Ad Instance into a single line string representation
|
virtual |
Convert an Ad attribute into its string representation
attr_name | the attribute to be looked up |
|
protected |
Collection of all warning messages (if any)