Public Types | Public Member Functions | Static Public Attributes | Friends

Value Class Reference

Represents the result of an evaluation. More...

#include <value.h>

List of all members.

Public Types

enum  ValueType {
  NULL_VALUE = 0, ERROR_VALUE = 1<<0, UNDEFINED_VALUE = 1<<1, BOOLEAN_VALUE = 1<<2,
  INTEGER_VALUE = 1<<3, REAL_VALUE = 1<<4, RELATIVE_TIME_VALUE = 1<<5, ABSOLUTE_TIME_VALUE = 1<<6,
  STRING_VALUE = 1<<7, CLASSAD_VALUE = 1<<8, LIST_VALUE = 1<<9, NULL_VALUE = 0,
  ERROR_VALUE = 1<<0, UNDEFINED_VALUE = 1<<1, BOOLEAN_VALUE = 1<<2, INTEGER_VALUE = 1<<3,
  REAL_VALUE = 1<<4, RELATIVE_TIME_VALUE = 1<<5, ABSOLUTE_TIME_VALUE = 1<<6, STRING_VALUE = 1<<7,
  CLASSAD_VALUE = 1<<8, LIST_VALUE = 1<<9
}
 

Value types.

More...
enum  NumberFactor {
  NO_FACTOR = 0, B_FACTOR = 1, K_FACTOR = 2, M_FACTOR = 3,
  G_FACTOR = 4, T_FACTOR = 5, NO_FACTOR = 0, B_FACTOR = 1,
  K_FACTOR = 2, M_FACTOR = 3, G_FACTOR = 4, T_FACTOR = 5
}
 

Number factors.

More...
enum  ValueType {
  NULL_VALUE = 0, ERROR_VALUE = 1<<0, UNDEFINED_VALUE = 1<<1, BOOLEAN_VALUE = 1<<2,
  INTEGER_VALUE = 1<<3, REAL_VALUE = 1<<4, RELATIVE_TIME_VALUE = 1<<5, ABSOLUTE_TIME_VALUE = 1<<6,
  STRING_VALUE = 1<<7, CLASSAD_VALUE = 1<<8, LIST_VALUE = 1<<9, NULL_VALUE = 0,
  ERROR_VALUE = 1<<0, UNDEFINED_VALUE = 1<<1, BOOLEAN_VALUE = 1<<2, INTEGER_VALUE = 1<<3,
  REAL_VALUE = 1<<4, RELATIVE_TIME_VALUE = 1<<5, ABSOLUTE_TIME_VALUE = 1<<6, STRING_VALUE = 1<<7,
  CLASSAD_VALUE = 1<<8, LIST_VALUE = 1<<9
}
 

Value types.

More...
enum  NumberFactor {
  NO_FACTOR = 0, B_FACTOR = 1, K_FACTOR = 2, M_FACTOR = 3,
  G_FACTOR = 4, T_FACTOR = 5, NO_FACTOR = 0, B_FACTOR = 1,
  K_FACTOR = 2, M_FACTOR = 3, G_FACTOR = 4, T_FACTOR = 5
}
 

Number factors.

More...

Public Member Functions

 Value ()
 Constructor.
 Value (const Value &value)
 Copy Constructor.
 ~Value ()
 Destructor.
Valueoperator= (const Value &value)
 Assignment operator.
void Clear (void)
void CopyFrom (const Value &v)
void SetBooleanValue (bool b)
void SetRealValue (double r)
void SetIntegerValue (int i)
void SetUndefinedValue (void)
void SetErrorValue (void)
void SetListValue (ExprList *l)
void SetClassAdValue (ClassAd *c)
void SetStringValue (const std::string &str)
void SetStringValue (const char *str)
void SetAbsoluteTimeValue (abstime_t secs)
void SetRelativeTimeValue (time_t secs)
void SetRelativeTimeValue (double secs)
ValueType GetType () const
bool IsBooleanValue (bool &b) const
bool IsBooleanValue () const
bool IsBooleanValueEquiv (bool &b) const
bool IsIntegerValue (int &i) const
bool IsIntegerValue () const
bool IsRealValue (double &r) const
bool IsRealValue () const
bool IsStringValue (std::string &str) const
bool IsStringValue (const char *&str) const
bool IsStringValue (char *str, int len) const
bool IsStringValue (int &size) const
bool IsStringValue () const
bool IsListValue (const ExprList *&l) const
bool IsListValue (ExprList *&l)
bool IsListValue () const
bool IsClassAdValue (const ClassAd *&c) const
bool IsClassAdValue (ClassAd *&c)
bool IsClassAdValue () const
bool IsUndefinedValue () const
bool IsErrorValue () const
bool IsExceptional () const
bool IsNumber () const
bool IsNumber (int &i) const
bool IsNumber (double &r) const
bool IsAbsoluteTimeValue () const
bool IsAbsoluteTimeValue (abstime_t &secs) const
bool IsRelativeTimeValue () const
bool IsRelativeTimeValue (double &secs) const
bool IsRelativeTimeValue (time_t &secs) const
bool SameAs (const Value &otherValue) const
 Value ()
 Constructor.
 Value (const Value &value)
 Copy Constructor.
 ~Value ()
 Destructor.
