FemtoScan Online SDK Documentation

Home :: FsOnlineSDK :: fmutl classes

class SPMVarList

? ^ 
    extends FSAllocator as public

Performs variables approximation, evaluation, validation, dependencies validation.
Source:
../fmutl/SPMVarList.h:63
Author:
ATC
Version:
1.0

Contents

^ 
EntityTypeScopeShort Description
~SPMVarListdestructor public Standart destructor.
SPMVarListconstructor public Default constructor.
SPMVarListconstructor publicautomatically generated
AddFireVariableChangeHandlermethod public Add variable "fire change" handler.
AddUpdateVariableHandlermethod public Add variable interface handler.
approximate_strvalmethod public Approximate variable's value according to it's display formula.
approximate_valmethod public Approximate variable's value according to it's display formula.
call_interfacemethod public Call variable's interface function (if any).
ChangeVariablemethod public Change variable.
clearmethod public Empty variable list.
evaluate_varmethod public Evaluate variable's value according to it's display formula.
FireVariableChangemethod public Notify user that variable's value have changed.
fire_variable_changemethod public Notify user that variable's value have changed.
get_display_typemethod public Get type of variable.
get_sizemethod public Get number of variables in the list.
get_varmethod public Get reference to the variable.
get_varmethod public Get reference to the variable.
get_variablesmethod public Get variable list.
get_var_imethod public Get variable ordinal number.
has_interfacemethod public Check if variable has user-defined interface function.
is_filtermethod public Check if variable is a filter.
is_filtered_outmethod public Check if variable is filtered out.
Loadmethod public Load list from array of string pairs.
operator =operator publicautomatically generated
operator []operator public Get variable by it's id.
opt_list_itemstruct public Structure used in #LoadOptions function
RemoveFireVariableChangeHandlermethod public Remove variable "fire change" handler.
RemoveUpdateVariableHandlermethod public Remove variable interface handler.
reset_timestampsmethod public Reset timestamps.
set_varmethod public Change variable.
set_varmethod public Change variable.
set_variablesmethod public Set variables list.
subst_varsmethod public Substitute variables.
UpdateVariablemethod public Update variable's display.
update_display_dependenciesmethod public Update display-dependent variables.
update_validation_dependenciesmethod public Update validation-dependent variables.
update_variablemethod public Update variable's display.
validate_varmethod public Validate variable's value.
validate_var_no_depmethod public Validate variable's value.

destructor ~SPMVarList

? ^  > 
Standart destructor.
Source:
../fmutl/SPMVarList.h:99
Code:
public FMUTL_API virtual ~ SPMVarList ( )

constructor SPMVarList

? ^  < > 
Default constructor.
Source:
../fmutl/SPMVarList.h:94
Code:
public FMUTL_API SPMVarList ( )

constructor SPMVarList

? ^  < > 
automatically generated
Source:
../fmutl/SPMVarList.h
Code:
public SPMVarList ( const SPMVarList & )

method AddFireVariableChangeHandler

? ^  < > 
Add variable "fire change" handler.

Handler will be added to the internal list, so it will be called whenever any variable changes it's value.

Source:
../fmutl/SPMVarList.h:163
Param:
phndlr pointer to the object to be called
See Also:
SPMVarListHandler
Code:
public FMUTL_API void AddFireVariableChangeHandler ( SPMVarListHandler * phndlr )

method AddUpdateVariableHandler

? ^  < > 
Add variable interface handler.

Handler will be added to the internal list, so it will be called whenever any variable need to update it's display.

Source:
../fmutl/SPMVarList.h:129
Param:
phndlr pointer to the object to be called
See Also:
SPMVarListInterface
Code:
public FMUTL_API void AddUpdateVariableHandler ( SPMVarListInterface * phndlr )

method approximate_strval

? ^  < > 
Approximate variable's value according to it's display formula.
Source:
../fmutl/SPMVarList.h:364
Params:
strval the value to which we should approximate. String will be scanned by strtod and strtol functions, and the best result will be taken for approximation.
var copy of one of the list's variables, or variable itself. On return it's value would be updated so that evaluate_var will return the value closest to the initial strval.
Returns:
double result of approximation.
See Also:
approximate_val
Code:
public FMUTL_API double approximate_strval ( const char * strval ,
SPMVar & var ) const

method approximate_val

? ^  < > 
Approximate variable's value according to it's display formula.
Source:
../fmutl/SPMVarList.h:352
Params:
val the value to which we should approximate. On return it would be set to the nearest possible value.
var copy of one of the list's variables, or variable itself. On return it's value would be updated so that evaluate_var will return the value closest to the initial val.
Code:
public FMUTL_API void approximate_val ( double & val ,
SPMVar & var ) const

method call_interface

? ^  < > 
Call variable's interface function (if any).

After interface was called, variable will be set to the new value, returned by the interface function. Interface is called by substituting the 'interface' word with 'call_function' word and calling fmutl::eval_expression function. The result returned is used as argument for SPMVar::from_string function for the var.

Source:
../fmutl/SPMVarList.h:342
Param:
var copy of one of the list's variables, or variable itself.
See Also:
eval_expression
Code:
public FMUTL_API void call_interface ( SPMVar & var ) const

