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

Value Class Reference

Represents the result of an evaluation. More...

#include <value.h>

Collaboration diagram for Value:

Collaboration graph
[legend]
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
}
 Value types. More...

enum  NumberFactor {
  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)
 Discards the previous value and sets the value to UNDEFINED.

void CopyFrom (const Value &v)
 Copies the value of another value object.

void SetBooleanValue (bool b)
 Sets a boolean value; previous value discarded.

void SetRealValue (double r)
 Sets a real value; previous value discarded.

void SetIntegerValue (int i)
 Sets an integer value; previous value discarded.

void SetUndefinedValue (void)
 Sets the undefined value; previous value discarded.

void SetErrorValue (void)
 Sets the error value; previous value discarded.

void SetListValue (ExprList *l)
 Sets an expression list value; previous value discarded.

void SetClassAdValue (ClassAd *c)
 Sets a ClassAd value; previous value discarded.

void SetStringValue (const std::string &str)
 Sets a string value; previous value discarded.

void SetStringValue (const char *str)
 Sets a string value; previous value discarded.

void SetAbsoluteTimeValue (abstime_t secs)
 Sets an absolute time value in seconds since the UNIX epoch, & the time zone it's measured in.

void SetRelativeTimeValue (time_t secs)
 Sets a relative time value.

void SetRelativeTimeValue (double secs)
ValueType GetType () const
 Gets the type of the value.

bool IsBooleanValue (bool &b) const
 Checks if the value is boolean.

bool IsBooleanValue () const
 Checks if the value is boolean.

bool IsIntegerValue (int &i) const
 Checks if the value is integral.

bool IsIntegerValue () const
 Checks if the value is integral.

bool IsRealValue (double &r) const
 Checks if the value is real.

bool IsRealValue () const
 Checks if the value is real.

bool IsStringValue (std::string &str) const
 Checks if the value is a string.

bool IsStringValue (const char *&str) const
 Checks if the value is a string.

bool IsStringValue (char *str, int len) const
 Checks if the value is a string and provides a copy of it in a buffer you provide.

bool IsStringValue () const
 Checks if the value is a string.

bool IsListValue (const ExprList *&l) const
 Checks if the value is an expression list.

bool IsListValue (ExprList *&l)
 Checks if the value is an expression list.

bool IsListValue () const
 Checks if the value is an expression list.

bool IsClassAdValue (const ClassAd *&c) const
 Checks if the value is a ClassAd.

bool IsClassAdValue (ClassAd *&c)
 Checks if the value is a ClassAd.

bool IsClassAdValue () const
 Checks if the value is a ClassAd.

bool IsUndefinedValue () const
 Checks if the value is the undefined value.

bool IsErrorValue () const
 Checks if the value is the error value.

bool IsExceptional () const
 Checks if the value is exceptional.

bool IsNumber () const
 Checks if the value is numerical.

bool IsNumber (int &i) const
 Checks if the value is numerical.

bool IsNumber (double &r) const
 Checks if the value is numerical.

bool IsAbsoluteTimeValue () const
 Checks if the value is an absolute time value.

bool IsAbsoluteTimeValue (abstime_t &secs) const
 Checks if the value is an absolute time value.

bool IsRelativeTimeValue () const
 Checks if the value is a relative time value.

bool IsRelativeTimeValue (double &secs) const
 Checks if the value is a relative time value.

bool IsRelativeTimeValue (time_t &secs) const
bool SameAs (const Value &otherValue) const

Static Public Attributes

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)

Detailed Description

Represents the result of an evaluation.


Member Enumeration Documentation

enum Value::NumberFactor
 

Number factors.

Enumeration values:
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.

enum Value::ValueType
 

Value types.

Enumeration values:
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::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

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 [inline]
 

Checks if the value is an absolute time value.

Returns:
true iff the value is an absolute time value.

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::IsClassAdValue  )  const [inline]
 

Checks if the value is a ClassAd.

Returns:
true iff the value is a ClassAd value.

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 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::IsErrorValue  )  const [inline]
 

Checks if the value is the error value.

Returns:
true iff the value if the error value.

bool Value::IsExceptional  )  const [inline]
 

Checks if the value is exceptional.

Returns:
true iff the value is either undefined or error.

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 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::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 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 [inline]
 

Checks if the value is numerical.

Returns:
true iff the value is a number

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::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  )  const [inline]
 

Checks if the value is a relative time value.

Returns:
true iff the value is a relative time value

bool Value::IsStringValue  )  const [inline]
 

Checks if the value is a string.

Returns:
true iff the value is 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 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 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::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::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::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::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::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::SetUndefinedValue void   ) 
 

Sets the undefined value; previous value discarded.


The documentation for this class was generated from the following file: