root/juggler/branches/2.2/modules/gadgeteer/gadget/Type/AnalogData.h
| Revision 19729, 2.5 kB (checked in by patrick, 2 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /*************** <auto-copyright.pl BEGIN do not edit this line> ************** |
| 2 | * |
| 3 | * VR Juggler is (C) Copyright 1998-2007 by Iowa State University |
| 4 | * |
| 5 | * Original Authors: |
| 6 | * Allen Bierbaum, Christopher Just, |
| 7 | * Patrick Hartling, Kevin Meinert, |
| 8 | * Carolina Cruz-Neira, Albert Baker |
| 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Library General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Library General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Library General Public |
| 21 | * License along with this library; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
| 25 | *************** <auto-copyright.pl END do not edit this line> ***************/ |
| 26 | |
| 27 | #ifndef _GADGET_ANALOG_DATA_H_ |
| 28 | #define _GADGET_ANALOG_DATA_H_ |
| 29 | |
| 30 | #include <gadget/Type/InputData.h> |
| 31 | |
| 32 | namespace gadget |
| 33 | { |
| 34 | |
| 35 | /** \class AnalogData AnalogData.h gadget/Type/AnalogData.h |
| 36 | * |
| 37 | * InputData subclass for analog data. |
| 38 | */ |
| 39 | class AnalogData : public InputData |
| 40 | { |
| 41 | // Hack around a GCC 3.3 bug on Mac OS X 10.3 that shows up with |
| 42 | // boost::is_polymorphic. |
| 43 | #if defined(__MACH__) && defined(__APPLE_CC__) && defined(__GNUC__) && \ |
| 44 | __GNUC__ == 3 && __GNUC_MINOR__ == 3 |
| 45 | bool dummy_; |
| 46 | #endif |
| 47 | |
| 48 | public: |
| 49 | /** Constructor. */ |
| 50 | AnalogData () |
| 51 | : InputData() |
| 52 | , mAnalogData(0.0f) |
| 53 | { |
| 54 | ; |
| 55 | } |
| 56 | |
| 57 | AnalogData(float f) |
| 58 | : InputData() |
| 59 | , mAnalogData(f) |
| 60 | { |
| 61 | ; |
| 62 | } |
| 63 | |
| 64 | float getAnalog() const |
| 65 | { |
| 66 | return mAnalogData; |
| 67 | } |
| 68 | |
| 69 | void setAnalog(const float f) |
| 70 | { |
| 71 | mAnalogData = f; |
| 72 | } |
| 73 | |
| 74 | AnalogData& operator= (const AnalogData& pd) |
| 75 | { |
| 76 | InputData::copy (pd); |
| 77 | mAnalogData = pd.mAnalogData; |
| 78 | return *this; |
| 79 | } |
| 80 | |
| 81 | AnalogData& operator= (const float f) |
| 82 | { |
| 83 | mAnalogData = f; |
| 84 | return *this; |
| 85 | } |
| 86 | |
| 87 | bool operator== (const AnalogData& o) const |
| 88 | { |
| 89 | return mAnalogData == o.mAnalogData && mTimeStamp == o.mTimeStamp; |
| 90 | } |
| 91 | |
| 92 | bool operator!= (const AnalogData& o) const |
| 93 | { |
| 94 | return ! (*this == o); |
| 95 | } |
| 96 | |
| 97 | /* |
| 98 | operator float() const |
| 99 | { |
| 100 | return mAnalogData; |
| 101 | } |
| 102 | */ |
| 103 | |
| 104 | protected: |
| 105 | float mAnalogData; |
| 106 | }; // class AnalogData |
| 107 | |
| 108 | } // namespace gadget |
| 109 | |
| 110 | |
| 111 | #endif /* _GADGET_ANALOG_DATA_H_ */ |
Note: See TracBrowser for help on using the browser.
