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

#include <DeviceState.h>

Inheritance diagram for ValueState:
DeviceState

Public Member Functions

 ValueState (int value, DeviceTest test, int interfaced, PDevice *device, PEBL_DEVICE_TYPE pdt)
 
virtual ~ValueState ()
 
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 113 of file DeviceState.h.

Constructor & Destructor Documentation

◆ ValueState()

ValueState::ValueState ( int  value,
DeviceTest  test,
int  interfaced,
PDevice device,
PEBL_DEVICE_TYPE  pdt 
)

Definition at line 81 of file DeviceState.cpp.

85 :
86 DeviceState(test, intface,device, pdt),
87 mValue(value)
88{
89 //cout << "Creating new valuestate; interface:" << mInterface << std::endl;
90}

◆ ~ValueState()

ValueState::~ValueState ( )
virtual

Definition at line 92 of file DeviceState.cpp.

93{
94}

Member Function Documentation

◆ SendToStream()

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

Reimplemented from DeviceState.

Definition at line 143 of file DeviceState.cpp.

144{
145 out << "<ValueState: " << mValue << "|"<< mInterface << ">" << std::flush;
146 return out;
147}
int mInterface
This is different from the value or values that an interface can take on.
Definition DeviceState.h:99

References DeviceState::mInterface.

◆ TestDevice()

int ValueState::TestDevice ( ) const
virtual

Reimplemented from DeviceState.

Definition at line 99 of file DeviceState.cpp.

100{
101
102
103 int value = mDevice->GetState(mInterface);
104 //cout << "test value|" << mValue << "==" <<"device value|"<<value<< std::endl;
105
106 switch(mDeviceTest)
107 {
108
109 case DT_NOT_EQUAL:
110 case DT_OUTSIDE:
111 return value != mValue;
112
113 case DT_EQUAL:
114 case DT_NOT_OUTSIDE:
115 case DT_ON_EDGE:
116 return value == mValue;
117
118 case DT_LESS_THAN:
119 return value < mValue;
120
122 return value <= mValue;
123
124 case DT_GREATER_THAN:
125 return value > mValue;
126
128 return value >= mValue;
129
130 case DT_NOT_INSIDE: //a value is always 'not inside' another value (even if they are the same).
131 case DT_TRUE:
132 return 1;
133
134 case DT_INSIDE: //a value is never inside another value (even if they are the same).
135 case DT_FALSE:
136 default:
137 return 0;
138
139 }
140}
@ 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
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: