FemtoScan Online SDK Documentation

Home :: FsOnlineSDK :: fmutl classes

class SPMVar

? ^ 
    extends FSAllocator as public

Versatile variable implementation.

Variable has the following attributes:

id
unique string identificator. Initially 0.
name
human-readable display name. Initially 0.
type
type of containing data. Initially spmvtNone.
timestamp
unsigned timestamp value. Initially 0.
attributes
type-dependent parameters (such as minimum and maximum values etc.).
options
implementation-scpecific options, stored as text string. Initially 0.
Source:
../fmutl/SPMVar.h:52
Author:
ATC
Version:
1.0
See Also:
SPMVarType

Contents

^ 
EntityTypeScopeShort Description
~SPMVardestructor public Standart destructor.
SPMVarconstructor public Standart constructor.
SPMVarconstructor public Copy constructor.
array_blockszmethod public Get array block size.
array_lenmethod public Get array length.
array_valmethod public Get array pointer.
as_filtermethod public Get string representation for using as selector.
as_stringmethod public Get string representation.
clear_parsed_optionsmethod protected Clear derived classes.
dbl_lsbmethod public Get double least significant value.
dbl_maxmethod public Get high double limit.
dbl_minmethod public Get lower double limit.
descriptionmethod public Get string description.
Destroymethod public Destroy variable.
enum_filtermethod public Get enum filter value.
enum_lenmethod public Get enum length.
enum_namemethod public Get enum string name.
enum_valmethod public Get enum ordinal value.
equalmethod public Equality function.
from_stringmethod public Set string value from it's literal representation.
get_idmethod public Get identificator.
get_namemethod public Get name.
get_optionsmethod public Get options.
get_timestampmethod public Get timestamp.
get_var_typemethod public Get variable type.
goodmethod public Check variable for validity.
increment_timestampmethod public Increment timestamp.
Initmethod public Initialize variable from string description.
Initmethod public Initialize variable by list of parameters.
int_maxmethod public Get integer high limit.
int_minmethod public Get integer lower limit.
is_older_thanmethod public Compare timestamps.
operator !=operator public Non-equality operator.
operator =operator public String assignment operator.
operator =operator public Boolean assignment operator.
operator =operator public Integer assignment operator.
operator =operator public Copy operator.
operator =operator public Double assignment operator.
operator ==operator public Equality operator.
operator booloperator public Convert variable to bool.
operator const char *operator public Convert variable to const char*.
operator doubleoperator public Convert variable to double.
operator intoperator public Convert variable to int.
parsed_optionsmethod protected Get additional options.
parse_optionsmethod protected Parse variable options.
set_arraymethod public Set array value.
set_array_blockszmethod public Set array block size.
set_array_lenmethod public Set array length.
set_enummethod public Set enum by filter value.
set_enummethod public Set enum by ordinal value.
set_enum_valmethod public Set enum by integer value.
set_namemethod public Set name.
set_optionsmethod public Set options.
set_stringmethod public Set string value explicitely.
set_timestampmethod public Set timestamp.
timestamp_ttypedef public timestamp type
update_timestampmethod public Set timestamp value to the current system time.

destructor ~SPMVar

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

constructor SPMVar

? ^  < > 
Standart constructor.

New variable will have spmvtNone type.

Source:
../fmutl/SPMVar.h:65
See Also:
SPMVarType
Code:
public FMUTL_API SPMVar ( )

constructor SPMVar

? ^  < > 
Copy constructor.
Source:
../fmutl/SPMVar.h:71
Param:
X variable to copy.
Code:
public FMUTL_API SPMVar ( const SPMVar & X )

method array_blocksz

? ^  < > 
Get array block size.
Source:
../fmutl/SPMVar.h:367
Returns:
array block size, if variable type is spmvtArray, or 0.
Code:
public unsigned array_blocksz ( ) const

method array_len

? ^  < > 
Get array length.
Source:
../fmutl/SPMVar.h:361
Returns:
array length, if variable type is spmvtArray, or 0.
Code:
public unsigned array_len ( ) const

method array_val

? ^  < > 
Get array pointer.
Source:
../fmutl/SPMVar.h:355
Returns:
array pointer, if it has spmvtArray type, or 0.
Code:
public const void * array_val ( ) const

method as_filter

? ^  < > 
Get string representation for using as selector.
Source:
../fmutl/SPMVar.h:528
Returns:
string representation of variable, converted to lowercase (to use as selector string). For integers returns (unsigned)(int) conversion value, for boolean type returns "ena" or "dis" strings, for enums and strings returns lowercase strings with non-alphanumerical characters replaced by underscores. For other types empty string returned.
Code:
public FMUTL_API smart_string as_filter ( ) const

method as_string