Valueoperator= (const Value &value)
 Assignment operator.
void Clear (void)
void CopyFrom (const Value &v)
void SetBooleanValue (bool b)
void SetRealValue (double r)
void SetIntegerValue (int i)
void SetUndefinedValue (void)
void SetErrorValue (void)
void SetListValue (ExprList *l)
void SetClassAdValue (ClassAd *c)
void SetStringValue (const std::string &str)
void SetStringValue (const char *str)
void SetAbsoluteTimeValue (abstime_t secs)
void SetRelativeTimeValue (time_t secs)
void SetRelativeTimeValue (double secs)
ValueType GetType () const
bool IsBooleanValue (bool &b) const
bool IsBooleanValue () const
bool IsBooleanValueEquiv (bool &b) const
bool IsIntegerValue (int &i) const
bool IsIntegerValue () const
bool IsRealValue (double &r) const
bool IsRealValue () const
bool IsStringValue (std::string &str) const
bool IsStringValue (const char *&str) const
bool IsStringValue (char *str, int len) const
bool IsStringValue (int &size) const
bool IsStringValue () const
bool IsListValue (const ExprList *&l) const
bool IsListValue (ExprList *&l)
bool IsListValue () const
bool IsClassAdValue (const ClassAd *&c) const
bool IsClassAdValue (ClassAd *&c)
bool IsClassAdValue () const
bool IsUndefinedValue () const
bool IsErrorValue () const
bool IsExceptional () const
bool IsNumber () const
bool IsNumber (int &i) const
bool IsNumber (double &r) const
bool IsAbsoluteTimeValue () const
bool IsAbsoluteTimeValue (abstime_t &secs) const
bool IsRelativeTimeValue () const
bool IsRelativeTimeValue (double &secs) const
bool IsRelativeTimeValue (time_t &secs) const
bool SameAs (const Value &otherValue) const

Static Public Attributes

static const double ScaleFactor []
 Values of number multiplication factors.

Friends

class Literal
class ClassAd
class ExprTree
bool operator== (const Value &value1, const Value &value2)
std::ostream & operator<< (std::ostream &stream, Value &value)
bool operator== (const Value &value1, const Value &value2)
std::ostream & operator<< (std::ostream &stream, Value &value)

Detailed Description

Represents the result of an evaluation.


Member Enumeration Documentation

Number factors.

Enumerator:
NO_FACTOR 

No factor specified

B_FACTOR 

Byte factor

K_FACTOR 

Kilo factor

M_FACTOR 

Mega factor

G_FACTOR 

Giga factor

T_FACTOR 

Terra factor

NO_FACTOR 

No factor specified

B_FACTOR 

Byte factor

K_FACTOR 

Kilo factor

M_FACTOR 

Mega factor

G_FACTOR 

Giga factor

T_FACTOR 

Terra factor

Number factors.

Enumerator:
NO_FACTOR 

No factor specified

B_FACTOR 

Byte factor

K_FACTOR 

Kilo factor

M_FACTOR 

Mega factor

G_FACTOR 

Giga factor

T_FACTOR 

Terra factor

NO_FACTOR 

No factor specified

B_FACTOR 

Byte factor

K_FACTOR 

Kilo factor

M_FACTOR 

Mega factor

G_FACTOR 

Giga factor

T_FACTOR 

Terra factor

Value types.

