PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
RegionState Class Reference

#include <DeviceState.h>

Inheritance diagram for RegionState:
DeviceState

Public Member Functions

 RegionState (int lowx, int highx, int lowy, int highy, DeviceTest test, int interfaced, PDevice *device, PEBL_DEVICE_TYPE pdt)
 
 ~RegionState ()
 
virtual int TestDevice () const
 
- Public Member Functions inherited from DeviceState
 DeviceState (DeviceTest test, int interfaced, PDevice *device, PEBL_DEVICE_TYPE pdt)
 
virtual ~DeviceState ()
 
virtual int GetInterface () const
 
virtual int GetState (int iface) const
 
PDeviceGetDevice ()
 
PDeviceGetEventQueue ()
 
virtual PEBL_DEVICE_TYPE GetDeviceType ()
 

Protected Member Functions

virtual std::ostream & SendToStream (std::ostream &out) const
 

Additional Inherited Members

- Protected Attributes inherited from DeviceState
int mInterface
 This is different from the value or values that an interface can take on.
 
DeviceTest mDeviceTest
 
PDevicemDevice
 
PEBL_DEVICE_TYPE mPDT
 

Detailed Description

Definition at line 145 of file DeviceState.h.

Constructor & Destructor Documentation

◆ RegionState()

RegionState::RegionState ( int  lowx,
int  highx,
int  lowy,
int  highy,
DeviceTest  test,
int  interfaced,
PDevice device,
PEBL_DEVICE_TYPE  pdt 
)

Definition at line 220 of file DeviceState.cpp.

220 :
221 DeviceState(test, intface, device, pdt),
222 mLowX(lowX),
223 mHighX(highX),
224 mLowY(lowY),
225 mHighY(highY)
226{
227}

◆ ~RegionState()

RegionState::~RegionState ( )

Definition at line 229 of file DeviceState.cpp.

230{
231}

Member Function Documentation

◆ SendToStream()

ostream & RegionState::SendToStream ( std::ostream &  out) const
protectedvirtual

Reimplemented from DeviceState.

Definition at line 285 of file DeviceState.cpp.

286{
287 out << "<RegionState: x:"<< mLowX << " to " << mHighX <<" y: " << mLowY << " to " << mHighY << ">" << std::flush;
288 return out;
289}

◆ TestDevice()

int RegionState::TestDevice ( ) const
virtual

Reimplemented from DeviceState.

Definition at line 235 of file DeviceState.cpp.

236{
237
238 int valueX = mDevice->GetState(mInterface);
239 int valueY = mDevice->GetState(mInterface+1);
240
241 switch(mDeviceTest)
242 {
243
244 case DT_NOT_EQUAL:
245 case DT_OUTSIDE:
246 return valueX > mHighX || valueX < mLowX || valueY > mHighY || valueY < mLowY;
247
248 case DT_EQUAL:
249 case DT_NOT_OUTSIDE:
250 return valueX <= mHighX && valueX >= mLowX && valueY <= mHighY && valueY >= mLowY;
251
252
253 case DT_NOT_INSIDE:
254 return valueX >= mHighX || valueX <= mLowX || valueY >= mHighY || valueY <= mLowY;
255
256 case DT_INSIDE:
257 return valueX < mHighX && valueX > mLowX && valueY < mHighY && valueY > mLowY;
258
259 case DT_ON_EDGE:
260 return ((valueX == mLowX || valueX == mHighX) && valueY >= mLowY && valueY <= mHighY) ||
261 ((valueY == mLowY || valueY == mHighY) && valueX >= mLowX && valueX <= mHighX);
262
263 case DT_LESS_THAN: //Interpretation: less than both lower bounds
264 return valueX < mLowX && valueY < mLowY;
265
266 case DT_LESS_THAN_OR_EQUAL: //Interpretation: less than or equal to both upper bounds
267 return valueX <= mHighX && valueY <= mHighY;
268
269 case DT_GREATER_THAN: //Interpretation: greater than the upper bounds
270 return valueX > mHighX && valueY > mHighY;
271
272 case DT_GREATER_THAN_OR_EQUAL: //Interpretation: greater than or equal to the lower bounds
273 return valueX >= mLowX && valueY >= mLowY;
274
275 case DT_TRUE:
276 return 1;
277 case DT_FALSE:
278 default:
279 return 0;
280 }
281
282}
@ DT_NOT_OUTSIDE
Definition DeviceState.h:49
@ DT_INSIDE
Definition DeviceState.h:48
@ DT_NOT_EQUAL
Definition DeviceState.h:42
@ DT_ON_EDGE
Definition DeviceState.h:52
@ DT_LESS_THAN_OR_EQUAL
Definition DeviceState.h:45
@ DT_TRUE
Definition DeviceState.h:53
@ DT_LESS_THAN
Definition DeviceState.h:44
@ DT_OUTSIDE
Definition DeviceState.h:50
@ DT_FALSE
Definition DeviceState.h:54
@ DT_GREATER_THAN_OR_EQUAL
Definition DeviceState.h:47
@ DT_NOT_INSIDE
Definition DeviceState.h:51
@ DT_EQUAL
Definition DeviceState.h:43
@ DT_GREATER_THAN
Definition DeviceState.h:46
DeviceTest mDeviceTest
int mInterface
This is different from the value or values that an interface can take on.
Definition DeviceState.h:99
PDevice * mDevice
virtual int GetState(int iface) const
Definition PDevice.cpp:65

References DT_EQUAL, DT_FALSE, DT_GREATER_THAN, DT_GREATER_THAN_OR_EQUAL, DT_INSIDE, DT_LESS_THAN, DT_LESS_THAN_OR_EQUAL, DT_NOT_EQUAL, DT_NOT_INSIDE, DT_NOT_OUTSIDE, DT_ON_EDGE, DT_OUTSIDE, DT_TRUE, PDevice::GetState(), DeviceState::mDevice, DeviceState::mDeviceTest, and DeviceState::mInterface.


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