PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PEventQueue.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/devices/PEven.h
4// Purpose: Events processed by Event Loop.
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2004-2026 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#ifndef __PEVENTQUEUE_H__
28#define __PEVENTQUEUE_H__
29
30#include "PEvent.h"
31#include <queue>
32#include <iostream>
33
34using std::queue;
35using std::cerr;
36
37//entirely on the platform-specific event-handling routines.
38class PEventQueue: virtual public PDevice
39{
40 public:
42 virtual ~PEventQueue();
43
44 //This gets the type of the first event,
46
47 //This 'pops' the event at the front of the queue off, destroying it.
48 virtual void PopEvent();
49 virtual void PushEvent(PEvent & evt);
50 //This 'peeks' at the event at the front of the queue
51 virtual PEvent GetFirstEvent();
52
53 //This 'primes' the event-queue pump, getting any
54 //waiting events from the system, tagging them with a timestamp,
55 // and putting them into the PEBL queue
56 virtual void Prime(){std::cout << "Standard prime\n";};
57 virtual bool IsEmpty(){return mEventQueue.empty();};
58
59 virtual int GetState(int intface) const;
60
62 virtual void Clear();
63
64 private:
65
66 protected:
67
68 queue<PEvent> mEventQueue;
69};
70
71
72
73
74
75#endif
PEBL_DEVICE_TYPE
Definition PDevice.h:40
@ PDT_EVENT_QUEUE
Definition PDevice.h:50
queue< PEvent > mEventQueue
Definition PEventQueue.h:68
virtual ~PEventQueue()
virtual PEBL_DEVICE_TYPE GetDeviceType()
Definition PEventQueue.h:61
virtual void Clear()
virtual PEBL_DEVICE_TYPE GetFirstEventType()
virtual void PopEvent()
virtual PEvent GetFirstEvent()
virtual void PushEvent(PEvent &evt)
virtual int GetState(int intface) const
virtual void Prime()
Definition PEventQueue.h:56
virtual bool IsEmpty()
Definition PEventQueue.h:57