method ChangeVariable

? ^  < > 
Change variable.

Change list variable. If new value differs from current value, variable will be validated, then it's display and dependencies shall be automaticaly updated. After that, variable change event will be fired.

Source:
../fmutl/SPMVarList.h:147
See Also:
AddUpdateVariableHandler, AddFireVariableChangeHandler
Code:
public FMUTL_API void ChangeVariable ( int iVar ,
const SPMVar & v )

method clear

? ^  < > 
Empty variable list.
Source:
../fmutl/SPMVarList.h:278
Code:
public FMUTL_API void clear ( )

method evaluate_var

? ^  < > 
Evaluate variable's value according to it's display formula.
Source:
../fmutl/SPMVarList.h:330
Param:
var copy of one of the list's variables, or variable itself.
Returns:
evaluated value.
Code:
public FMUTL_API SPMVar evaluate_var ( const SPMVar & var ) const

method FireVariableChange

? ^  < > 
Notify user that variable's value have changed.

Iterates through variable's "fire change" handlers.

Source:
../fmutl/SPMVarList.h:177
See Also:
AddFireVariableChangeHandler
Code:
public FMUTL_API void FireVariableChange ( int iVar )

method fire_variable_change

? ^  < > 
Notify user that variable's value have changed.

This function searches for variable with given id, and if found, calls FireVariableChange .

Source:
../fmutl/SPMVarList.h:410
Param:
id id of changed variable.
See Also:
FireVariableChange
Code:
public FMUTL_API void fire_variable_change ( const char * id )

method get_display_type

? ^  < > 
Get type of variable.
Source:
../fmutl/SPMVarList.h:272
Param:
i variable's ordinal number.
Returns:
one of SPMVarType values.
Code:
public FMUTL_API SPMVarType get_display_type ( size_t i ) const

method get_size

? ^  < > 
Get number of variables in the list.
Source:
../fmutl/SPMVarList.h:191
Returns:
number of variables in the list.
Code:
public FMUTL_API size_t get_size ( ) const

method get_var

? ^  < > 
Get reference to the variable.
Source:
../fmutl/SPMVarList.h:200
Param:
i variable's ordinal number. Should be from 0 to get_size - 1. If i is equal to -1, reference to the null variable returned.
Returns:
reference to the variable.
Code:
public FMUTL_API const SPMVar & get_var ( size_t i ) const

method get_var

? ^  < > 
Get reference to the variable.
Source:
../fmutl/SPMVarList.h:208
Param:
id variable's id. If no variable with such id exists, reference to the null variable returned.
Returns:
reference to the variable.
Code:
public FMUTL_API const SPMVar & get_var ( const char * id ) const

method get_variables

? ^  < > 
Get variable list.
Source:
../fmutl/SPMVarList.h:303
Params:
variables variables array.
size number of variables in the array.
Returns:
if variables !=0 and size!=0, number of actually copied variables. Otherwise, the required size of variables array returned (same as by get_size .
Code:
public FMUTL_API size_t get_variables ( SPMVar * variables ,
size_t size )

method get_var_i

? ^  < > 
Get variable ordinal number.
Source:
../fmutl/SPMVarList.h:214
See Also:
get_var
Code:
public FMUTL_API size_t get_var_i ( const char * id ) const

method has_interface

? ^  < > 
Check if variable has user-defined interface function.

Variable has an interface if it's display string begins with 'interface' word.

Source:
../fmutl/SPMVarList.h:249
Param:
i variable's ordinal number.
Returns:
true if variable is a filter.
See Also:
call_interface
Code:
public FMUTL_API bool has_interface ( size_t i ) const

method is_filter

? ^  < > 
Check if variable is a filter.

Variable is a filter if it has spmvtEnum type, and at least one variable in the list has enum string value as a part of it's id. Checks for string inclusion are performed with contains_word function.

Source:
../fmutl/SPMVarList.h:240
Param:
i variable's ordinal number.
Returns:
true if variable is a filter.
See Also:
SPMVarType, SPMVar::enum_filter
Code:
public FMUTL_API bool is_filter ( size_t i ) const

method is_filtered_out

? ^  < > 
Check if variable is filtered out.

Variable can be filtered out if:

  1. There is a filter variable, which has one of it's enum string values as a part of this variable's id.
  2. That variable's current value is not a part of this variable's id.
Checks for string inclusion are performed with contains_word function.
Source:
../fmutl/SPMVarList.h:265
Param:
i variable's ordinal number.
Returns:
true if variable is filtered out.
See Also:
is_filter, SPMVar::enum_filter
Code:
public FMUTL_API bool is_filtered_out ( size_t i ) const

method Load

? ^  < > 
Load list from array of string pairs.

Source:
../fmutl/SPMVarList.h:120
Code:
public FMUTL_API void Load ( opt_list_item * items ,
size_t size )

operator =

? ^  < > 
automatically generated
Source:
../fmutl/SPMVarList.h
Code:
public SPMVarList & operator = ( const SPMVarList & )

operator []

? ^  < > 
Get variable by it's id.

This operator allows quickly obtain reference to variable.

Source:
../fmutl/SPMVarList.h:401
Param:
key variable's id.
Returns:
reference to found variable. If no such variable exists, null variable returned.
Code:
public FMUTL_API const SPMVar & operator [] ( const std::string & key ) const

struct opt_list_item

? ^  < > 
Structure used in #LoadOptions function
Source:
../fmutl/SPMVarList.h:104
Code:
public struct opt_list_item

method RemoveFireVariableChangeHandler

? ^  < > 
Remove variable "fire change" handler.

Remove handler from the the internal list.

Source:
../fmutl/SPMVarList.h:170
See Also:
AddFireVariableChangeHandler
Code:
public FMUTL_API void RemoveFireVariableChangeHandler ( SPMVarListHandler * phndlr )

method RemoveUpdateVariableHandler

? ^  < > 
Remove variable interface handler.

Remove handler from the the internal list.

Source:
../fmutl/SPMVarList.h:136
See Also:
AddUpdateVariableHandler
Code:
public FMUTL_API void RemoveUpdateVariableHandler ( SPMVarListInterface * phndlr )

method reset_timestamps

? ^  < > 
Reset timestamps.

Reset all timestamps to 0.

Source:
../fmutl/SPMVarList.h:183
Code:
public FMUTL_API void reset_timestamps ( )

method set_var

? ^  < > 
Change variable.
Source:
../fmutl/SPMVarList.h:220
Param:
var new value for variable
Code:
public FMUTL_API void set_var ( const SPMVar & var )

method set_var

? ^  < > 
Change variable.
Source:
../fmutl/SPMVarList.h:227
Params:
id variable's id.
val new value for variable. @link SPMVar::from_string @endlink will be called with this parameter.
Code:
public FMUTL_API void set_var ( const char * id ,
const char * val )

method set_variables

? ^  < > 
Set variables list.

Variable's options will be scanned for display string and validate string. All remaining data will be assigned back to the options. If user wants to implement more functionality, he should override this function and call original version in the beginning of the new one. Display and validation strings are extracted with next_token function, and should be delimited with commas (',').

Source:
../fmutl/SPMVarList.h:293
Params:
variables variables array.
size number of variables in the array.
See Also:
SPMVar::get_options, SPMVar::set_options
Code:
public FMUTL_API virtual void set_variables ( const SPMVar * variables ,
size_t size )

method subst_vars

? ^  < > 
Substitute variables.

All variables designated by delimiter will be substituted by their values from the list. I.e., if delimiter is '#', all strings of form # will be replaced by that variable's double value as returned by SPMVar::operator double .

Source:
../fmutl/SPMVarList.h:393
Params:
s string to process.
vardelim variable delimiter.
self variable for self-substitution (marked by two consequtive delimiters)
Code:
public FMUTL_API void subst_vars ( std::string & s ,
char vardelim ,
const SPMVar * self ) const

method UpdateVariable

? ^  < > 
Update variable's display.

Iterates through variable's update handlers.

Source:
../fmutl/SPMVarList.h:154
See Also:
AddUpdateVariableHandler
Code:
public FMUTL_API void UpdateVariable ( int iVar )

method update_display_dependencies

? ^  < > 
Update display-dependent variables.

Function scans through the list of variables who's display formula is dependent on this variable and updates them by calling UpdateVariable function.

Source:
../fmutl/SPMVarList.h:312
Param:
id identificator of updated variable.
Code:
public FMUTL_API void update_display_dependencies ( const char * id )

method update_validation_dependencies

? ^  < > 
Update validation-dependent variables.

Function scans through the list of of variables who's validation formula is dependent on this variable and updates them by calling UpdateVariable and FireVariableChange functions, if needed.

Source:
../fmutl/SPMVarList.h:322
Param:
id identificator of updated variable.
Code:
public FMUTL_API void update_validation_dependencies ( const char * id )

method update_variable

? ^  < > 
Update variable's display.

This function searches for variable with given id, and if found, calls UpdateVariable .

Source:
../fmutl/SPMVarList.h:419
Param:
id id of changed variable.
See Also:
UpdateVariable
Code:
public FMUTL_API void update_variable ( const char * id )

method validate_var

? ^  < > 
Validate variable's value.
Source:
../fmutl/SPMVarList.h:373
Param:
var variable to validate. This should be a copy of the one of the lists's variables, or variable itself. If variable's value was changed as the result of validation, then dependent variables will be updated.
Returns:
true if variable's value has been chaged.
Code:
public FMUTL_API bool validate_var ( SPMVar & var )

method validate_var_no_dep

? ^  < > 
Validate variable's value.
Source:
../fmutl/SPMVarList.h:382
Param:
var variable to validate. This should be a copy of the one of the lists's variables, or variable itself. No dependent variables will be updated, neither no any handlers will be called.
Returns:
true if variable's value has been chaged.
Code:
public FMUTL_API bool validate_var_no_dep ( SPMVar & var ) const

(C) Advanced Technologies Center, 2002-2006
For support contact us at fsdev@nanoscopy.net