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

Ad Class Reference

Provides a common interface for all Ad components. More...

List of all members.

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_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 JobAd 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, 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 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.

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.


Public Types


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.

classad::ClassAd * ad ()
 Deep copy of Ad.

From methods
virtual void fromString (const std::string &jdl_string)
 Create an Ad instance from a string.

virtual void fromFile (const std::string &jdl_file)
 Create an Ad instacne from a file.

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.

has methods
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.

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 ()
 Return the list of all attributes inside classad.


Protected Member Functions

std::string toLower (const std::string &src)
 Convert the string into lower case.

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.


Friends

class ExpDagAd


Detailed Description

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

See also:
JoibAd
Version:
0.1
Date:
15 April 2002
Author:
Alessandro Maraschini <alessandro.maraschini@datamat.it>


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
TYPE_UNKNOWN 
TYPE_INTEGER  Attribute Integer type value.

See also:
getType
TYPE_BOOLEAN  Attribute Boolean type value.

See also:
getType
TYPE_STRING  Attribute String type value.

See also:
getType
TYPE_REAL  Attribute Real/Double type value.

See also:
getType
TYPE_EXPRESSION  Attribute Expression type value.

See also:
getType


Constructor & Destructor Documentation

Ad  ) 
 

default Constructor

virtual ~Ad  )  throw () [virtual]
 

Default Destructor.

Ad const classad::ClassAd &  classAd  ) 
 

Constructor by ClassAd.

Parameters:
classAd the classad source where to create the Ad instance from

Ad const std::string &  jdl_string  ) 
 

Constructor by string.

Parameters:
jdl_string the Ad string representation


Member Function Documentation

classad::ClassAd* ad  )  [inline]
 

Deep copy of Ad.

Returns:
a ClassAd pointer representing a copy of all Ad attributes*

virtual void 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.

Parameters:
attr_name a string representing the attribute name
val The value of the attribute to be added
Exceptions:
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 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.

Parameters:
attr_name a string representing the attribute name
attr_value - The value of the attribute to be added
Exceptions:
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 catched while trying to add the attribute

void addAttribute const std::string &  attr_name,
const std::string &  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.

Parameters:
attr_name a string representing the attribute name
attr_value - The value of the attribute to be added
Exceptions:
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 catched while trying to add the attribute

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.

it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.

Parameters:
attr_name a string representing the attribute name
attr_value - The value of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdSyntaxException - Syntax error catched while trying to add the attribute

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.

it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.

Parameters:
attr_name a string representing the attribute name
attr_value - The value of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdSyntaxException - Syntax error catched while trying to add the attribute

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.

it transforms it in a list attribute). if used on a non-set attribute the corresponding setAttribute method is automatically called.

Parameters:
attr_name a string representing the attribute name
attr_value - The value of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdSyntaxException - Syntax error catched while trying to add the attribute

virtual void appendValue classad::ExprTree *  tree,
const classad::Value &  val,
const std::string &  attr_name
[protected, virtual]
 

Append a value to a list.

Parameters:
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> attributes  ) 
 

Return the list of all attributes inside classad.

void clear  ) 
 

Reset the JobAd Instance.

All the previous existing attributes will be deleted

virtual classad::ExprTree* delAttribute const std::string &  attr_name  )  [virtual]
 

Delete an Attribute.

It fails if the attribute doesn't exist

Parameters:
attr_nam The name of the attibute to be deleted

virtual void fromFile const std::string &  jdl_file  )  [virtual]
 

Create an Ad instacne from a file.

Parameters:
jdl_file the string representing the path containing the jdl to be parsed

virtual void fromString const std::string &  jdl_string  )  [virtual]
 

Create an Ad instance from a string.

Parameters:
jdl_string the ad string representation

virtual std::string getAttributeExpr const std::string &  attr_name  )  [virtual]
 

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute name to be retrieved
Returns:
the string representation of this attribute
Exceptions:
AdEmptyException - The checked attribute has not been set yet
AdMismatchException - The type of retrieved value is not allowed for the specified attribute name

std::vector<bool> getBoolValue const std::string &  attr_name  ) 
 

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute to be retrieved
Returns:
a vector cantaining the values listed in the specified attribute , (1-size vector if the attribute has a single value)
Exceptions:
AdEmptyException - The checked attribute has not been set yet
AdMismatchException - The type of retrieved value is not allowed for the specified attribute name

std::vector<double> getDoubleValue const std::string &  attr_name  ) 
 

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute to be retrieved
Returns:
a vector cantaining the values listed in the specified attribute , (1-size vector if the attribute has a single value)
Exceptions:
AdEmptyException - The checked attribute has not been set yet
AdMismatchException - The type of retrieved value is not allowed for the specified attribute name

std::vector<int> getIntValue const std::string &  attr_name  ) 
 

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute name to be retrieved
Returns:
a vector cantaining the values listed in the specified attribute , (1-size vector if the attribute has a single value)
Exceptions:
AdEmptyException - The checked attribute has not been set yet
AdMismatchException - The type of retrieved value is not allowed for the specified attribute name

std::vector<std::vector<std::string> > getStringList const std::string &  attr_name  ) 
 

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute to be retrieved
Returns:
a vector cantaining the a vector of strings (1-size vector if the attribute has a single value)
Exceptions:
AdEmptyException - The checked attribute has not been set yet
AdMismatchException - The type of retrieved value is not allowed for the specified attribute name

