libIntegra
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
integra_api::CFloatValue Class Reference

Represents a float value. More...

#include "api/value.h"

Inheritance diagram for integra_api::CFloatValue:
Inheritance graph
[legend]
Collaboration diagram for integra_api::CFloatValue:
Collaboration graph
[legend]

Public Member Functions

 CFloatValue (float value)
 
type get_type () const
 Get this value's type (see type)
 
 operator float () const
 Cast to a float. More...
 
const CFloatValueoperator= (const CFloatValue &to_copy)
 
CValueclone () const
 Creates copy of value. More...
 
void convert (CValue &conversion_target) const
 Converts value into another type. More...
 
bool is_equal (const CValue &other) const
 Compares values. More...
 
float get_distance (const CValue &other) const
 Obtain an arbitrary measure of magnitude of different between values. More...
 
string get_as_string () const
 Convert value to string.
 
void set_from_string (const string &source)
 Set value from string. More...
 
- Public Member Functions inherited from integra_api::CValue
virtual operator int () const
 Cast to an integer. More...
 
virtual operator const string & () const
 Cast to a string. More...
 
CValuetransmogrify (type new_type) const
 Copy into new value of different type. More...
 

Additional Inherited Members

- Public Types inherited from integra_api::CValue
enum  type { INTEGER, FLOAT, STRING }
 
- Static Public Member Functions inherited from integra_api::CValue
static CValuefactory (type new_type)
 Create new CValue of specified type. More...
 
static const char * get_type_name (type value_type)
 Get string representation of value type.
 
static int type_to_ixd_code (type value_type)
 convert value type to ixd code More...
 
static type ixd_code_to_type (int ixd_code)
 convert ixd code to value type More...
 

Detailed Description

Represents a float value.

Member Function Documentation

CValue* integra_api::CFloatValue::clone ( ) const
virtual

Creates copy of value.

Creates a CValue of same type and value, allocated on the heap with new

Implements integra_api::CValue.

void integra_api::CFloatValue::convert ( CValue conversion_target) const
virtual

Converts value into another type.

Copies value into conversion_target, retaining as much information as possible when types differ

Implements integra_api::CValue.

float integra_api::CFloatValue::get_distance ( const CValue other) const
virtual

Obtain an arbitrary measure of magnitude of different between values.

Expects types to be the same. For numeric types, distance is actually abs( difference ) For strings, distance is taken as the levenshtein_distance (http://en.wikipedia.org/wiki/Levenshtein_distance

Parameters
otherValue to compare
Returns
a distance value if values are of same type, or -1 if types differ

Implements integra_api::CValue.

bool integra_api::CFloatValue::is_equal ( const CValue other) const
virtual

Compares values.

Parameters
otherValue to compare
Returns
true if values are of same type and equal value, otherwise false

Implements integra_api::CValue.

integra_api::CFloatValue::operator float ( ) const
virtual

Cast to a float.

See operator int() for further discussion of CValue's casting operators

Reimplemented from integra_api::CValue.

void integra_api::CFloatValue::set_from_string ( const string &  source)
virtual

Set value from string.

Note
when setting a numerical value, if conversion is not possible, the value is set to 0

Implements integra_api::CValue.


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