UFNumberArray is a UFObject that holds an fixed sized array of numbers. More...
#include <ufobject.h>
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 |
UFNumberArray is a UFObject that holds an fixed sized array of numbers.
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.
const char* UFNumberArray::StringValue | ( | ) | const [virtual] |
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.
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.
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.
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.
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 |