Enumerator:
ERROR_VALUE 

The error value

UNDEFINED_VALUE 

The undefined value

BOOLEAN_VALUE 

A boolean value (false, true)

INTEGER_VALUE 

An integer value

REAL_VALUE 

A real value

RELATIVE_TIME_VALUE 

A relative time value

ABSOLUTE_TIME_VALUE 

An absolute time value

STRING_VALUE 

A string value

CLASSAD_VALUE 

A classad value

LIST_VALUE 

An expression list value

ERROR_VALUE 

The error value

UNDEFINED_VALUE 

The undefined value

BOOLEAN_VALUE 

A boolean value (false, true)

INTEGER_VALUE 

An integer value

REAL_VALUE 

A real value

RELATIVE_TIME_VALUE 

A relative time value

ABSOLUTE_TIME_VALUE 

An absolute time value

STRING_VALUE 

A string value

CLASSAD_VALUE 

A classad value

LIST_VALUE 

An expression list value

Value types.

Enumerator:
ERROR_VALUE 

The error value

UNDEFINED_VALUE 

The undefined value

BOOLEAN_VALUE 

A boolean value (false, true)

INTEGER_VALUE 

An integer value

REAL_VALUE 

A real value

RELATIVE_TIME_VALUE 

A relative time value

ABSOLUTE_TIME_VALUE 

An absolute time value

STRING_VALUE 

A string value

CLASSAD_VALUE 

A classad value

LIST_VALUE 

An expression list value

ERROR_VALUE 

The error value

UNDEFINED_VALUE 

The undefined value

BOOLEAN_VALUE 

A boolean value (false, true)

INTEGER_VALUE 

An integer value

REAL_VALUE 

A real value

RELATIVE_TIME_VALUE 

A relative time value

ABSOLUTE_TIME_VALUE 

An absolute time value

STRING_VALUE 

A string value

CLASSAD_VALUE 

A classad value

LIST_VALUE 

An expression list value


Member Function Documentation

void Value::Clear ( void   ) 

Discards the previous value and sets the value to UNDEFINED

void Value::Clear ( void   ) 

Discards the previous value and sets the value to UNDEFINED

void Value::CopyFrom ( const Value v  ) 

Copies the value of another value object.

Parameters:
v The value copied from.
void Value::CopyFrom ( const Value v  ) 

Copies the value of another value object.

Parameters:
v The value copied from.
ValueType Value::GetType (  )  const [inline]

Gets the type of the value.

Returns:
The value type.
See also:
ValueType
ValueType Value::GetType (  )  const [inline]

Gets the type of the value.

Returns:
The value type.
See also:
ValueType
bool Value::IsAbsoluteTimeValue (  )  const [inline]

Checks if the value is an absolute time value.

Returns:
true iff the value is an absolute time value.
bool Value::IsAbsoluteTimeValue ( abstime_t secs  )  const [inline]

Checks if the value is an absolute time value.

Parameters:
secs - Absolute time literal (Number of seconds since the UNIX epoch,timezone offset).
Returns:
true iff the value is an absolute time value.
bool Value::IsAbsoluteTimeValue (  )  const

Checks if the value is an absolute time value.

Returns:
true iff the value is an absolute time value.
bool Value::IsAbsoluteTimeValue ( abstime_t secs  )  const

Checks if the value is an absolute time value.

Parameters:
secs - Absolute time literal (Number of seconds since the UNIX epoch,timezone offset).
Returns:
true iff the value is an absolute time value.
bool Value::IsBooleanValue ( bool &  b  )  const [inline]

Checks if the value is boolean.

Parameters:
b The boolean value if the value is boolean.
Returns:
true iff the value is boolean.
bool Value::IsBooleanValue (  )  const [inline]

Checks if the value is boolean.

Returns:
true iff the value is boolean.
bool Value::IsBooleanValue (  )  const [inline]

Checks if the value is boolean.

Returns:
true iff the value is boolean.
bool Value::IsBooleanValue ( bool &  b  )  const [inline]

Checks if the value is boolean.

Parameters:
b The boolean value if the value is boolean.
Returns:
true iff the value is boolean.
bool Value::IsBooleanValueEquiv ( bool &  b  )  const

