FF3DDeviceSenderAgent.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Micole Architecture
00003  *
00004  * Copyright (C) 2007 Micole partners
00005  *
00006  * Micole Architecture is free software: you can redistribute it 
00007  * and/or modify it under the terms of the GNU Lesser General 
00008  * Public License as published by the Free Software Foundation, 
00009  * either version 3 of the License, or (at your option) any 
00010  * later version.
00011  *
00012  * Micole Architecture is distributed in the hope that it will be 
00013  * useful, * but WITHOUT ANY WARRANTY; without even the implied 
00014  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00015  * PURPOSE.  See the GNU Lesser General Public License for more 
00016  * details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with Micole Architecture.  If not, see
00020  * <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 #ifndef FF3DDEVICESENDERAGENT_H
00024 #define FF3DDEVICESENDERAGENT_H
00025 #include "micolelib.h"
00026 
00027 #define BUTTON_LAG 0.1 
00029 #include <config.h>
00030 #include "MicoleAgentThread.h"
00031 
00032 #include <Display.h>
00033 #include <Scene.h>
00034 #include <Node.h>
00035 #include <Field.h>
00036 
00037 #include <iostream>
00038 //#include <string>
00039 
00040 using namespace Reachin;
00041 using namespace std;
00042 
00070 class MICOLELIB_API FF3DDeviceSenderAgent : public Node, MicoleAgentThread
00071 {
00072         public:
00076                 struct FF3DCoord : public Dependent<EvaldFField< FF3DCoord, SFVec3f, SFVec3f >>
00077                 {
00078                         void evaluate( SFVec3f * constraint_position )
00079                         {
00080                                 if (constraint_position)
00081                                 {
00082                                         Vec3f p = constraint_position->get();
00083                                         value.x = p.x;
00084                                         value.y = p.y;
00085                                         value.z = p.z;
00086                                 }
00087                                 //cout << p.x << " "<< p.y << " " << p.z << endl;
00088                         }
00089                 };
00090 
00094                 struct ButtonPress : public Dependent< EvaldFField< ButtonPress, SFBool, SFBool > >
00095                 {
00096                                 ButtonPress() : pressed(false), skip(false), last_event(0) { }
00097                                 void evaluate(SFBool);
00098                                 bool eventPressed();
00099                                 bool eventReleased();
00100                                 bool pressed;
00101                                 bool skip;
00102                                 Time last_event;
00103                 };
00104                 auto_ptr< FF3DCoord > _FF3DCoord;
00105 
00106                 auto_ptr< ButtonPress > _buttonPress;
00107 
00113                 FF3DDeviceSenderAgent(const int &pDelay = 8); 
00114                 
00115                 ~FF3DDeviceSenderAgent();
00116 
00120                 virtual void run();
00121 
00122         protected:
00126                 virtual void prepareToStop(int argc, const char **argv);
00130                 virtual void prepareToSuspend(int argc, const char **argv);
00131 
00132         private:
00133                 int _delay; 
00134 };
00135  // end of Sender // end of FF3D
00138 
00139 #endif

Generated on Tue Oct 16 17:10:42 2007 for Micole by  doxygen 1.4.7