|
PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
|
#include <PEventLoop-es.h>
Public Member Functions | |
| PEventLoop () | |
| This is the standard PEventLoop constructor. | |
| ~PEventLoop () | |
| This is the standard pNode destructor. | |
| void | RegisterState (DeviceState *state, const std::string &function, Variant parameters) |
| void | RegisterEvent (DeviceState *state, const std::string &function, Variant parameters) |
| void | RemoveState (DeviceState state) |
| void | RegisterEventTest (DeviceState *state, const std::string function, PList *parameters) |
| void | RemoveEventTest (DeviceState state) |
| void | Clear () |
| PEvent | Loop () |
| Initiates the looping tests. | |
| PEvent | Loop1 () |
| Initiates the looping tests. | |
| bool | IsLooping () |
| PEventLoop () | |
| ~PEventLoop () | |
| void | RegisterState (DeviceState *state, const std::string &function, Variant parameters) |
| void | RegisterEvent (DeviceState *state, const std::string &function, Variant parameters) |
| void | RemoveState (DeviceState state) |
| void | RegisterEventTest (DeviceState *state, const std::string function, PList *parameters) |
| void | RemoveEventTest (DeviceState state) |
| void | Clear () |
| PEvent | Loop () |
| Initiates the looping tests. | |
| void | Print (std::ostream &out) const |
Public Attributes | |
| std::string | mTmp |
Protected Attributes | |
| std::vector< DeviceState * > | mStates |
| std::vector< PNode * > | mNodes |
| std::vector< Variant > | mFunctionNames |
| int | mNumStates |
| std::vector< Variant > | mParameters |
| std::vector< bool > | mIsEvent |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const PEventLoop &loop) |
| std::ostream & | operator<< (std::ostream &out, const PEventLoop &loop) |
A EventLoop repetitively scans a number of devices for certain pre-specified states, and executes a PEBL function whenever one is true.
Definition at line 46 of file PEventLoop-es.h.
| PEventLoop::PEventLoop | ( | ) |
This is the standard PEventLoop constructor.
Definition at line 68 of file PEventLoop-es.cpp.
References mNumStates, mTmp, PEBLUtility::RandomUniform(), and PEBLUtility::Round().
| PEventLoop::~PEventLoop | ( | ) |
This is the standard pNode destructor.
Definition at line 84 of file PEventLoop-es.cpp.
| PEventLoop::PEventLoop | ( | ) |
| PEventLoop::~PEventLoop | ( | ) |
| void PEventLoop::Clear | ( | ) |
Definition at line 176 of file PEventLoop-es.cpp.
References mFunctionNames, mIsEvent, mNodes, mNumStates, mParameters, and mStates.
Referenced by PEBLEnvironment::ClearEventLoop(), PEBLEnvironment::GetInput0(), Loop(), PEBLEnvironment::PlayMovie(), PEBLEnvironment::Wait(), PEBLEnvironment::WaitForAllKeysUp(), PEBLEnvironment::WaitForAnyKeyDown(), PEBLEnvironment::WaitForAnyKeyDownWithTimeout(), PEBLEnvironment::WaitForAnyKeyPress(), PEBLEnvironment::WaitForAnyKeyPressWithTimeout(), PEBLEnvironment::WaitForKeyDown(), PEBLEnvironment::WaitForKeyListDown(), PEBLEnvironment::WaitForKeyPress(), PEBLEnvironment::WaitForKeyRelease(), PEBLEnvironment::WaitForKeyUp(), PEBLEnvironment::WaitForListKeyPress(), PEBLEnvironment::WaitForListKeyPressWithTimeout(), PEBLEnvironment::WaitForMouseButton(), and PEBLEnvironment::WaitForMouseButtonWithTimeout().
| void PEventLoop::Clear | ( | ) |
|
inline |
Definition at line 88 of file PEventLoop-es.h.
| PEvent PEventLoop::Loop | ( | ) |
Initiates the looping tests.
The following method will initiate an event loop. It will repetitively cycle through each of the devices-events registered and determine if any are satisfied. Whenever one is satisfied, it will follow the directive of that event. It will continue until a STOPEVENTLOOP event is processed.
(myEval->gGlobalVariableMap.RetrieveValue("gKeepLooping"));
Definition at line 207 of file PEventLoop-es.cpp.
References VariableMap::AddVariable(), Clear(), Evaluator::Evaluate1(), Evaluator::gGlobalVariableMap, Loop1(), mNumStates, myEval, PEBLEnvironment::myTimer, PDT_UNKNOWN, pInt, VariableMap::RetrieveValue(), and PlatformTimer::Sleep().
Referenced by PEBLEnvironment::GetInput0(), PEBLEnvironment::PlayMovie(), PEBLEnvironment::StartEventLoop(), PEBLEnvironment::Wait(), PEBLEnvironment::WaitForAllKeysUp(), PEBLEnvironment::WaitForAnyKeyDown(), PEBLEnvironment::WaitForAnyKeyDownWithTimeout(), PEBLEnvironment::WaitForAnyKeyPress(), PEBLEnvironment::WaitForAnyKeyPressWithTimeout(), PEBLEnvironment::WaitForKeyDown(), PEBLEnvironment::WaitForKeyListDown(), PEBLEnvironment::WaitForKeyPress(), PEBLEnvironment::WaitForKeyRelease(), PEBLEnvironment::WaitForKeyUp(), PEBLEnvironment::WaitForListKeyPress(), PEBLEnvironment::WaitForListKeyPressWithTimeout(), PEBLEnvironment::WaitForMouseButton(), and PEBLEnvironment::WaitForMouseButtonWithTimeout().
| PEvent PEventLoop::Loop | ( | ) |
Initiates the looping tests.
| PEvent PEventLoop::Loop1 | ( | ) |
Initiates the looping tests.
Definition at line 282 of file PEventLoop-es.cpp.
References VariableMap::AddVariable(), Variant::GetComplexData(), PEventQueue::GetFirstEvent(), PEventQueue::GetFirstEventType(), PComplexData::GetList(), PEvent::GetType(), gEventQueue, Evaluator::gGlobalVariableMap, PEventQueue::IsEmpty(), mFunctionNames, mIsEvent, mNumStates, mParameters, mStates, myEval, Evaluator::NodeStackPush(), NULL, PDT_DUMMY, PDT_KEYBOARD, PDT_TIMER, PDT_UNKNOWN, PEventQueue::PopEvent(), PlatformEventQueue::Prime(), PList::PushBack(), PEvent::SetDummyEvent(), and PEBL_DummyEvent::value.
Referenced by Loop().
| void PEventLoop::Print | ( | std::ostream & | out | ) | const |
Definition at line 490 of file PEventLoop.cpp.
References mStates.
Referenced by operator<<().
| void PEventLoop::RegisterEvent | ( | DeviceState * | state, |
| const std::string & | function, | ||
| Variant | parameters | ||
| ) |
This function will 'register' a specific event that will be tested for in an event-loop. This allows multiple tests to be registered (time limit, key press, etc.) and tested within a fairly tight compiled loop, without the user having to write his/her own interpreted event loop. This method takes over ownership of the DeviceState, and is responsible for cleaning it up when finished.
Definition at line 141 of file PEventLoop-es.cpp.
References mFunctionNames, mIsEvent, mNodes, mNumStates, mParameters, mStates, NULL, and P_DATA_FUNCTION.
Referenced by PEBLEnvironment::GetInput0(), PEBLEnvironment::PlayMovie(), PEBLEnvironment::RegisterEvent(), PEBLEnvironment::WaitForAnyKeyPress(), PEBLEnvironment::WaitForAnyKeyPressWithTimeout(), PEBLEnvironment::WaitForKeyPress(), PEBLEnvironment::WaitForKeyRelease(), PEBLEnvironment::WaitForListKeyPress(), PEBLEnvironment::WaitForListKeyPressWithTimeout(), PEBLEnvironment::WaitForMouseButton(), and PEBLEnvironment::WaitForMouseButtonWithTimeout().
| void PEventLoop::RegisterEvent | ( | DeviceState * | state, |
| const std::string & | function, | ||
| Variant | parameters | ||
| ) |
| void PEventLoop::RegisterEventTest | ( | DeviceState * | state, |
| const std::string | function, | ||
| PList * | parameters | ||
| ) |
| void PEventLoop::RegisterEventTest | ( | DeviceState * | state, |
| const std::string | function, | ||
| PList * | parameters | ||
| ) |
| void PEventLoop::RegisterState | ( | DeviceState * | state, |
| const std::string & | function, | ||
| Variant | parameters | ||
| ) |
This function will 'register' a specific event that will be tested for in an event-loop. This allows multiple tests to be registered (time limit, key press, etc.) and tested within a fairly tight compiled loop, without the user having to write his/her own interpreted event loop.
Definition at line 97 of file PEventLoop-es.cpp.
References mFunctionNames, mIsEvent, mNodes, mNumStates, mParameters, mStates, NULL, and P_DATA_FUNCTION.
Referenced by PEBLEnvironment::PlayMovie(), PEBLEnvironment::RegisterEvent(), PEBLEnvironment::Wait(), PEBLEnvironment::WaitForAllKeysUp(), PEBLEnvironment::WaitForAnyKeyDown(), PEBLEnvironment::WaitForAnyKeyDownWithTimeout(), PEBLEnvironment::WaitForAnyKeyPressWithTimeout(), PEBLEnvironment::WaitForKeyDown(), PEBLEnvironment::WaitForKeyListDown(), PEBLEnvironment::WaitForKeyUp(), PEBLEnvironment::WaitForListKeyPressWithTimeout(), and PEBLEnvironment::WaitForMouseButtonWithTimeout().
| void PEventLoop::RegisterState | ( | DeviceState * | state, |
| const std::string & | function, | ||
| Variant | parameters | ||
| ) |
| void PEventLoop::RemoveEventTest | ( | DeviceState | state | ) |
| void PEventLoop::RemoveEventTest | ( | DeviceState | state | ) |
| void PEventLoop::RemoveState | ( | DeviceState | state | ) |
| void PEventLoop::RemoveState | ( | DeviceState | state | ) |
|
friend |
Definition at line 516 of file PEventLoop-es.cpp.
|
friend |
Definition at line 516 of file PEventLoop-es.cpp.
|
protected |
Definition at line 97 of file PEventLoop-es.h.
Referenced by Clear(), Loop1(), RegisterEvent(), and RegisterState().
|
protected |
Definition at line 106 of file PEventLoop-es.h.
Referenced by Clear(), Loop1(), RegisterEvent(), and RegisterState().
|
protected |
Definition at line 96 of file PEventLoop-es.h.
Referenced by Clear(), RegisterEvent(), and RegisterState().
|
protected |
Definition at line 98 of file PEventLoop-es.h.
Referenced by Clear(), Loop(), Loop1(), PEventLoop(), RegisterEvent(), and RegisterState().
|
protected |
Definition at line 100 of file PEventLoop-es.h.
Referenced by Clear(), Loop1(), RegisterEvent(), and RegisterState().
|
protected |
Definition at line 95 of file PEventLoop-es.h.
Referenced by Clear(), Loop1(), Print(), RegisterEvent(), and RegisterState().
| std::string PEventLoop::mTmp |
Definition at line 87 of file PEventLoop-es.h.
Referenced by PEventLoop().