? ^  < > 
Get string representation.
Source:
../fmutl/SPMVar.h:517
Returns:
string representation of variable. Variable's value can be restored from this string by applying from_string .
Code:
public FMUTL_API smart_string as_string ( ) const

method clear_parsed_options

? ^  < > 
Clear derived classes.

Gives a chnance to derived classes to clear itself. Called in the beginning of the Destroy function.

Source:
../fmutl/SPMVar.h:173
Code:
protected FMUTL_API virtual void clear_parsed_options ( )

method dbl_lsb

? ^  < > 
Get double least significant value.
Source:
../fmutl/SPMVar.h:284
Returns:
least significant double value (precision), if applicable, or 0.0.
Code:
public double dbl_lsb ( ) const

method dbl_max

? ^  < > 
Get high double limit.
Source:
../fmutl/SPMVar.h:278
Returns:
maximum double value, if applicable, or 0.0.
Code:
public double dbl_max ( ) const

method dbl_min

? ^  < > 
Get lower double limit.
Source:
../fmutl/SPMVar.h:272
Returns:
minimum double value, if applicable, or 0.0.
Code:
public double dbl_min ( ) const

method description

? ^  < > 
Get string description.
Source:
../fmutl/SPMVar.h:536
Returns:
string description of variable. All variable's attributes (except value) can be restored from this string by Init .
See Also:
Init
Code:
public FMUTL_API smart_string description ( ) const

method Destroy

? ^  < > 
Destroy variable.

Frees all internal buffers. Variable type set to spmvtNone.

Source:
../fmutl/SPMVar.h:164
Code:
public FMUTL_API void Destroy ( )

method enum_filter

? ^  < > 
Get enum filter value.
Source:
../fmutl/SPMVar.h:337
Returns:
enum filter (lowercase string with non-characers replaced by underscores '_') value, if it has spmvtEnum type, or 0.
Code:
public const char * enum_filter ( ) const

method enum_len

? ^  < > 
Get enum length.
Source:
../fmutl/SPMVar.h:349
Returns:
number of enum values, if it has spmvtEnum type, or 0.
Code:
public unsigned enum_len ( ) const

method enum_name

? ^  < > 
Get enum string name.
Source:
../fmutl/SPMVar.h:343
Returns:
enum string name, if it has spmvtEnum type, or 0.
Code:
public const char * enum_name ( ) const

method enum_val

? ^  < > 
Get enum ordinal value.
Source:
../fmutl/SPMVar.h:330
Returns:
enum ordinal value (index in the list, not an assigned number), if it has spmvtEnum type, or 0.
Code:
public unsigned enum_val ( ) const

method equal

? ^  < > 
Equality function.
Source:
../fmutl/SPMVar.h:510
Param:
X variable to compare with.
Returns:
true if variable's types and their string representations are equal.
See Also:
as_string
Code:
public FMUTL_API bool equal ( const SPMVar & X ) const

method from_string

? ^  < > 
Set string value from it's literal representation.
Source:
../fmutl/SPMVar.h:557
Returns:
true if value was set successfully.
See Also:
as_string
Code:
public FMUTL_API bool from_string ( const char * str )

method get_id

? ^  < > 
Get identificator.
Source:
../fmutl/SPMVar.h:186
Returns:
variable indentificator.
Code:
public const char * get_id ( ) const

method get_name

? ^  < > 
Get name.
Source:
../fmutl/SPMVar.h:192
Returns:
variable human-readable name (if any).
Code:
public const char * get_name ( ) const

method get_options

? ^  < > 
Get options.
Source:
../fmutl/SPMVar.h:242
Returns:
variable additional options (if any).
Code:
public const char * get_options ( ) const

method get_timestamp

? ^  < > 
Get timestamp.
Source:
../fmutl/SPMVar.h:204
Returns:
timestamp value
Code:
public timestamp_t get_timestamp ( ) const

method get_var_type

? ^  < > 
Get variable type.
Source:
../fmutl/SPMVar.h:256
Returns:
variable type.
See Also:
SPMVarType
Code:
public const SPMVarType get_var_type ( ) const

method good

? ^  < > 
Check variable for validity.
Source:
../fmutl/SPMVar.h:180
Returns:
true if variable has valid attributes.
Code:
public bool good ( ) const

method increment_timestamp

? ^  < > 
Increment timestamp.

Obsolete function. Use update_timestamp instead.

Source:
../fmutl/SPMVar.h:217
Returns:
new timestamp value.
Code:
public timestamp_t increment_timestamp ( )

method Init

? ^  < > 
Initialize variable from string description.
Source:
../fmutl/SPMVar.h:149
Param:
descr description string. Description format:
spmvtNone
id (name),options
 freq_gen_2 (Frequency generator 2)
spmvtDouble
id (name), double, min, max, lsb, options
 temperature(Temp., C),double,27.0,80.0,0.00080872816
