simloop.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef SIMLOOP__HPP
  2. #define SIMLOOP__HPP
  3. #include <vector>
  4. #include <string>
  5. #include "libcsim.hpp"
  6. using namespace std;
  7. // forward declaration
  8. class SimElement;
  9. class Connection; //! forward declaration
  10. class connection; //! forward declaration --> loeschen geht noch nicht??
  11. class input; //! forward declaration
  12. class AbstractNormalize; //! forward declaration
  13. class learning; // forward declaration for learning pointer in class connection
  14. class veclearning; // forward declaration for learning pointer in class connection
  15. class layer;
  16. /*! \brief SimLoop enthält gemeinsame Informationen, die von allen SimElements genutzt werden
  17. *
  18. * außerdem werden alle SimElements in der SimLoop registriert,
  19. * so dass die SimLoop
  20. * die proceede und prepare-Methoden aller SimElements aufrufen kann
  21. */
  22. class SimLoop
  23. {
  24. private:
  25. int MacroTimeStep;
  26. float DeltaT;
  27. string DataDirectory;
  28. unsigned int ElementCounter;
  29. vector<SimElement*>* SimElementList;
  30. TConnectionList* ConnectionList;
  31. TNormList* NormList;
  32. int MaximumDelay; //!< the real maximum delay of the simulation
  33. public:
  34. SimLoop(int _MacroTimeStep=1000, float _DeltaT=0.25);
  35. ~SimLoop();
  36. void deleteAllSimElements();
  37. int AddSimElement(SimElement*);
  38. int AddSimElement(layer*);
  39. int AddSimElement(Connection*);
  40. int AddSimElement(AbstractNormalize*);
  41. void Hallo();
  42. void SetDataDirectory(const char* _dirname = "/home/frank/data/sim/csim/");
  43. void SetDataDirectory_(const char* _dirname = "/home/frank/data/sim/csim/");
  44. string GetDataDirectory();
  45. int GetMacroTimeStep();
  46. int SetDeltaT(float _dt);
  47. float GetDeltaT();
  48. void SaveSimInfo();
  49. void SetSimTag(const char* _tag);
  50. void TurnOffLearning();
  51. void TurnOnLearning();
  52. void SaveLearningWeights(int TrialNr);
  53. void CropLearningWeights(float threshold);
  54. void SetMaximumDelay(int newmax);
  55. int GetMaximumDelay();
  56. int proceede(int TotalTime=0);
  57. int prepare(int mst=0);
  58. int reset(int t);
  59. void SetParameter(ParaType p, double value);
  60. void ProcessSignalUsr1();
  61. void showMemoryConsumption();
  62. };
  63. //////////////////////////////////////////////////
  64. /*! \brief erzeugt die globale SimLoop
  65. */
  66. SimLoop* InitLibCSim(int _MacroTimeStep=1000, float _DeltaT=0.25);
  67. /*! \brief liefert einen Zeiger auf die globale SimLoop
  68. */
  69. SimLoop* GetGlobalSimLoop();
  70. /*! \brief löscht die globale SimLoop
  71. */
  72. void deleteGlobalSimLoop();
  73. #endif // #ifndef SIMLOOP__HPP