Checks if the value is boolean or something considered equivalent by implicit conversion (e.g. a number), if old ClassAd evaluation semantics are being used. If they're not being used, this method behaves like IsBooleanValue().

Parameters:
b The boolean value if return is true.
Returns:
true iff the value is boolean or equivalent
bool Value::IsBooleanValueEquiv ( bool &  b  )  const

Checks if the value is boolean or something considered equivalent by implicit conversion (e.g. a number), if old ClassAd evaluation semantics are being used. If they're not being used, this method behaves like IsBooleanValue().

Parameters:
b The boolean value if return is true.
Returns:
true iff the value is boolean or equivalent
bool Value::IsClassAdValue ( const ClassAd *&  c  )  const [inline]

Checks if the value is a ClassAd.

Parameters:
c The ClassAd if the value is a ClassAd.
Returns:
true iff the value is a ClassAd.
bool Value::IsClassAdValue ( ClassAd *&  c  )  [inline]

Checks if the value is a ClassAd. The ClassAd returned is the original list put into the ClassAd, so you only own it if you own the original.

Parameters:
c The ClassAd if the value is a ClassAd.
Returns:
true iff the value is a ClassAd.
bool Value::IsClassAdValue (  )  const [inline]

Checks if the value is a ClassAd.

Returns:
true iff the value is a ClassAd value.
bool Value::IsClassAdValue ( const ClassAd *&  c  )  const [inline]

Checks if the value is a ClassAd.

Parameters:
c The ClassAd if the value is a ClassAd.
Returns:
true iff the value is a ClassAd.
bool Value::IsClassAdValue ( ClassAd *&  c  )  [inline]

Checks if the value is a ClassAd. The ClassAd returned is the original list put into the ClassAd, so you only own it if you own the original.

Parameters:
c The ClassAd if the value is a ClassAd.
Returns:
true iff the value is a ClassAd.
bool Value::IsClassAdValue (  )  const [inline]

Checks if the value is a ClassAd.

Returns:
true iff the value is a ClassAd value.
bool Value::IsErrorValue ( void   )  const [inline]

Checks if the value is the error value.

Returns:
true iff the value if the error value.
bool Value::IsErrorValue (  )  const [inline]

Checks if the value is the error value.

Returns:
true iff the value if the error value.
bool Value::IsExceptional ( void   )  const [inline]

Checks if the value is exceptional.

Returns:
true iff the value is either undefined or error.
bool Value::IsExceptional (  )  const [inline]

Checks if the value is exceptional.

Returns:
true iff the value is either undefined or error.
bool Value::IsIntegerValue ( int &  i  )  const [inline]

Checks if the value is integral.

Parameters:
i The integer value if the value is integer.
Returns:
true iff the value is an integer.
bool Value::IsIntegerValue (  )  const [inline]

Checks if the value is integral.

Returns:
true iff the value is an integer.
bool Value::IsIntegerValue (  )  const [inline]

Checks if the value is integral.

Returns:
true iff the value is an integer.
bool Value::IsIntegerValue ( int &  i  )  const [inline]

Checks if the value is integral.

Parameters:
i The integer value if the value is integer.
Returns:
true iff the value is an integer.
bool Value::IsListValue (  )  const [inline]

Checks if the value is an expression list. The ExprList returned is the original list put into the ClassAd, so you only own it if you own the original.

Returns:
true iff the value is an expression list.
bool Value::IsListValue ( const ExprList *&  l  )  const [inline]

Checks if the value is an expression list.

Parameters:
l The expression list if the value is an expression list.
Returns:
true iff the value is an expression list.
bool Value::IsListValue ( ExprList *&  l  )  [inline]

Checks if the value is an expression list. The ExprList returned is the original list put into the ClassAd, so you only own it if you own the original.

Parameters:
l The expression list if the value is an expression list.
Returns:
true iff the value is an expression list.
bool Value::IsListValue ( const ExprList *&  l  )  const [inline]

Checks if the value is an expression list.

Parameters:
l The expression list if the value is an expression list.
Returns:
true iff the value is an expression list.
bool Value::IsListValue (  )  const [inline]

Checks if the value is an expression list. The ExprList returned is the original list put into the ClassAd, so you only own it if you own the original.

Returns:
true iff the value is an expression list.
bool Value::IsListValue ( ExprList *&  l  )  [inline]

