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 __int64 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:86
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_typemethod public Get array type.
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.
convert_arraymethod public Convert array data to the new array type.
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_array_type_idsstatic method public Get static array of stream type ids.
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 Double assignment operator.
operator =operator public Integer assignment operator.
operator =operator public Boolean assignment operator.
operator =operator public String assignment operator.
operator =operator public Copy 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_array_typemethod public Set array type.
set_enummethod public Set enum by filter value.
set_enummethod public Set enum by ordinal value.
set_enum_namemethod public Set enum name.
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:120
Code:
public FMUTL_API virtual ~ SPMVar ( )

constructor SPMVar

? ^  < > 
Standart constructor.

New variable will have spmvtNone type.

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

constructor SPMVar

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

method array_blocksz

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

method array_len

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

method array_type

? ^  < > 
Get array type.
Source:
../fmutl/SPMVar.h:407
Returns:
array type, if variable type is spmvtArray, or 0.
Code:
public SPMVarArrayType array_type ( ) const

method array_val

? ^  < > 
Get array pointer.
Source:
../fmutl/SPMVar.h:389
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:596
Returns:
string representation of variable, converted to lowercase (to use as selector string). For integers returns (size_t)(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:585
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:207
Code:
protected FMUTL_API virtual void clear_parsed_options ( )

method convert_array

? ^  < > 
Convert array data to the new array type.

Conversion is made only only if variable type is spmvtArray.

Source:
../fmutl/SPMVar.h:551
Params:
new_type new array type.
offset if conversion requires rescaling (as from double to int types), contains the extracted offset of the data.
scale if conversion requires rescaling (as from double to int types), contains the extracted scale of the data. Equation that can be used to convert new data to the old one is old_val=new_val*scale+offset.
Code:
public FMUTL_API void convert_array ( SPMVarArrayType new_type ,
double * offset ,
double * scale )

method dbl_lsb

? ^  < > 
Get double least significant value.
Source:
../fmutl/SPMVar.h:318
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:312
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:306
Returns:
minimum double value, if applicable, or 0.0.
Code:
public double dbl_min ( ) const

method description

? ^  < > 
Get string description.
Source:
../fmutl/SPMVar.h:604
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:198
Code:
public FMUTL_API void Destroy ( )

method enum_filter

? ^  < > 
Get enum filter value.
Source:
../fmutl/SPMVar.h:371
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:383
Returns:
number of enum values, if it has spmvtEnum type, or 0.
Code:
public size_t enum_len ( ) const

method enum_name

? ^  < > 
Get enum string name.
Source:
../fmutl/SPMVar.h:377
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:364
Returns:
enum ordinal value (index in the list, not an assigned number), if it has spmvtEnum type, or 0.
Code:
public size_t enum_val ( ) const

method equal

? ^  < > 
Equality function.
Source:
../fmutl/SPMVar.h:578
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:632
Returns:
true if value was set successfully.
See Also:
as_string
Code:
public FMUTL_API bool from_string ( const char * str )

static method get_array_type_ids

? ^  < > 
Get static array of stream type ids.
Source:
../fmutl/SPMVar.h:611
Returns:
pointer to the first element in array. Total number of elements is spmvatMaxVarArrayTypes+1 (last element is 0)
Code:
public static FMUTL_API const char * * get_array_type_ids ( )

method get_id

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

method get_name

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

method get_options

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

method get_timestamp

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

method get_var_type

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

method good

? ^  < > 
Check variable for validity.
Source:
../fmutl/SPMVar.h:214
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:251
Returns:
new timestamp value.
Code:
public timestamp_t increment_timestamp ( )

method Init

? ^  < > 
Initialize variable from string description.
Source:
../fmutl/SPMVar.h:183
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:141
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:340
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:334
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:270
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:570
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 =

? ^  < > 
Double assignment operator.

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

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

operator =

? ^  < > 
Integer assignment operator.

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

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

operator =

? ^  < > 
Boolean assignment operator.

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

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

operator =

? ^  < > 
String assignment operator.

Value assigned by calling from_string .

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

operator =

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

operator ==

? ^  < > 
Equality operator.
Source:
../fmutl/SPMVar.h:561
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:350
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:357
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:300
Returns:
double value, if applicable, or 0.0.
Code:
public operator double ( ) const

operator int

? ^  < > 
Convert variable to int.
Source:
../fmutl/SPMVar.h:328
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:624
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 ( size_t & 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:191
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:515
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 ,
size_t _len = 0 ,
size_t _offs = 0 )

method set_array_blocksz

? ^  < > 
Set array block size.

Block size assigned only if variable type is spmvtArray.

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

method set_array_len

? ^  < > 
Set array length.

Length assigned only if variable type is spmvtArray.

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

method set_array_type

? ^  < > 
Set array type.

Type assigned only if variable type is spmvtArray.

Source:
../fmutl/SPMVar.h:539
Param:
_blocksz block size. Underlying memory block will be resized to match new length.
Code:
public FMUTL_API void set_array_type ( SPMVarArrayType _type )

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:481
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:473
Param:
_val value to assign.
Returns:
assigned value or 0.
Code:
public size_t set_enum ( size_t _val )

method set_enum_name

? ^  < > 
Set enum name.
Source:
../fmutl/SPMVar.h:496
Param:
name value to assign.
Code:
public FMUTL_API void set_enum_name ( const char * name )

method set_enum_val

? ^  < > 
Set enum by integer value.

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

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

method set_name

? ^  < > 
Set name.

Change variable's human-readable name.

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

method set_options

? ^  < > 
Set options.

Sets variable additional options.

Source:
../fmutl/SPMVar.h:283
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:505
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:245
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:92
Code:
public typedef unsigned __int64 timestamp_t

method update_timestamp

? ^  < > 
Set timestamp value to the current system time.
Source:
../fmutl/SPMVar.h:257
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