Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

GInvestigationAgent.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Raphael Langerhorst                             *
00003  *   raphael-langerhorst@gmx.at                                            *
00004  *                                                                         *
00005  *   Permission is hereby granted, free of charge, to any person obtaining *
00006  *   a copy of this software and associated documentation files (the       *
00007  *   "Software"), to deal in the Software without restriction, including   *
00008  *   without limitation the rights to use, copy, modify, merge, publish,   *
00009  *   distribute, sublicense, and/or sell copies of the Software, and to    *
00010  *   permit persons to whom the Software is furnished to do so, subject to *
00011  *   the following conditions:                                             *
00012  *                                                                         *
00013  *   The above copyright notice and this permission notice shall be        *
00014  *   included in all copies or substantial portions of the Software.       *
00015  *                                                                         *
00016  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
00017  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
00018  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
00019  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
00020  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
00021  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
00022  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
00023  ***************************************************************************/
00024 
00025 #ifndef GBEGINVESTIGATIONAGENTH
00026 #define GBEGINVESTIGATIONAGENTH
00027 
00028 #include <GAgent.h>
00029 #include <GElementID.h>
00030 
00031 #include <GElementInfluence.h>
00032 
00033 #include <GWEInterface.h>
00034 
00035 #include <qtimer.h>
00036 #include <qvaluelist.h>
00037 #include <qstringlist.h>
00038 
00039 namespace GBE {
00040 
00057 class GInvestigationAgent : public GCS::GAgent
00058 {
00059   Q_OBJECT
00060   public:
00061     GInvestigationAgent(GWE::GWEInterface* gwe, int update_interval_msec = 500, QObject* parent = 0, const char* name = 0);
00062 
00063     ~GInvestigationAgent();
00064 
00065   protected:
00066   
00070     QTimer UpdateTimer;
00071   
00077     QValueList<GCS::GElementID> KnownElements;
00078     
00085     bool KnownElementsEmitPending;
00086   
00090     GWE::GWEInterface* Gwe;
00091     
00095     int UpdateInterval;
00096     
00100     unsigned long CurrentTarget;
00101     
00108     GCS::GVector3 CurrentSpeed;
00109   
00113     virtual void run();
00114 
00121     virtual void receiveInfluence(GCS::GElementInfluence& influence);
00122     
00123   protected slots:
00124   
00131     virtual void sendChangedSignals();
00132     
00133   public slots:
00134   
00139     virtual void createAndSendBasicInfluence(double fraction_of_own_energy, unsigned long targetID = 0);
00140     
00145     virtual void followTarget(unsigned long destinationElementID);
00146     
00151     virtual void setSpeed(const GCS::GVector3& new_speed);
00152 
00153   signals:
00154       
00158     void influenceReceived(const GCS::GElementInfluence& i);
00159 
00163     void knownElementsListChanged(const QStringList& known_elements);
00164     
00165     //note: there are standard signals already defined in GAgent,
00166     //      these are also emitted constantly to allow analysation
00167     //      especially energyChanged() and formChanged() are in use.
00168 };
00169 
00170 };
00171 
00172 #endif

Generated on Thu Oct 21 21:18:03 2004 for G System by doxygen 1.3.6