ConsoleModule.h

Go to the documentation of this file.
00001 /* ========================================================================
00002  * Copyright (c) 2006,
00003  * Institute for Computer Graphics and Vision
00004  * Graz University of Technology
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are
00009  * met:
00010  *
00011  * Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the following disclaimer.
00013  *
00014  * Redistributions in binary form must reproduce the above copyright
00015  * notice, this list of conditions and the following disclaimer in the
00016  * documentation and/or other materials provided with the distribution.
00017  *
00018  * Neither the name of the Graz University of Technology nor the names of
00019  * its contributors may be used to endorse or promote products derived from
00020  * this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00023  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00024  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00025  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00026  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  * ========================================================================
00034  * PROJECT: OpenTracker
00035  * ======================================================================== */
00042 /* ======================================================================= */
00043 
00160 #ifndef _CONSOLEMODULE_H
00161 #define _CONSOLEMODULE_H
00162 
00163 #include "../OpenTracker.h"
00164 
00165 
00166 
00178 #ifndef OT_NO_CONSOLE_SUPPORT
00179 
00180 
00181 namespace ot {
00182 
00183     class OPENTRACKER_API ConsoleModule: public Module, public NodeFactory
00184     {
00185         enum DIRECTION { POS = 0, NEG };
00186         // Members
00187     protected:
00189         NodeVector sinks;
00191         NodeVector sources;
00193         int cycle;
00195         int interval;
00197         std::string headerline;
00199         float angularSpeed, posSpeed;
00201         int station;
00203         int quit;
00205         int display;
00207         int curses;
00209         std::vector<int> keyMap;
00211         bool delAttribute;
00213         bool addAttribute;
00215         bool changeAttrByVal;
00217         std::string nameOfAttributeToBeChanged;
00219         bool currentChanged;
00221         bool stationChanged;
00222 
00223         // Methods
00224     protected:
00231         void addAttr(const int station, const std::string type, const std::string name, const std::string value) const;
00236         void delAttr(const int station, const std::string name);
00240         void nextAttr(const int station);
00245         void changeAttrToValue(const int station, const std::string value) const;
00250         void changeAttr(const int station, const DIRECTION dir) const;
00255         void clearLastLines(int lines = -1);
00262         void setButton( int station , int button );
00269         void movePos( int station, float * data );
00276         void rotate( int station, float * data );
00282         void reset( int station );
00283     public:
00286         ConsoleModule();
00288         virtual ~ConsoleModule();
00295         virtual void init(StringTable& attributes, ConfigNode * localTree);
00303         virtual Node * createNode( const std::string& name, StringTable& attributes);
00309         virtual void pushEvent();
00314         virtual void pullEvent();
00318         virtual void start();
00321         virtual void close();
00325         virtual int stop();
00326 
00327         // maps the function names in the config file to indices
00328         std::vector<std::string> functionMap;
00329         // maps the function key names in the config file to key codes
00330         std::map<std::string,int> keyCodeMap;
00331 
00332         static const short MOVE_X_PLUS;
00333         static const short MOVE_X_MINUS;
00334         static const short MOVE_Y_PLUS;
00335         static const short MOVE_Y_MINUS;
00336         static const short MOVE_Z_PLUS;
00337         static const short MOVE_Z_MINUS;
00338         static const short ROT_X_PLUS;
00339         static const short ROT_X_MINUS;
00340         static const short ROT_Y_PLUS;
00341         static const short ROT_Y_MINUS;
00342         static const short ROT_Z_PLUS;
00343         static const short ROT_Z_MINUS;
00344         static const short ACCELL;
00345         static const short BRAKE;
00346         static const short BUTTON_1;
00347         static const short BUTTON_2;
00348         static const short BUTTON_3;
00349         static const short BUTTON_4;
00350         static const short STATION_0;
00351         static const short STATION_1;
00352         static const short STATION_2;
00353         static const short STATION_3;
00354         static const short STATION_4;
00355         static const short STATION_5;
00356         static const short STATION_6;
00357         static const short STATION_7;
00358         static const short STATION_8;
00359         static const short STATION_9;
00360         static const short RESET;
00361         static const short QUIT;
00362         static const short NEXT_ATTR;
00363         static const short ADD_ATTR;
00364         static const short DEL_ATTR;
00365         static const short CHANGE_ATTR_POS;
00366         static const short CHANGE_ATTR_NEG;
00367         static const short CHANGE_ATTR_VAL;
00368         static const short ACCEL_ANG;
00369         static const short BRAKE_ANG;
00370                 
00371     };
00372 
00373         OT_MODULE(ConsoleModule);
00374 } // namespace ot
00375 
00376 
00377 #endif // OT_NO_CONSOLE_SUPPORT
00378 
00379 
00380 #endif
00381 
00382 /* 
00383  * ------------------------------------------------------------
00384  *   End of ConsoleModule.h
00385  * ------------------------------------------------------------
00386  *   Automatic Emacs configuration follows.
00387  *   Local Variables:
00388  *   mode:c++
00389  *   c-basic-offset: 4
00390  *   eval: (c-set-offset 'substatement-open 0)
00391  *   eval: (c-set-offset 'case-label '+)
00392  *   eval: (c-set-offset 'statement 'c-lineup-runin-statements)
00393  *   eval: (setq indent-tabs-mode nil)
00394  *   End:
00395  * ------------------------------------------------------------ 
00396  */

Generated on Wed Feb 28 15:18:48 2007 for NaviTrack by  doxygen 1.4.6