Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

P_Buttons.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: P_Buttons.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.25 $       $Date: 2019/01/17 21:21:00 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * This is Paul's new Tracker code -- pgrayson@ks.uiuc.edu
00019  *
00020  * A Buttons is a representation for a set of n boolean inputs.  This
00021  * fairly abstract class should be subclassed to make Buttons objects
00022  * that actually know how to get their buttons.  This is somewhat
00023  * parallel to the Tracker object, compare them!
00024  *
00025  ***************************************************************************/
00026 
00027 #ifndef P_BUTTONS_H
00028 #define P_BUTTONS_H
00029 
00030 #define MAX_BUTTONS 100
00031 
00032 #include "ResizeArray.h"
00033 #include "P_SensorConfig.h"
00034 
00067 
00068 
00069 
00070 
00071 class Buttons {
00072  protected: 
00073   ResizeArray<int> used; 
00074   int stat[MAX_BUTTONS]; 
00075 
00077   virtual int do_start(const SensorConfig *) { return 1; }
00078 
00079  public:
00080   Buttons() {}
00081   virtual ~Buttons() {}
00082   
00083   virtual const char *device_name() const = 0;
00084   virtual Buttons *clone() = 0;
00085 
00086   int start(const SensorConfig *);
00087 
00088   virtual void update() = 0;
00089   inline int state(int num) {
00090     if(num>used.num() || num<0) return 0;
00091     return stat[used[num]];
00092   }
00093 };
00094 
00095 #endif
00096 

Generated on Sat Apr 20 02:43:28 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002