CORBATransform.h

Go to the documentation of this file.
00001 /* ======================================================================== 
00002  * Copyright (C) 2006  Graz University of Technology
00003  *
00004  * This framework is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This framework is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this framework; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  *
00018  * For further information please contact 
00019  * Dieter Schmalstieg
00020  * <schmalstieg@icg.tu-graz.ac.at>
00021  * Graz University of Technology, 
00022  * Institut for Computer Graphics and Vision,
00023  * Inffeldgasse 16a, 8010 Graz, Austria.
00024  * ========================================================================
00025  * PROJECT: OpenTracker
00026  * ======================================================================== */
00033  /* ======================================================================= */
00034 
00049 #ifndef _CORBATRANSFORM_H
00050 #define _CORBATRANSFORM_H
00051 
00052 #include <OpenTracker/OpenTracker.h>
00053 #include <OpenTracker/tool/OT_ACE_Log.h>
00054 #include <OpenTracker/skeletons/OT_CORBA.hh>
00055 #include <OpenTracker/network/CORBAUtils.h>
00065 namespace ot {
00066 
00067 class CORBAModule;
00068 
00069 class OPENTRACKER_API CORBATransform : public CORBASink
00070 {
00071 // Members
00072 public:
00074   OT_CORBA::TransformNode_var corba_transform;
00076     //    int frequency;
00077     //int cycle;
00078     
00079 
00080 // Methods
00081 protected:
00085     CORBATransform( OT_CORBA::TransformNode_var corba_transform_) :
00086       CORBASink(), 
00087       corba_transform( corba_transform_ )
00088         {
00089           // empty constructor
00090         }
00091     virtual ~CORBATransform() {
00092       LOG_ACE_ERROR("CORBATransform destructor");
00093     }
00094 
00095 public:
00105     virtual void onEventGenerated( Event& event, Node& generator)
00106     {
00107       logPrintI("CORBATransform::onEventGenerated\n");
00108       cycle++;
00109       //if ((cycle % frequency) == 0) {
00110       //Event new_event;
00111       //CORBAUtils::convertToCORBAEvent(event, corba_event);
00112       OT_CORBA::Event corba_event = event.getCORBAEvent();
00113       try {
00114         OT_CORBA::Event* new_corba_event = corba_transform->transformEvent(corba_event);
00115         //CORBAUtils::convertFromCORBAEvent(new_event, new_corba_event);
00116         Event new_event(*new_corba_event);
00117         updateObservers( new_event );
00118       }
00119       catch (CORBA::COMM_FAILURE) {
00120         std::cerr << "Caught CORBA::COMM_FAILURE" << std::endl;
00121       }
00122       catch (CORBA::TRANSIENT) {
00123         std::cerr << "Caught CORBA::TRANSIENT" << std::endl;
00124       }
00125       //      }
00126     }
00127     
00128     friend class CORBAModule;
00129 };
00130 
00131 }
00132 
00133 #endif

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