UFNumberArray Class Reference

UFNumberArray is a UFObject that holds an fixed sized array of numbers. More...

#include <ufobject.h>

Inheritance diagram for UFNumberArray:
Inheritance graph
[legend]
Collaboration diagram for UFNumberArray:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UFNumberArray (UFName name, int size, double minimum, double maximum, double defaultValue, int accuracyDigits=0xff, double step=0.0, double jump=0.0)
 Construct a UFNumberArray with the given size.
const char * StringValue () const
 Translate object to a string.
double DoubleValue (int index) const
 Return the numerical value of the index element of the object.
void Set (const UFObject &object)
void Set (const char *string)
 Set the value of the object from the string value.
void Set (int index, double number)
 Set the value of the index element to the given number.
void Set (const double array[])
 Set the values of all the array elements at once.
bool IsDefault () const
 Return true if object has its default value.
void SetDefault ()
 Set the current object value to its default value.
void Reset ()
 Reset the object value to its default value.
bool IsEqual (int index, double number) const
 Return true if the index element value is equal to number up to the prescribed accuracy.
int Size () const
double Minimum () const
double Maximum () const
int AccuracyDigits () const
double Step () const
double Jump () const

Detailed Description

UFNumberArray is a UFObject that holds an fixed sized array of numbers.


Constructor & Destructor Documentation

UFNumberArray::UFNumberArray ( UFName  name,
int  size,
double  minimum,
double  maximum,
double  defaultValue,
int  accuracyDigits = 0xff,
double  step = 0.0,
double  jump = 0.0 
)

Construct a UFNumberArray with the given size.

The initial value of the array elements is set to its default value. The number of accuracy digits effects the format of the StringValue() of the number. The IsEqual() test is also controlled by accuracyDigits. step and jump have no direct effect on the object. They are useful for constructing a GtkAdjustment as in ufnumber_array_hscale_new() and ufnumber_array_spin_button_new().

The object is create with one default value for all elements. Once SetDefault() is called, each element can have a different default.

See also:
accuracyDigits, step and jump are optional arguments, their default values are discussed in UFNumber::UFNumber().

Member Function Documentation

const char* UFNumberArray::StringValue (  )  const [virtual]

Translate object to a string.

UFObject takes care of the memory allocation and freeing of the string.

Reimplemented from UFObject.

double UFNumberArray::DoubleValue ( int  index  )  const

Return the numerical value of the index element of the object.

This double value can have better accuracy than accuracyDigits.

See also:
UFNumber::StringValue() for more information.
Exceptions:
UFException is thrown if the index is negative or larger than (Size()-1). This is probably a programming error.
void UFNumberArray::Set ( const UFObject object  ) 
void UFNumberArray::Set ( const char *  string  )  [virtual]

Set the value of the object from the string value.

This is the reverse of the StringValue() method. If the value changes, an uf_value_changed event is triggered.

Exceptions:
UFException is thrown if the the string can not be converted to the object type. This could result from a user input error.

Implements UFObject.

void UFNumberArray::Set ( int  index,
double  number 
)

Set the value of the index element to the given number.

If the number is outside of the allowed range, the number will be truncated and the Message() method will be called to report this incident.

Exceptions:
UFException is thrown if the index is negative or larger than (Size()-1). This is probably a programming error.
void UFNumberArray::Set ( const double  array[]  ) 

Set the values of all the array elements at once.

This is useful if one wants the uf_value_changed event to be triggered only once. array[] is assumed to be of the right Size().

bool UFNumberArray::IsDefault (  )  const [virtual]

Return true if object has its default value.

For numerical objects, the values has to the same up to the prescribed accuracy.

Implements UFObject.

void UFNumberArray::SetDefault (  )  [virtual]

Set the current object value to its default value.

A uf_default_changed event is triggered.

Implements UFObject.

void UFNumberArray::Reset (  )  [virtual]

Reset the object value to its default value.

If the value changes, a uf_value_changed event is triggered.

Implements UFObject.

bool UFNumberArray::IsEqual ( int  index,
double  number 
) const

Return true if the index element value is equal to number up to the prescribed accuracy.

Exceptions:
UFException is thrown if the index is negative or larger than (Size()-1). This is probably a programming error.
int UFNumberArray::Size (  )  const
double UFNumberArray::Minimum (  )  const
double UFNumberArray::Maximum (  )  const
int UFNumberArray::AccuracyDigits (  )  const
double UFNumberArray::Step (  )  const
double UFNumberArray::Jump (  )  const

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Wed Mar 17 21:05:32 2010 for UFRaw by  doxygen 1.6.1