GloveProxy.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2005 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile$
00027  * Date modified: $Date: 2005-03-07 16:29:11 -0600 (Mon, 07 Mar 2005) $
00028  * Version:       $Revision: 16995 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00034 //
00035 // Glove proxy class
00036 //
00038 
00039 #ifndef _GADGET_GLOVE_PROXY_H_
00040 #define _GADGET_GLOVE_PROXY_H_
00041 
00042 #include <gadget/gadgetConfig.h>
00043 #include <math.h>
00044 
00045 #include <gadget/Type/Glove.h>
00046 #include <gadget/Type/Proxy.h>
00047 
00048 namespace gadget
00049 {
00050 
00055 class GADGET_CLASS_API GloveProxy : public TypedProxy<Glove>
00056 {
00057 public:
00062    GloveProxy()
00063    {
00064       mUnitNum = -1;
00065       mVisible = true;
00066    }
00067 
00068    virtual ~GloveProxy()
00069    {}
00070 
00071    gmtl::Vec3f getTipVector(GloveData::GloveComponent component)
00072    {
00073       if(isStupefied())
00074          return gmtl::Vec3f(0,0,0);
00075       else
00076          return mTypedDevice->getTipVector(component,mUnitNum);
00077    }
00078 
00079    gmtl::Matrix44f getTipTransform( GloveData::GloveComponent component)
00080    {
00081       if(isStupefied())
00082          return gmtl::Matrix44f();
00083       else
00084          return mTypedDevice->getTipTransform(component,mUnitNum);
00085    }
00086   
00087    gmtl::Matrix44f getJointTransform(GloveData::GloveComponent component,
00088                                      GloveData::GloveJoint joint)
00089    {
00090       if(isStupefied())
00091          return gmtl::Matrix44f();
00092       else
00093          return mTypedDevice->getJointTransform(component, joint, mUnitNum);
00094    }
00095 
00096    GloveData getData()
00097    {
00098       if(isStupefied())
00099          return GloveData();
00100       else
00101          return mTypedDevice->getGloveData(mUnitNum);
00102    }
00103 
00105    vpr::Interval getTimeStamp() const
00106    {
00107       // XXX: Broken for now, this is a case similar to the KeyboardMouse type in that
00108       //      it does not point to one data element like digital, analog, and position.
00109       return vpr::Interval();
00110    }
00111 
00113    Glove* getGlovePtr()
00114    {
00115       if(isStupefied())
00116          return NULL;
00117       else
00118          return mTypedDevice;
00119    }
00120 
00122    int getUnit()
00123    {
00124       return mUnitNum;
00125    }
00126 
00127    bool isVisible()
00128    {
00129       return mVisible;
00130    }
00131 
00132    static std::string getElementType();
00133 
00134    bool config(jccl::ConfigElementPtr element);
00135 
00136    virtual Input* getProxiedInputDevice()
00137    {
00138       if((NULL == mTypedDevice) || (isStupefied()))
00139          return NULL;
00140 
00141       Input* ret_val = dynamic_cast<Input*>(mTypedDevice);
00142       vprASSERT((ret_val != NULL) && "Cross-cast in GloveProxy failed");
00143       return ret_val;
00144    }
00145 
00146 private:
00148    bool  mVisible;
00149 
00151    int mUnitNum;
00152 };
00153 
00154 } // End of gadget namespace
00155 
00156 #endif

Generated on Thu Jan 4 10:41:55 2007 for Gadgeteer by  doxygen 1.5.1