Siena Fast Forwarding Documentation (v. 2.0.1)
Public Member Functions | List of all members
siena::Value Class Referenceabstract

interface of a generic value in the attribute-based data model. More...

#include <attributes.h>

Inheritance diagram for siena::Value:
Inheritance graph
[legend]

Public Member Functions

virtual ~Value ()
 virtual destructor
 
virtual TypeId type () const =0
 returns the actual type of this value.
 
virtual Int int_value () const =0
 returns this value as an integer. More...
 
virtual String string_value () const =0
 returns this value as a string. More...
 
virtual Bool bool_value () const =0
 returns this value as a boolean. More...
 
virtual Double double_value () const =0
 returns this value as a double. More...
 

Detailed Description

interface of a generic value in the attribute-based data model.

This represents a typed value. This is how one could print the value:

void print_siena_value(const siena::Value * v) {
std::string s;
switch(v->type()) {
cout << v->string_value().to_string(s) << endl;
break;
case siena::INT:
cout << v->int_value() << endl;
break;
cout << v->double_value() << endl;
break;
cout << (v->bool_value() ? "true" : "false") << endl;
break;
cout << "(generic value)" << endl;
cout << "Generic values are used in Constraints, not Messages." << endl;
}
}
Examples:
simple_attributes_types.h.

Member Function Documentation

virtual Bool siena::Value::bool_value ( ) const
pure virtual

returns this value as a boolean.

This method returns this value as a boolean if the actual type (returned by type()) is BOOL. The result is undefined if the actual type is not BOOL.

See Also
TypeId, type().
Examples:
message_iteration.cc, and simple_attributes_types.h.
virtual Double siena::Value::double_value ( ) const
pure virtual

returns this value as a double.

This method returns this value as a boolean if the actual type (returned by type()) is DOUBLE. The result is undefined if the actual type is not DOUBLE.

See Also
TypeId, type().
Examples:
message_iteration.cc, and simple_attributes_types.h.
virtual Int siena::Value::int_value ( ) const
pure virtual

returns this value as an integer.

This method returns this value as an integer if the actual type (returned by type()) is INT. The result is undefined if the actual type is not INT.

See Also
TypeId, type().
Examples:
message_iteration.cc, and simple_attributes_types.h.
virtual String siena::Value::string_value ( ) const
pure virtual

returns this value as a string.

This method returns this value as a string if the actual type (returned by type()) is STRING. The result is undefined if the actual type is not STRING.

See Also
TypeId, type().
Examples:
message_iteration.cc, and simple_attributes_types.h.