Programming Reference:Parameters: Difference between revisions

From BCI2000 Wiki
Jump to navigation Jump to search
Line 3: Line 3:
==Param Class==
==Param Class==
===Methods===
===Methods===
====Param( string name, string section, string type, string value, string defaultvalue, string lowrange, string highrange, string comment )====
Constructs a <tt>Param</tt> object with the properties given as parameters.
====Param( string paramDefinition )====
Constructs a <tt>Param</tt> object from a [[Technical Reference:Parameter Definition|BCI2000 Parameter Definition]] string.
====Param operator=( Param )=====
Assigns from the given <tt>Param</tt> object.
====Param AssignValues( Param )====
Assigns the matrix of parameter values from the given <tt>Param</tt> object.
====Param Unchanged()====
Resets the '''Changed''' property to false.
====Param SetDimensions( int rows, int cols )====
Sets the number of rows and columns in the matrix of parameter values.
====ostream WriteToStream( ostream ), istream ReadFromStream( istream )====
Writes/reads the <tt>Param</tt> object to/from a stream in human readable format.
====ostream WriteBinary( ostream ), istream ReadBinary( istream )====
Writes/reads the <tt>Param</tt> object to/from a BCI2000 binary stream (such as the streams connecting BCI2000 modules).
===Properties===
===Properties===



Revision as of 14:37, 29 June 2010

Individual parameters are represented by instances of the Param class. A collection of Param objects, such as the set of parameters present in a BCI2000 data file, is represented by a ParamList object.

Param Class

Methods

Param( string name, string section, string type, string value, string defaultvalue, string lowrange, string highrange, string comment )

Constructs a Param object with the properties given as parameters.

Param( string paramDefinition )

Constructs a Param object from a BCI2000 Parameter Definition string.

Param operator=( Param )=

Assigns from the given Param object.

Param AssignValues( Param )

Assigns the matrix of parameter values from the given Param object.

Param Unchanged()

Resets the Changed property to false.

Param SetDimensions( int rows, int cols )

Sets the number of rows and columns in the matrix of parameter values.

ostream WriteToStream( ostream ), istream ReadFromStream( istream )

Writes/reads the Param object to/from a stream in human readable format.

ostream WriteBinary( ostream ), istream ReadBinary( istream )

Writes/reads the Param object to/from a BCI2000 binary stream (such as the streams connecting BCI2000 modules).

Properties

ParamList Class

Methods

Param operator[]( string name )

Access to an individual Param object by its name.

Param operator[]( int index )

Access to an individual Param object by its index.

Clear()

Removes all Param objects from the list.

bool Exists( string name )

Returns true if a Param object with the given name exists in the list.

int Index( string name )

Returns the index of the Param object with the given name, or the list's size if there is no such Param object.

Add( Param, number sortingHint = 0.0 )

Adds the given Param object to the list. When specified, the sorting hint is used to determine the relative order of Param objects in the list; a smaller value of the sorting hint corresponds to a position closer to the beginning of the list.

Add( string paramDefinition )

Creates a Param object from the specified Parameter Definition, and adds it to the list.

Delete( string name )

Deletes the Param object with the specified name from the list.

bool Save( string filename )

Saves the list as a BCI2000 Parameter File with the specified file name.

bool Load( string filename, bool importNonexisting = true )

Loads parameters from a BCI2000 Parameter File specified in the first argument. For parameters already present in the list, their values are updated from the file. If the importNonexisting flag is set, parameters not present in the list will be added from the file; otherwise, such parameters will be ignored.

Sort()

Sorts the list according to their associated sorting hints. Smaller sorting hints will be located closer to the top of the list.

ostream WriteToStream( ostream ), istream ReadFromStream( istream )

Writes/reads the entire parameter list to/from a stream in human readable format.

ostream WriteBinary( ostream ), istream ReadBinary( istream )

Writes/reads the entire parameter list to/from a BCI2000 binary stream (such as used for communication between modules).

Properties

int Size (r)

The number of Param objects in the list.

bool Empty (r)

True if the list is empty, false otherwise.

See also

Technical Reference:Parameter Definition