Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

track_vr.H

Go to the documentation of this file.
00001 #ifndef GLUE_BUT_TRACK_H
00002 #define GLUE_BUT_TRACK_H
00003 
00004 #include "event/event.H"
00005 #include "dev/dev.H"
00006 #include "dev/room6d.H"
00007 #include "dev/buttons.H"
00008 
00009 extern DllImpExp cWtransf &Identity;
00010 
00011 class DEVtracker_agg: public EVENTfilter {
00012      str_ptr        _hname, _tname;
00013      DEVice_room6d *_head;
00014      DEVice        *_tkr;    // possible real source of tracker events
00015      EVENTsource    _tkr_src;// cached description of tracker event source
00016             
00017      bool     tracker_evt(cEVENTptr &evt) { 
00018            if (!_tkr && !(_tkr = DEVice::lookup(_tname)) && evt->debug_on())
00019           cerr <<"DEVtracker_agg: can't find tracker device "
00020                << _tname << endl;
00021            return _tkr_src.test(*evt->source()) && EVENTroom6d::isa(evt); }
00022      cWtransf &cur_head(bool dbg) { 
00023                if (!_head&&!(_head=(DEVice_room6d*)DEVice::lookup(_hname))&&dbg)
00024               cerr << "DEVtracker_agg: can't find head device "
00025                << _hname << endl; 
00026            return _head ? _head->cur() : Identity; }
00027    public:
00028       DEVtracker_agg(Cstr_ptr &h, Cstr_ptr &t): _hname(h), _tname(t),
00029              _head(0), _tkr(0), _tkr_src(_tname,0) { }
00030 
00031       EVENTptr filter(cEVENTptr &evt) {
00032      if (tracker_evt(evt)) {
00033         EVENTroom6dptr track = EVENTroom6d::cast(evt);
00034             return new EVENTroom6d_vr(track->source(), 
00035                                       track->old(),
00036                                       track->cur(),cur_head(evt->debug_on()));
00037      }
00038      return evt;
00039       }
00040 };
00041 
00042 #endif

Generated on Mon Sep 15 16:25:57 2003 for gluebase by doxygen1.2.18