#include <gadget/Type/AnalogProxy.h>
Inheritance diagram for gadget::AnalogProxy:


Public Member Functions | |
| AnalogProxy () | |
| Constructor. | |
| virtual | ~AnalogProxy () |
| virtual void | updateData () |
| Updates the cached data copy from the device. | |
| virtual vpr::Interval | getTimeStamp () const |
| Returns the time of last update. | |
| float | getData () const |
| Gets the current analog data value. | |
| Analog * | getAnalogPtr () |
| Returns a pointer to the gadget::Analog object that we are proxying. | |
| int | getUnit () const |
| Returns the unit index into the analog device from which this proxy is reading data. | |
| bool | config (jccl::ConfigElementPtr element) |
| Configures the proxy. | |
| virtual Input * | getProxiedInputDevice () |
| Returns a pointer to the base class of the devices being proxied. | |
Static Public Member Functions | |
| static std::string | getElementType () |
| Returns the string rep of the element type used to config this device. | |
An analog proxy always points to an analog device and unit number within that device. The Input Manager can therefore keep an array of these around and treat them as analog devices that only return a single sub-device's amount of data (one float).
Definition at line 61 of file AnalogProxy.h.
| gadget::AnalogProxy::AnalogProxy | ( | ) | [inline] |
| virtual gadget::AnalogProxy::~AnalogProxy | ( | ) | [inline, virtual] |
| virtual void gadget::AnalogProxy::updateData | ( | ) | [inline, virtual] |
Updates the cached data copy from the device.
Reimplemented from gadget::Proxy.
Definition at line 75 of file AnalogProxy.h.
00076 { 00077 if(!isStupefied()) 00078 { 00079 // Make sure dependencies are updated. 00080 getProxiedInputDevice()->updateDataIfNeeded(); 00081 mData = mTypedDevice->getAnalogData(mUnitNum); 00082 } 00083 }
| virtual vpr::Interval gadget::AnalogProxy::getTimeStamp | ( | ) | const [inline, virtual] |
Returns the time of last update.
Implements gadget::Proxy.
Definition at line 86 of file AnalogProxy.h.
| float gadget::AnalogProxy::getData | ( | ) | const [inline] |
Gets the current analog data value.
Definition at line 95 of file AnalogProxy.h.
00096 { 00097 const float analogDefault(0.0f); 00098 if(isStupefied()) 00099 { 00100 return analogDefault; 00101 } 00102 else 00103 { 00104 return mData.getAnalog(); 00105 } 00106 }
| Analog* gadget::AnalogProxy::getAnalogPtr | ( | ) | [inline] |
Returns a pointer to the gadget::Analog object that we are proxying.
Definition at line 109 of file AnalogProxy.h.
00110 { 00111 if(isStupefied()) 00112 { 00113 return NULL; 00114 } 00115 else 00116 { 00117 return mTypedDevice; 00118 } 00119 }
| int gadget::AnalogProxy::getUnit | ( | ) | const [inline] |
Returns the unit index into the analog device from which this proxy is reading data.
Definition at line 125 of file AnalogProxy.h.
| std::string gadget::AnalogProxy::getElementType | ( | ) | [static] |
Returns the string rep of the element type used to config this device.
Used by the Input Manager to find elements that construct devices.
Reimplemented from gadget::Proxy.
Definition at line 41 of file AnalogProxy.cpp.
Referenced by gadget::ProxyDepChecker::canHandle(), and config().
| bool gadget::AnalogProxy::config | ( | jccl::ConfigElementPtr | element | ) | [virtual] |
Configures the proxy.
Reimplemented from gadget::Proxy.
Definition at line 46 of file AnalogProxy.cpp.
References gadget::Proxy::config(), gadgetDBG_INPUT_MGR(), getElementType(), gadget::TypedProxy< DEV_TYPE >::mDeviceName, and gadget::TypedProxy< DEV_TYPE >::refresh().
00047 { 00048 vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL, 00049 std::string("----------- configuring ANALOG PROXY -----------------\n"), 00050 std::string("----------- exit: configuring analog proxy -----------\n")); 00051 vprASSERT(element->getID() == getElementType()); 00052 00053 if ( ! Proxy::config(element) ) 00054 { 00055 return false; 00056 } 00057 00058 mUnitNum = element->getProperty<int>("unit"); 00059 mDeviceName = element->getProperty<std::string>("device"); 00060 00061 refresh(); // Refresh the device now that we have something to point at 00062 00063 return true; 00064 }
| virtual Input* gadget::AnalogProxy::getProxiedInputDevice | ( | ) | [inline, virtual] |
Returns a pointer to the base class of the devices being proxied.
Implements gadget::Proxy.
Definition at line 134 of file AnalogProxy.h.
00135 { 00136 if((NULL == mTypedDevice) || (mStupefied)) 00137 { 00138 return NULL; 00139 } 00140 00141 Input* ret_val = dynamic_cast<Input*>(mTypedDevice); 00142 vprASSERT((ret_val != NULL) && "Cross-cast in AnalogProxy failed"); 00143 return ret_val; 00144 }
1.5.1