Controller
Overview
The Controller
class stores ChannelWindow
objects as “buttons”, allowing
for the user to automatically organize, initialize, update, and access many windows at once.
Instead of adding a frame to each window, the Controller
will add it to all
windows.
For button-like detection from the window activity, see the subclass NES
.
Members
-
class Controller
Subclassed by NES
Public Functions
-
Controller()
Construct a new Controller object.
-
~Controller()
Destroy the Controller object.
-
void addButton(string id, int windowLength, const char *configPath, int saveWindows = 0)
Adds a new button (ChannelWindow) to the Controller.
- Parameters:
id –
string
identifier of the button/configwindowLength –
int
length of the windowconfigPath –
char
array representing the full path of the config filesaveWindows –
int
indicating how many windows to save, default 0
-
void init()
Initializes all buttons, regardless of window length.
-
ChannelWindow *getButtonWindow(string id)
Get the ChannelWindow of the specified button.
- Parameters:
id –
string
id of the button- Throws:
std::out_of_range – if there is not a button with the ke)y
id
- Returns:
pointer to a
ChannelWindow
-
bool buttonExists(string id)
checks if a button exists in the controller
- Parameters:
id –
string
id of the button- Returns:
true
- Returns:
false
-
void shift(maxlab::FilteredFrameData frame)
Shifts all button windows—the first frame of each window will be removed, and a new one will be appended to the end.
For any window that has not been fully initialized, the first frame will not be removed.
- Parameters:
frame –
maxlab::FilteredFrameData
frame to add to each window
-
int numChannels(string id)
Gets the number of channels tracked by a button.
- Parameters:
id –
string
id of the button- Returns:
int
-
int numSpikes(string id)
Gets the number of spikes in the window of a button.
- Parameters:
id –
string
id of the button- Returns:
int
-
Controller()