Siena C++ API documentation (v. 0.4.1)

Main Page   Class Hierarchy   Compound List   File List   Compound Members   Examples  

AttributeValue Class Reference

#include <Siena.h>

List of all members.

Public Methods

 AttributeValue ()
 AttributeValue (const AttributeValue &v)
 AttributeValue (const string &)
 AttributeValue (const char *)
 AttributeValue (int)
 AttributeValue (short)
 AttributeValue (long)
 AttributeValue (bool)
 AttributeValue (double)
 ~AttributeValue ()
SXType type () const
int32_t& int_value ()
bool& bool_value ()
string& string_value ()
double& double_value ()
const int32_t& int_value () const
const bool& bool_value () const
const string& string_value () const
const double& double_value () const
 operator long () const
 operator int () const
 operator short () const
 operator string () const
 operator bool () const
 operator double () const
AttributeValue& operator= (const AttributeValue &)
AttributeValue& operator= (const string &)
AttributeValue& operator= (const char *)
AttributeValue& operator= (int)
AttributeValue& operator= (short)
AttributeValue& operator= (long)
AttributeValue& operator= (bool)
AttributeValue& operator= (double)
bool operator== (const AttributeValue &) const
bool operator< (const AttributeValue &) const

Protected Attributes

SXType sxtype


Detailed Description

value of an attribute in a notification

An AttributeValue stores the value of an attribute. Attributes can be of a pre-defined set of types (SXType). AttributeValue provides methods for accessing and assigning values in the form of C++ types. In particular, an AttributeValue of type SX_integer can be assigned to and from an int, an AttributeValue of type SX_string can be assigned to and from a C++ standard string, etc.

Example:

    AttributeValue x, y;
    //
    // now x.type() == y.type() == SX_null
    //
    x = true;
    y = x;
    //
    // now x.type() == y.type() == SX_bool
    //
    int i = 10;
    if (x.bool_value()) y = i + 10;
    x = i + 20;
    cout << x.int_value() + y.int_value() << endl;
    i = x;
    y = "ciao";
    cout << y.string_value() << endl;
    


Constructor & Destructor Documentation

AttributeValue::AttributeValue ( )
 

constructs a null value

AttributeValue::AttributeValue ( const AttributeValue & v )
 

copy constructor

AttributeValue::AttributeValue ( const string & )
 

construct from a string

AttributeValue::AttributeValue ( const char * )
 

construct from a C-style string

AttributeValue::AttributeValue ( int )
 

construct from an int

AttributeValue::AttributeValue ( short )
 

construct from an short

AttributeValue::AttributeValue ( long )
 

construct from an long

AttributeValue::AttributeValue ( bool )
 

construct from a bool

AttributeValue::AttributeValue ( double )
 

construct from a double

AttributeValue::~AttributeValue ( )
 

construct from a Date


Member Function Documentation

const bool & AttributeValue::bool_value ( ) const
 

returns a copy of the value as a boolean

Exceptions:
BadType   exception is generated when type() != SX_bool

bool & AttributeValue::bool_value ( )
 

returns a reference to the value as a boolean

Exceptions:
BadType   exception is generated when type() != SX_bool

const double & AttributeValue::double_value ( ) const
 

returns a copy of the value as a double

Exceptions:
BadType   exception is generated when type() != SX_double

double & AttributeValue::double_value ( )
 

returns a reference to the value as a double

Exceptions:
BadType   exception is generated when type() != SX_double

const int32_t & AttributeValue::int_value ( ) const
 

returns a reference to the value as an integer

Exceptions:
BadType   exception is generated when type() != SX_integer

int32_t & AttributeValue::int_value ( )
 

returns a reference to the value as an integer

returns a reference to the value as an integer

Example:

	    AttributeValue x = 20;
	    cout << x.int_value();
	    x.int_value()++;
	    cout << x.int_value();
	
Exceptions:
BadType   exception is generated when type() != SX_integer

AttributeValue::operator bool ( ) const
 

conversion operator to bool

Exceptions:
BadType   exception is generated when type() != SX_bool

@doc conversion operator to bool

AttributeValue::operator double ( ) const
 

conversion operator to double

Exceptions:
BadType   exception is generated when type() != SX_double

@doc conversion operator to double

AttributeValue::operator int ( ) const
 

conversion operator to int

returns a copy of the value as an integer whenever the AttributeValue is used in place of an int.

Example:

	    AttributeValue x = 20;
	    int i = x;
	
Exceptions:
BadType   exception is generated when type() != SX_int

AttributeValue::operator long ( ) const
 

conversion operator to long

returns a copy of the value as an integer whenever the AttributeValue is used in place of an int.

Example:

	    AttributeValue x = 20;
	    long l = x;
	
Exceptions:
BadType   exception is generated when type() != SX_int

AttributeValue::operator short ( ) const
 

conversion operator to short

returns a copy of the value as an integer whenever the AttributeValue is used in place of an int.

Example:

	    AttributeValue x = 20;
	    short s = x;
	
Exceptions:
BadType   exception is generated when type() != SX_int

AttributeValue::operator string ( ) const
 

conversion operator to string

Exceptions:
BadType   exception is generated when type() != SX_string

@doc

returns a copy of the value as a string whenever the AttributeValue is used in place of a string.

Example:

	    AttributeValue x = "Siena";
	    string s = x;
	

bool AttributeValue::operator< ( const AttributeValue & ) const
 

ordering relation

AttributeValue & AttributeValue::operator= ( double )
 

from double

AttributeValue & AttributeValue::operator= ( bool )
 

from bool

AttributeValue & AttributeValue::operator= ( long )
 

from long

AttributeValue & AttributeValue::operator= ( short )
 

from short

AttributeValue & AttributeValue::operator= ( int )
 

from int

AttributeValue & AttributeValue::operator= ( const char * )
 

from C-style string

AttributeValue & AttributeValue::operator= ( const string & )
 

from string

AttributeValue & AttributeValue::operator= ( const AttributeValue & )
 

copy assignment

bool AttributeValue::operator== ( const AttributeValue & ) const
 

equality relation

const string & AttributeValue::string_value ( ) const
 

returns a copy of the value as a string

Exceptions:
BadType   exception is generated when type() != SX_string

string & AttributeValue::string_value ( )
 

returns a reference to the value as a string

Example:

	    AttributeValue x = "ciao";
	    cout << x.string_value();
	    x.string_value() += " ciao";
	    cout << x.string_value();
	
Exceptions:
BadType   exception is generated when type() != SX_string

SXType AttributeValue::type ( ) const
 

returns the actual type of this value


The documentation for this class was generated from the following file:
Copyright © 2001 University of Colorado.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". This documentation is authored and maintained by Antonio Carzaniga