OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

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 
00176 #ifndef OT_NO_CONSOLE_SUPPORT
00177 
00178 
00179 namespace ot {
00180 
00181     class OPENTRACKER_API ConsoleModule: public Module, public NodeFactory
00182     {
00183         enum DIRECTION { POS = 0, NEG };
00184         // Members
00185     protected:
00187         NodeVector sinks;
00189         NodeVector sources;
00191         int cycle;
00193         int interval;
00195         std::string headerline;
00197         float angularSpeed, posSpeed;
00199         int station;
00201         int quit;
00203         int display;
00205         int curses;
00207         std::vector<int> keyMap;
00209         bool delAttribute;
00211         bool addAttribute;
00213         bool changeAttrByVal;
00215         std::string nameOfAttributeToBeChanged;
00217         bool currentChanged;
00219         bool stationChanged;
00220 
00221         // Methods
00222     protected:
00229         void addAttr(const int station, const std::string type, const std::string name, const std::string value) const;
00234         void delAttr(const int station, const std::string name);
00238         void nextAttr(const int station);
00243         void changeAttrToValue(const int station, const std::string value) const;
00248         void changeAttr(const int station, const DIRECTION dir) const;
00253         void clearLastLines(int lines = -1);
00260         void setButton( int station , int button );
00267         void movePos( int station, float * data );
00274         void rotate( int station, float * data );
00280         void reset( int station );
00281     public:
00284         ConsoleModule();
00286         virtual ~ConsoleModule();
00293         virtual void init(StringTable& attributes, ConfigNode * localTree);
00301         virtual Node * createNode( const std::string& name, StringTable& attributes);
00307         virtual void pushEvent();
00312         virtual void pullEvent();
00316         virtual void start();
00319         virtual void close();
00323         virtual int stop();
00324 
00325         // maps the function names in the config file to indices
00326         std::vector<std::string> functionMap;
00327         // maps the function key names in the config file to key codes
00328         std::map<std::string,int> keyCodeMap;
00329 
00330         static const short MOVE_X_PLUS;
00331         static const short MOVE_X_MINUS;
00332         static const short MOVE_Y_PLUS;
00333         static const short MOVE_Y_MINUS;
00334         static const short MOVE_Z_PLUS;
00335         static const short MOVE_Z_MINUS;
00336         static const short ROT_X_PLUS;
00337         static const short ROT_X_MINUS;
00338         static const short ROT_Y_PLUS;
00339         static const short ROT_Y_MINUS;
00340         static const short ROT_Z_PLUS;
00341         static const short ROT_Z_MINUS;
00342         static const short ACCELL;
00343         static const short BRAKE;
00344         static const short BUTTON_1;
00345         static const short BUTTON_2;
00346         static const short BUTTON_3;
00347         static const short BUTTON_4;
00348         static const short STATION_0;
00349         static const short STATION_1;
00350         static const short STATION_2;
00351         static const short STATION_3;
00352         static const short STATION_4;
00353         static const short STATION_5;
00354         static const short STATION_6;
00355         static const short STATION_7;
00356         static const short STATION_8;
00357         static const short STATION_9;
00358         static const short RESET;
00359         static const short QUIT;
00360         static const short NEXT_ATTR;
00361         static const short ADD_ATTR;
00362         static const short DEL_ATTR;
00363         static const short CHANGE_ATTR_POS;
00364         static const short CHANGE_ATTR_NEG;
00365         static const short CHANGE_ATTR_VAL;
00366         static const short ACCEL_ANG;
00367         static const short BRAKE_ANG;
00368     };
00369 
00370 } // namespace ot
00371 
00372 
00373 #endif // OT_NO_CONSOLE_SUPPORT
00374 
00375 
00376 #endif
00377 
00378 /* 
00379  * ------------------------------------------------------------
00380  *   End of ConsoleModule.h
00381  * ------------------------------------------------------------
00382  *   Automatic Emacs configuration follows.
00383  *   Local Variables:
00384  *   mode:c++
00385  *   c-basic-offset: 4
00386  *   eval: (c-set-offset 'substatement-open 0)
00387  *   eval: (c-set-offset 'case-label '+)
00388  *   eval: (c-set-offset 'statement 'c-lineup-runin-statements)
00389  *   eval: (setq indent-tabs-mode nil)
00390  *   End:
00391  * ------------------------------------------------------------ 
00392  */

copyright (c) 2006 Graz University of Technology