Checks if the value is an expression list. The ExprList returned is the original list put into the ClassAd, so you only own it if you own the original.

Parameters:
l The expression list if the value is an expression list.
Returns:
true iff the value is an expression list.
bool Value::IsNumber ( double &  r  )  const

Checks if the value is numerical. If the value is an integer, it is promoted to a real.

Parameters:
r The real value of the value if the value is a number.
Returns:
true iff the value is a number
bool Value::IsNumber (  )  const [inline]

Checks if the value is numerical.

Returns:
true iff the value is a number
bool Value::IsNumber ( int &  i  )  const

Checks if the value is numerical. If the value is a real, it is converted to an integer through truncation.

Parameters:
i The integer value of the value if the value is a number.
Returns:
true iff the value is a number
bool Value::IsNumber ( int &  i  )  const

Checks if the value is numerical. If the value is a real, it is converted to an integer through truncation.

Parameters:
i The integer value of the value if the value is a number.
Returns:
true iff the value is a number
bool Value::IsNumber (  )  const

Checks if the value is numerical.

Returns:
true iff the value is a number
bool Value::IsNumber ( double &  r  )  const

Checks if the value is numerical. If the value is an integer, it is promoted to a real.

Parameters:
r The real value of the value if the value is a number.
Returns:
true iff the value is a number
bool Value::IsRealValue ( double &  r  )  const [inline]

Checks if the value is real.

Parameters:
r The real value if the value is real.
Returns:
true iff the value is real.
bool Value::IsRealValue (  )  const [inline]

Checks if the value is real.

Returns:
true iff the value is real.
bool Value::IsRealValue ( double &  r  )  const [inline]

Checks if the value is real.

Parameters:
r The real value if the value is real.
Returns:
true iff the value is real.
bool Value::IsRealValue (  )  const [inline]

Checks if the value is real.

Returns:
true iff the value is real.
bool Value::IsRelativeTimeValue (  )  const

Checks if the value is a relative time value.

Returns:
true iff the value is a relative time value
bool Value::IsRelativeTimeValue (  )  const [inline]

Checks if the value is a relative time value.

Returns:
true iff the value is a relative time value
bool Value::IsRelativeTimeValue ( double &  secs  )  const [inline]

Checks if the value is a relative time value.

Parameters:
secs Number of seconds
Returns:
true iff the value is a relative time value
bool Value::IsRelativeTimeValue ( double &  secs  )  const

Checks if the value is a relative time value.

Parameters:
secs Number of seconds
Returns:
true iff the value is a relative time value
bool Value::IsStringValue ( std::string &  str  )  const

Checks if the value is a string.

Parameters:
str A reference to a string object, which is filled with the string value.
Returns:
true iff the value is a string.
bool Value::IsStringValue ( char *  str,
int  len 
) const

Checks if the value is a string and provides a copy of it in a buffer you provide

Parameters:
str A buffer to hold the string value.
len The size of the buffer.
Returns:
true iff the value is a string.
bool Value::IsStringValue (  )  const [inline]

Checks if the value is a string.

Returns:
true iff the value is string.
bool Value::IsStringValue ( int &  size  )  const [inline]

Returns length of the string instead of the string

Parameters:
size This is filled in with the size of the string
Returns:
true iff the value is string.
bool Value::IsStringValue ( const char *&  str  )  const

Checks if the value is a string.

Parameters:
str A reference to a C string, which will point to the string value. This pointer must not be deallocated or tampered with.
Returns:
true iff the value is a string.
bool Value::IsStringValue ( std::string &  str  )  const [inline]

Checks if the value is a string.

Parameters:
str A reference to a string object, which is filled with the string value.
Returns:
true iff the value is a string.
bool Value::IsStringValue ( const char *&  str  )  const [inline]

Checks if the value is a string.

Parameters:
str A reference to a C string, which will point to the string value. This pointer must not be deallocated or tampered with.
Returns:
true iff the value is a string.
bool Value::IsStringValue ( char *  str,
int  len 
) const [inline]

Checks if the value is a string and provides a copy of it in a buffer you provide

Parameters:
str A buffer to hold the string value.
len The size of the buffer.
Returns:
true iff the value is a string.
bool Value::IsStringValue ( int &  size  )  const [inline]

Returns length of the string instead of the string

