Programming Reference:Target Class

From BCI2000 Wiki
Jump to: navigation, search

Target Class




The Target class is a virtual base class which defines an event handling interface for targets. There, a "Target" is defined as "an object that performs an action when selected."

A Target descendant class will typically override its empty OnSelect() event handlers with a function that performs an action. An application uses the public Target::Select() function to control its behavior; this function, in turn, calls the virtual event handler.

The SetOfTargets class allows to define sets of targets, and to select all of the targets it contains.


int Tag (rw)

An arbitrary integer that may be used to encode information about a given target (e.g., its corresponding row in a configuration matrix).



Prompts a target to perform its selection action by calling its OnSelect() event handler.



In its OnSelect event handler, a target performs an action, e.g. entering a letter into a speller.


The Target class is parent to the SpellerTarget and AudioSpellerTarget classes.

SetOfTargets Class


SetOfTargets is declared in the Target class header file.


SetOfTargets is a helper class that provides selection and destruction of a group of stimuli.


Add(Target pointer)

Adds a target object to the set.

Remove(Target pointer)

Removes a given target object from the set; nothing happens when the specified target is not a member of the set.


Clears the set. Targets that were represented in the set in form of pointers are unaffected.


Deletes all target objects that are in the set, and clears the set. To avoid dangling pointers, and multiple deletion, you should make sure that the set's members are not part of any other SetOfTargets by the time you call SetOfTargets::DeleteObjects().

bool Contains(Target pointer)

Returns true if the specified target object is part of the set, and false otherwise.

bool Intersects(SetOfTargets)

Returns true if any of the elements of the specified set is part of the set on which Intersects is called, and false otherwise.


Calls each element's Select() method.

See also

Programming Reference:AssociationMap Class, Programming Reference:Stimulus Class, Programming Reference:StimulusTask Class

Programming Reference:Speller Class, Programming Reference:AudioSpellerTarget Class