spmvtInt
id (name), int, min, max, options
 freq_gen_2.ampl(Ampl., mV),int,-2^9,2^9-1,##*$ZAmplMax/(2^9-1)
spmvtBool
id (name), boolean, options
 tip_engaged(Tip Engage),boolean
spmvtString
id (name), string, options
 afm.cantilever.material(Material),string
spmvtEnum
id (name), enum, vstr_i[(display name)][=<value>], ... ,,options
 plane.image1.img_type=(Data),enum,Height=1,Deflection,
	Friction,Intensity,Deflection 2,Channel 3,Channel 4,Channel 5,Channel 6, Channel 7
spmvtArray
id (name), array, len, blocksz, options
 plane.litography.mask(Mask),array,0,2
all fields but id and type specification are optional. Options can be any combination of characters except ';'
See Also:
SPMVarType
Code:
public FMUTL_API void Init ( const char * descr )

method Init

? ^  < > 
Initialize variable by list of parameters.
Source:
../fmutl/SPMVar.h:107
Params:
_id variable's identificator.
_name variable's name.
_var_type variable's type.
... type-dependent parameters.
spmvtNone
no parameters.
spmvtDouble
minimum value, maximum value, least-significant value.
spmvtInt
minimum value, maximum value.
spmvtBool
no parameters.
spmvtString
no parameters.
spmvtEnum
list of strings, terminated with NULL pointer. Example:
SPMVar X; X.Init("testvar","Test enumeration variable",spmvtEnum,"value 1","value 2","value 3",0);
spmvtArray
number of blocks, block size.
See Also:
SPMVarType
Code:
public FMUTL_API void Init ( const char * _id ,
const char * _name ,
SPMVarType _var_type ,
... )

method int_max

? ^  < > 
Get integer high limit.
Source:
../fmutl/SPMVar.h:306
Returns:
maximum integer value, if applicable, or 0.0.
Code:
public int int_max ( ) const

method int_min

? ^  < > 
Get integer lower limit.
Source:
../fmutl/SPMVar.h:300
Returns:
minimum integer value, if applicable, or 0.0.
Code:
public int int_min ( ) const

method is_older_than

? ^  < > 
Compare timestamps.

By wraparound reasons, it is considered that all timestamp values in range 0xffff0001-0xffffffff are older then ones in 0x0-0xfffe (including endpoints). E.g., variable with timestamp 0x1234 is more up-to-date then one with timestamp 0xffff5678. If variable v has zero timestamp, function returns true.

Source:
../fmutl/SPMVar.h:236
Param:
v variable to compare with
Returns:
true if this variable is older then v
Code:
public bool is_older_than ( const SPMVar & v ) const

operator !=

? ^  < > 
Non-equality operator.
Source:
../fmutl/SPMVar.h:502
Param:
X variable to compare with.
Returns:
true if variable's types or their string representations are not equal.
See Also:
equal, as_string
Code:
public bool operator != ( const SPMVar & X ) const

operator =

? ^  < > 
String assignment operator.

Value assigned by calling from_string .

Source:
../fmutl/SPMVar.h:420
Param:
_val value to assign.
Returns:
assigned value or 0.
Code:
public const char * operator = ( const char * _val )

operator =

? ^  < > 
Boolean assignment operator.

Value assigned only if variable type is spmvtDouble, spmvtInt or spmvtBool.

Source:
../fmutl/SPMVar.h:410
Param:
_val value to assign.
Returns:
assigned value or false.
Code:
public bool operator = ( bool _val )

operator =

? ^  < > 
Integer assignment operator.

Value assigned only if variable type is spmvtDouble, spmvtInt, spmvtBool or spmvtEnum.

Source:
../fmutl/SPMVar.h:400
Param:
_val value to assign.
Returns:
assigned value or 0.
Code:
public int operator = ( int _val )

operator =

? ^  < > 
Copy operator.
Source:
../fmutl/SPMVar.h:77
Param:
X variable to copy.
Code:
public FMUTL_API SPMVar & operator = ( const SPMVar & X )

operator =

? ^  < > 
Double assignment operator.

Value assigned only if variable type is spmvtDouble, spmvtInt or spmvtBool.

Source:
../fmutl/SPMVar.h:387
Param:
_val value to assign.
Returns:
assigned value or 0.0.
Code:
public double operator = ( double _val )

operator ==

? ^  < > 
Equality operator.
Source:
../fmutl/SPMVar.h:493
Param:
X variable to compare with.
Returns:
true if variable's types and their string representations are equal.
See Also:
equal, as_string
Code:
public bool operator == ( const SPMVar & X ) const

operator bool

? ^  < > 
Convert variable to bool.
Source:
../fmutl/SPMVar.h:316
Returns:
boolean value, if applicable, or false. Nonempty string will generate true value, for enums true will be returned if enum integer value not equals zero.
Code:
public operator bool ( ) const

operator const char *

? ^  < > 
Convert variable to const char*.
Source:
../fmutl/SPMVar.h:323
Returns:
const char* value, if it has spmvtString type, or null pointer.
Code:
public operator const char * ( ) const

operator double

? ^  < > 
Convert variable to double.
Source:
../fmutl/SPMVar.h:266
Returns:
double value, if applicable, or 0.0.
Code:
public operator double ( ) const

operator int

? ^  < > 
Convert variable to int.
Source:
../fmutl/SPMVar.h:294
Returns:
integer value, if applicable, or 0.
Code:
public FMUTL_API operator int ( ) const

method parsed_options

? ^  < > 
Get additional options.

Redefined by derived classes to return additional options. Called at the end of description function, just before options output. This is a counterpart of parse_options function.

Source:
../fmutl/SPMVar.h:549
Param:
unused_items number of optional parameters, which were not added at the end of string. If more output follows, they should be replaced by commas. On entering the function, this parameter is always 0.
Returns:
additional options.
Code:
protected FMUTL_API virtual smart_string parsed_options ( unsigned & unused_items ) const

method parse_options

? ^  < > 
Parse variable options.

Redefined in derived classes to parse additional variable options. Does nothing in this implementation. Called at the end of Init function.

Source:
../fmutl/SPMVar.h:157
Code:
protected FMUTL_API virtual void parse_options ( )

method set_array

? ^  < > 
Set array value.

Value assigned only if variable type is spmvtArray.

Source:
../fmutl/SPMVar.h:468
Params:
_val value to assign.
_len number of blocks. If _offs+_len>len, array will be extended.
_offs offset from the beginning of the array (in blocks).
Returns:
assigned value or 0.
Code:
public FMUTL_API const void * set_array ( const void * _val ,
unsigned _len = 0 ,
unsigned _offs = 0 )

method set_array_blocksz

? ^  < > 
Set array block size.

Block size assigned only if variable type is spmvtArray.

Source:
../fmutl/SPMVar.h:484
Param:
_blocksz block size. Underlying memory block will be resized to match new length.
Code:
public FMUTL_API void set_array_blocksz ( unsigned _blocksz )

method set_array_len

? ^  < > 
Set array length.

Length assigned only if variable type is spmvtArray.

Source:
../fmutl/SPMVar.h:476
Param:
_len number of blocks. Underlying memory block will be resized to match new length.
Code:
public FMUTL_API void set_array_len ( unsigned _len )

method set_enum

? ^  < > 
Set enum by filter value.

Value assigned only if variable type is spmvtEnum. String comparison preformed is case insensitive.

Source:
../fmutl/SPMVar.h:441
Param:
_val value to assign.
Returns:
assigned value or 0.
Code:
public FMUTL_API const char * set_enum ( const char * _val )

method set_enum

? ^  < > 
Set enum by ordinal value.

Value assigned only if variable type is spmvtEnum.

Source:
../fmutl/SPMVar.h:433
Param:
_val value to assign.
Returns:
assigned value or 0.
Code:
public unsigned set_enum ( unsigned _val )

method set_enum_val

? ^  < > 
Set enum by integer value.

Scans through the values aaray and sents enum ordinal matching to the specified value. Value assigned only if variable type is spmvtEnum.

Source:
../fmutl/SPMVar.h:450
Param:
_val value to assign.
Returns:
assigned value or 0.
Code:
public FMUTL_API unsigned set_enum_val ( int _val )

method set_name

? ^  < > 
Set name.

Change variable's human-readable name.

Source:
../fmutl/SPMVar.h:198
Code:
public FMUTL_API void set_name ( const char * _name )

method set_options

? ^  < > 
Set options.

Sets variable additional options.

Source:
../fmutl/SPMVar.h:249
Param:
opt options zero-terminated string.
Code:
public FMUTL_API void set_options ( const char * opt )

method set_string

? ^  < > 
Set string value explicitely.

Value assigned only if variable type is spmvtString.

Source:
../fmutl/SPMVar.h:458
Param:
_val value to assign.
Returns:
assigned value or 0.
Code:
public FMUTL_API const char * set_string ( const char * _val )

method set_timestamp

? ^  < > 
Set timestamp.
Source:
../fmutl/SPMVar.h:211
Param:
t new timstamp value
Returns:
old timestamp value
Code:
public timestamp_t set_timestamp ( timestamp_t t )

typedef timestamp_t

? ^  < > 
timestamp type
Source:
../fmutl/SPMVar.h:58
Code:
public typedef unsigned __int64 timestamp_t

method update_timestamp

? ^  < > 
Set timestamp value to the current system time.
Source:
../fmutl/SPMVar.h:223
Returns:
new timestamp value.
Code:
public FMUTL_API timestamp_t update_timestamp ( )

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