package require VMUSBDriverSupport
::VMUSBDriverSupport::convertVmUSB name
::VMUSBDriverSupport::convertVmUSBReadoutList name
::VMUSBDriverSupport::validInt value ?low ?high??
::VMUSBDriverSupport::validReal value ?low ?high??
::VMUSBDriverSupport::valideEnum value set
::VMUSBDriverSupport::validBool value
::VMUSBDriverSupport::validList value ?fewest ?most ?checker ?args????
::VMUSBDriverSupport::validIntList value ?fewest ?most ?low ?high????
::VMUSBDriverSupport::validBoolList value ?fewest ?most???
This package provides utiltities that are of use/interest to Tcl device driver modules for the VM-USB readout framework. The attempt is to centralize/factor common code out of driver modules that is commonly used.
Converts a swig CVMUSB object identifier into a usable
CVMUSB object. Once converted the driver can invoke
methods on that object. name
is the object passed in to the driver. The return
value will be the name of the new object.
Converts a CVMUSBReadoutList swig object identifier into
an object. Once converted, the object methods can
be directl invoked.
name
is the name passed in to the
method by the framework. the return value is the
name of the object.
Provides type checking and optional range checking for integer data. This is most often called to validate an integer driver option.
Throws an error if value
is not
a valid integer. Additionally, if low
is not empty, an error is thrown if
$value < $low. Similarly if
high
is not empty an error
is thrown if $value > $high.
Provides type and optional range checking for real parameters.
If value
is not valid real number
this proc throws an error. Furthermore if low
is not blank, an error is thrown if $value < $low.
Similarly if high
is not blank,
an error is thrown if $value > $high.
Throw an error if value
is not
one of the strings in the Tcl list set
Throws an error if value
is not
recognizable as a boolean by Tcl.
http://www.tcl.tk/man/tcl8.5/TclLib/GetInt.htm
describes the set of value
s that are
recognized as valid booleans.
Throws an error if value
is not
a valid Tcl list. Futhermore if fewest
is not blank, an error is thrown if
[llength $value] < $fewest.
Similarly, if most
is not blank,
an error is thrown if
[llength $value] > $most.
checker
is a script which if
not blank is called for each element of
value
. checker
is
called as follows: $checker $element {*}$args
where element
is an element of the
list. The intent of this is to provide support for
type/range checking each element of the list.
One sample use of this proc is:
::::VMUSBDriverSupport::validList $value 32 32 ::::VMUSBDriverSupport::validInt 0 4095
which ensures that value
is a valid
list that contains exactly 32 integer elements in the range
[0..4095].
This is a convenience procedure that uses validList
and validInt
to determine if
value
is a valid list of
integer values with optional range constraints.
This is a convenience procedure that uses validList
and validBool
to determine if
value
is a valid list of
boolean values.