std::vector<std::string> getStringValue const std::string &  attr_name  ) 
 

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute to be retrieved
Returns:
a vector cantaining the values listed in the specified attribute , (1-size vector if the attribute has a single value)
Exceptions:
AdEmptyException - The checked attribute has not been set yet
AdMismatchException - The type of retrieved value is not allowed for the specified attribute name

int getType const std::string &  attr_name  ) 
 

Retrieve the type of the value specified for attr_name.

Parameters:
attr_name the name of the attribute
Returns:
an integer representing the type of the attribute
Exceptions:
AdEmptyException if the attribute is not present in the JobAd instance
See also:
TYPE_UNKNOWN

TYPE_INTEGER

TYPE_BOOLEAN

TYPE_STRING

TYPE_REAL

TYPE_EXPRESSION

virtual classad::Value getTypeValue const std::string &  attr_name  )  [protected, virtual]
 

Retrieve the Value of the specified attribute.

Parameters:
attr_name a string representing the attribute name
Returns:
the Value of the attribute inside the Ad instance

bool hasAttribute classad::ExprTree *  tree,
const std::string &  attr_value
[protected]
 

Check whether a value is present inside a classad Expression.

Parameters:
tree the expression to be checked @ attr_value the value to be checked
Returns:
true (if the value is present) false otherwise

bool hasAttribute const std::string &  attr_name,
const std::string &  attr_value
 

Check if the specified value is present in the specified attribute.

bool hasAttribute const std::string &  attr_name  ) 
 

Check If the specified attribute has already been set.

Parameters:
attr_nam The name of the attibute to be looked for
Returns:
true if the attribute has been found, false otherwise

virtual void insertAttribute const std::string &  attr_name,
classad::Value  val
[protected, virtual]
 

Insert a classad Exptression inside the Ad instance.

Parameters:
attr_name a string representing the attribute name
val - The value of the attribute to be added

virtual void insertAttribute const std::string &  attr_name,
classad::ExprTree *  val
[protected, virtual]
 

Insert a classad Exptression inside the Ad instance.

Parameters:
attr_name a string representing the attribute name
val - The value of the attribute to be added

bool isSet  ) 
 

Check whether the JobAd has been initialised.

Returns:
whether the JobAd has been initialised(true) or not (false)

virtual void setAttribute const std::string &  attr_name,
Ad attr_value
[virtual]
 

Add The specified Integer Attribute to the jdl istance.

Parameters:
attr_name - The Name of the attribute to be added
attr_value - The value of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdSyntaxException - Syntax error catched while trying to add the attribute
AdEmptyException - The attribute attr_name had been already set

virtual void setAttribute const std::string &  attr_name,
bool  attr_value
[virtual]
 

Add The specified String Attribute to the jdl istance.

Parameters:
attr_name - The Name of the attribute to be added
attr_value - The value of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdSyntaxException - Syntax error catched while trying to add the attribute
AdEmptyException - The attribute attr_name had been already set

virtual void setAttribute const std::string &  attr_name,
double  attr_value
[virtual]
 

Add The specified String Attribute to the jdl istance.

Parameters:
attr_name - The Name of the attribute to be added
attr_value - The value of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdSyntaxException - Syntax error catched while trying to add the attribute
AdEmptyException - The attribute attr_name had been already set

virtual void setAttribute const std::string &  attr_name,
const std::string &  attr_value
[virtual]
 

Add The specified String Attribute to the jdl istance.

Parameters:
attr_name - The Name of the attribute to be added
attr_value - The value of the attribute to be added
Exceptions:
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

virtual void setAttribute const std::string &  attr_name,
int  attr_value
[virtual]
 

Add The specified Integer Attribute to the jdl istance.

Parameters:
attr_name - The Name of the attribute to be added
attr_value - The value of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdSyntaxException - Syntax error catched while trying to add the attribute
AdEmptyException - The attribute attr_name had been already set

virtual void setAttributeExpr const std::string &  attr_name,
const std::string &  attr_value
[virtual]
 

Add The specified Expression Attribute to the jdl istance.

Parameters:
attr_name - The Name of the attribute to be added
attr_value - The string expression of the attribute to be added
Exceptions:
AdMismatchException - The type of value is not allowed for the specified attribute name
AdClassAdException - a classAd method raised an error
AdEmptyException - The attribute attr_name had been already set

virtual std::string toLines  )  [virtual]
 

Convert the Ad Instance into a multi line indented string representation.

Returns:
as in toString() methods but splits the string one line per attribute

std::string toLower const std::string &  src  )  [protected]
 

Convert the string into lower case.

Parameters:
src the source string
Returns:
the lower representation of the source string

virtual std::string toString const std::string &  attr_name  )  [virtual]
 

Convert an Ad attribute into its string representation.

Parameters:
attr_name the attribute to be looked up
Returns:
return the attrbute string representation

virtual std::string toString  )  [virtual]
 

Convert the Ad Instance into a single line string representation.


Friends And Related Function Documentation

friend class ExpDagAd [friend]
 


The documentation for this class was generated from the following file:
Generated on Wed Mar 1 00:37:56 2006 for COMMON API - configuration, jobid, ldif2classadi, logger, process, requestad, socket++i, task, utilities by doxygen 1.3.5