Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

gadget::TypedProxy Class Template Reference

#include <Proxy.h>

Inheritance diagram for gadget::TypedProxy:

Inheritance graph
[legend]
Collaboration diagram for gadget::TypedProxy:

Collaboration graph
[legend]
List of all members.

Public Methods

 TypedProxy ()
virtual void set (std::string devName, DEV_TYPE *devPtr)
 Sets the proxy to point to the given type-specific device. More...

virtual bool refresh ()
 Refreshes the proxy. More...

virtual std::string getDeviceName () const
 Get the name of the device that we are proxying. More...


Protected Attributes

std::string mDeviceName
 Name of the device to link up with. More...

DEV_TYPE * mTypedDevice
 The device (type-specific pointer). More...

template<class DEV_TYPE>
class gadget::TypedProxy< DEV_TYPE >


Constructor & Destructor Documentation

template<class DEV_TYPE>
gadget::TypedProxy< DEV_TYPE >::TypedProxy   [inline]
 

Definition at line 147 of file Proxy.h.

00148          : mDeviceName("Unknown")
00149          , mTypedDevice(NULL)
00150       {
00151          ;
00152       }


Member Function Documentation

template<class DEV_TYPE>
virtual void gadget::TypedProxy< DEV_TYPE >::set std::string    devName,
DEV_TYPE *    devPtr
[inline, virtual]
 

Sets the proxy to point to the given type-specific device.

Precondition:
devPtr must be a valid device of type DEV_TYPE.
Postcondition:
The proxy now references the given device. The device name we are proxying is set to devPtr->getInstanceName()
Parameters:
devPtr  Pointer to the device.

Definition at line 163 of file Proxy.h.

00164       {
00165          mTypedDevice = devPtr;
00166          if(NULL != devPtr)
00167          {
00168             mDeviceName = devName;
00169             stupify(false);
00170          }
00171          else
00172          {
00173             vprASSERT(false && "Tried to set proxy to NULL device");
00174          }
00175       }

template<class DEV_TYPE>
virtual bool gadget::TypedProxy< DEV_TYPE >::refresh   [inline, virtual]
 

Refreshes the proxy.

This attempts to lookup the device that we are proxying. If the lookup fails, then we become stupified. If not the the proxy is pointed at this potentially new device.

Implements gadget::Proxy.

Definition at line 183 of file Proxy.h.

00184       {
00185          Input* input_dev = NULL;
00186          input_dev = InputManager::instance()->getDevice(mDeviceName);
00187 
00188          if ( NULL == input_dev )       // Not found, so stupify
00189          {
00190             vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL)
00191                << "gadget::TypedProxy::refresh: Could not find device '"
00192                << mDeviceName << "' pointed to by '" << mName << "'\n"
00193                << std::endl << vprDEBUG_FLUSH;
00194             stupify(true);
00195          }
00196          else
00197          {
00198             DEV_TYPE* typed_dev = dynamic_cast<DEV_TYPE*>(input_dev);
00199             if ( NULL == typed_dev )
00200             {
00201                vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL)
00202                   << "gadget::TypedProxy::config: Device was of wrong type: "
00203                   << mDeviceName << " it was type:" << typeid(input_dev).name()
00204                   << std::endl << vprDEBUG_FLUSH;
00205                stupify(true);
00206                return false;
00207             }
00208             vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL)
00209                << "   Proxy '" << mName << "' configured" << std::endl
00210                << vprDEBUG_FLUSH;
00211             mTypedDevice = typed_dev;    // Set the proxy
00212             stupify(false);
00213          }
00214          return true;
00215       }

template<class DEV_TYPE>
virtual std::string gadget::TypedProxy< DEV_TYPE >::getDeviceName   const [inline, virtual]
 

Get the name of the device that we are proxying.

Definition at line 218 of file Proxy.h.

00219       {
00220          return mDeviceName;
00221       }


Member Data Documentation

template<class DEV_TYPE>
std::string gadget::TypedProxy::mDeviceName [protected]
 

Name of the device to link up with.

Definition at line 224 of file Proxy.h.

Referenced by gadget::TypedProxy< EventWindow >::getDeviceName, gadget::TypedProxy< EventWindow >::refresh, gadget::TypedProxy< EventWindow >::set, and gadget::TypedProxy< EventWindow >::TypedProxy.

template<class DEV_TYPE>
DEV_TYPE* gadget::TypedProxy::mTypedDevice [protected]
 

The device (type-specific pointer).

Definition at line 225 of file Proxy.h.

Referenced by gadget::TypedProxy< EventWindow >::refresh, gadget::TypedProxy< EventWindow >::set, and gadget::TypedProxy< EventWindow >::TypedProxy.


The documentation for this class was generated from the following file:
Generated on Sun May 2 14:27:03 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002