Parameters:
size This is filled in with the size of the string
Returns:
true iff the value is string.
bool Value::IsStringValue (  )  const [inline]

Checks if the value is a string.

Returns:
true iff the value is string.
bool Value::IsUndefinedValue ( void   )  const [inline]

Checks if the value is the undefined value.

Returns:
true iff the value if the undefined value.
bool Value::IsUndefinedValue (  )  const [inline]

Checks if the value is the undefined value.

Returns:
true iff the value if the undefined value.
void Value::SetAbsoluteTimeValue ( abstime_t  secs  ) 

Sets an absolute time value in seconds since the UNIX epoch, & the time zone it's measured in.

Parameters:
secs - Absolute Time Literal(seconds since the UNIX epoch, timezone offset) .
void Value::SetAbsoluteTimeValue ( abstime_t  secs  ) 

Sets an absolute time value in seconds since the UNIX epoch, & the time zone it's measured in.

Parameters:
secs - Absolute Time Literal(seconds since the UNIX epoch, timezone offset) .
void Value::SetBooleanValue ( bool  b  ) 

Sets a boolean value; previous value discarded.

Parameters:
b The boolean value.
void Value::SetBooleanValue ( bool  b  ) 

Sets a boolean value; previous value discarded.

Parameters:
b The boolean value.
void Value::SetClassAdValue ( ClassAd c  ) 

Sets a ClassAd value; previous value discarded. You still own the ClassA:, it is not owned by the Value class, so it is your responsibility to delete it.

Parameters:
c The ClassAd value.
void Value::SetClassAdValue ( ClassAd c  ) 

Sets a ClassAd value; previous value discarded. You still own the ClassA:, it is not owned by the Value class, so it is your responsibility to delete it.

Parameters:
c The ClassAd value.
void Value::SetErrorValue ( void   ) 

Sets the error value; previous value discarded.

void Value::SetErrorValue ( void   ) 

Sets the error value; previous value discarded.

void Value::SetIntegerValue ( int  i  ) 

Sets an integer value; previous value discarded.

Parameters:
i The integer value.
void Value::SetIntegerValue ( int  i  ) 

Sets an integer value; previous value discarded.

Parameters:
i The integer value.
void Value::SetListValue ( ExprList l  ) 

Sets an expression list value; previous value discarded. You still own the ExprList:: it is not owned by the Value class, so it is your responsibility to delete it.

Parameters:
l The list value.
void Value::SetListValue ( ExprList l  ) 

Sets an expression list value; previous value discarded. You still own the ExprList:: it is not owned by the Value class, so it is your responsibility to delete it.

Parameters:
l The list value.
void Value::SetRealValue ( double  r  ) 

Sets a real value; previous value discarded.

Parameters:
r The real value.
void Value::SetRealValue ( double  r  ) 

Sets a real value; previous value discarded.

Parameters:
r The real value.
void Value::SetRelativeTimeValue ( time_t  secs  ) 

Sets a relative time value.

Parameters:
secs Number of seconds.
void Value::SetRelativeTimeValue ( time_t  secs  ) 

Sets a relative time value.

Parameters:
secs Number of seconds.
void Value::SetStringValue ( const char *  str  ) 

Sets a string value; previous value discarded. The string is copied so you may feel free to delete the original if you wish.

Parameters:
str The string value.
void Value::SetStringValue ( const std::string &  str  ) 

Sets a string value; previous value discarded.

Parameters:
str The string value.
void Value::SetStringValue ( const std::string &  str  ) 

Sets a string value; previous value discarded.

Parameters:
str The string value.
void Value::SetStringValue ( const char *  str  ) 

Sets a string value; previous value discarded. The string is copied so you may feel free to delete the original if you wish.

Parameters:
str The string value.
void Value::SetUndefinedValue ( void   ) 

Sets the undefined value; previous value discarded.

void Value::SetUndefinedValue ( void   ) 

Sets the undefined value; previous value discarded.


Member Data Documentation

const double Value::ScaleFactor [static]
Initial value:
 {
    1.0,                        
    1.0,                        
    1024.0,                     
    1024.0*1024.0,              
    1024.0*1024.0*1024.0,       
    1024.0*1024.0*1024.0*1024.0 
}

Values of number multiplication factors.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends