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

#include <DeviceState.h>

Inheritance diagram for IntervalState:
DeviceState

Public Member Functions

 IntervalState ()
 
 IntervalState (int low, int high, DeviceTest test, int interfaced, PDevice *device, PEBL_DEVICE_TYPE pdt)
 
virtual ~IntervalState ()
 
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

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 127 of file DeviceState.h.

Constructor & Destructor Documentation

◆ IntervalState() [1/2]

IntervalState::IntervalState ( )

◆ IntervalState() [2/2]

IntervalState::IntervalState ( int  low,
int  high,
DeviceTest  test,
int  interfaced,
PDevice device,
PEBL_DEVICE_TYPE  pdt 
)

Definition at line 151 of file DeviceState.cpp.

151 :
152 DeviceState(test, intface, device, pdt),
153 mLow(low),
154 mHigh(high)
155{
156}

◆ ~IntervalState()

IntervalState::~IntervalState ( )
virtual

Definition at line 158 of file DeviceState.cpp.

159{
160}

Member Function Documentation

◆ SendToStream()

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

Reimplemented from DeviceState.

Definition at line 212 of file DeviceState.cpp.

213{
214 out << "<IntervalState: "<< mLow << " to " << mHigh << ">" << std::flush;
215 return out;
216}

◆ TestDevice()

int IntervalState::TestDevice ( ) const
virtual

Reimplemented from DeviceState.

Definition at line 162 of file DeviceState.cpp.

163{
164
165
166 long int value = mDevice->GetState(mInterface);
167 switch(mDeviceTest)
168 {
169
170 case DT_NOT_EQUAL:
171 case DT_OUTSIDE:
172 return value > mHigh || value < mLow;
173
174 case DT_EQUAL:
175 case DT_NOT_OUTSIDE:
176 return value <= mHigh && value > mLow;
177
178 case DT_NOT_INSIDE:
179 return value <= mLow || value >= mHigh;
180
181 case DT_INSIDE:
182 return value < mHigh && value > mLow;
183
184 case DT_ON_EDGE:
185 return value == mLow || value == mHigh;
186
187 case DT_LESS_THAN: //Interpretation: less than the lower bound
188 return value < mLow;
189
190 case DT_LESS_THAN_OR_EQUAL: //Interpretation: less than or equal to the upper bound
191 return value <= mHigh;
192
193 case DT_GREATER_THAN:
194 return value > mHigh; //Interpretation: greater than the upper bound
195
196 case DT_GREATER_THAN_OR_EQUAL: //Interpretation: greater than or equal to the lower bound
197 return value >= mLow;
198
199 case DT_TRUE:
200 return 1;
201 case DT_FALSE:
202 default:
203 return 0;
204 }
205}
@ 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: