00001 /*************************************************************************** 00002 Atom.h - description 00003 ------------------- 00004 begin : mer jun 25 2003 00005 copyright : (C) 2003 by Michel Dubois, Yann Le Guyadec 00006 email : Michel.Dubois@univ-ubs.fr, Yann.Le-Guyadec@univ-ubs.fr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef ATOM_H 00019 #define ATOM_H 00020 00021 #include <SimAtom.h> 00022 #include "Accelerometer.h" 00023 #include "Clock.h" 00024 #include "Girometer.h" 00025 #include "Leg.h" 00026 #include "Molecule.h" 00027 #include "CartesianPosition.h" 00028 #include "nommgr.h" 00029 #include <vector> 00030 #include "mmgr.h" 00031 00032 00033 namespace API { 00034 class Leg; 00035 class Molecule; 00036 class Accelerometer; 00037 class Girometer; 00038 class Clock; 00039 00048 class Atom { 00049 00050 class Util; 00051 friend class Util; 00052 friend class Molecule; 00053 00054 private: 00055 int ID; 00056 Molecule * molecule; 00057 Clock * clock; 00058 Leg * leg[6]; 00059 Girometer * giro[3]; 00060 Accelerometer * accel[3]; 00061 00062 public: 00063 00072 class Util { 00073 friend class Atom; 00074 private: 00075 Atom * atom; 00076 SimAtom * simatom; 00077 Util(Atom * anAtom, SimAtom * aSimAtom); 00078 ~Util(); 00079 public: 00080 00086 SimAtom * getSimulatedObject() const; 00087 00093 CartesianPosition getCartesianPosition() const; 00094 00099 void setCartesianPosition(CartesianPosition * aCartesianPosition); 00100 00105 bool getAttachToEnvMode() const; 00110 void setAttachToEnvMode(bool onoff); 00111 00115 void print() const; 00116 00117 }; 00118 00123 Util * util; 00124 00129 Atom(); 00130 00135 ~Atom(); 00136 00142 unsigned int getID() const; 00143 00149 unsigned int getLegCount() const; 00150 00157 Leg * getLeg(unsigned int aLegID) const; 00158 00165 Leg * getMappedLeg(unsigned int aLegID) const; 00166 00172 Molecule * getMolecule() const; 00173 00181 std::vector<unsigned int> getMap() const; 00182 00189 Accelerometer * getAccelerometer(unsigned int anAccelerometerID) const; 00190 00196 unsigned int getAccelerometerCount() const; 00197 00203 Clock * getClock() const; 00204 00211 Girometer* getGirometer(unsigned int aGirometerID) const; 00212 00218 unsigned int getGirometerCount() const; 00219 00226 void setMap(unsigned int face1, unsigned int face2); 00227 00231 void stop(); 00232 00239 Atom * getNeighbor(unsigned int LegID) const; // index in 0..5 00240 00246 unsigned int getConnectedLegCount() const; 00247 00253 unsigned int getConnectedAtomCount() const; 00254 00255 // std::vector<Atom *> * getNeighbors() const; 00256 // on rebascule vers un tableau de 6 references ... 00257 // Leg * getMyLinkedLeg(unsigned int neighborIndex, unsigned int legIndex) const; 00258 // unsigned int getLinkedLegCount(unsigned int neighborIndex) const; // 1..3 00259 protected: 00265 void setID(unsigned int anAtomID); 00270 void setMolecule(Molecule * aMolecule); 00271 }; 00272 } 00273 #endif