cgnuino
Public Member Functions | List of all members
CgnPeriod Class Reference

Remembers current task period and its time constraint. More...

#include <cgnuino.h>

Public Member Functions

 CgnPeriod ()
 Constructor.
 
void set (String, uint32_t=0)
 Sets current task period and its time limitation. More...
 
bool is (String)
 Checks whether the current task period is s. More...
 
bool expire ()
 Checks whether the current task period expired its time limitation.
 
String get ()
 Shows current task period.
 
uint32_t until ()
 Shows the time limitation of the current task period.
 

Detailed Description

A trial in a behavioral task is composed of multiple task periods (also called as epochs), which are temporal intervals within which a set of task events or desired participant's actions are taken place. For example, an LED flash is provided in the cue period, and the participant should press a button as soon as possible in the subsequent response period. Some task periods have time limitation, while others can last forever until predetermined conditions are fulfilled.

To manage the transition of numbers of task periods, CgnPeriod class offers a handy cutoff to you. It simply remembers the current task period designated by set method. By using CgnPeriod class, conditional branching in your main code will become more readable. If you designate time length of the period on calling set method, CgnPeriod class also maintain that information so that you can monitor the expiration of the predetermined time limit using expire method.

Examples:
Period.ino.

Member Function Documentation

bool CgnPeriod::is ( String  periodName)
Parameters
periodNameName of the candidate task period.
Examples:
Period.ino.
void CgnPeriod::set ( String  newPeriod,
uint32_t  lengthMs = 0 
)
Parameters
newPeriodName of the new task period.
lengthMsMaximum length of current task period in [ms].
Examples:
Period.ino.

The documentation for this class was generated from the following files: