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.

_images/controller-diagram.png

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:
  • idstring identifier of the button/config

  • windowLengthint length of the window

  • configPathchar array representing the full path of the config file

  • saveWindowsint 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:

idstring 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:

idstring 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:

framemaxlab::FilteredFrameData frame to add to each window

int numChannels(string id)

Gets the number of channels tracked by a button.

Parameters:

idstring id of the button

Returns:

int

int numSpikes(string id)

Gets the number of spikes in the window of a button.

Parameters:

idstring id of the button

Returns:

int