SpikeStream Application Library
0.2
|
00001 #ifndef GLOBALS_H 00002 #define GLOBALS_H 00003 00004 //SpikeStream includes 00005 #include "AbstractSimulation.h" 00006 #include "AnalysisDao.h" 00007 #include "Archive.h" 00008 #include "ArchiveWidget.h" 00009 #include "NetworksWidget.h" 00010 #include "EventRouter.h" 00011 #include "ArchiveDao.h" 00012 #include "NetworkDao.h" 00013 #include "Network.h" 00014 #include "NetworkDisplay.h" 00015 #include "NetworkViewer.h" 00016 #include "SpikeStreamMainWindow.h" 00017 using namespace spikestream; 00018 00019 //Qt includes 00020 #include <QString> 00021 #include <QDateTime> 00022 00023 namespace spikestream { 00024 class Globals { 00025 public: 00026 static bool archiveLoaded(); 00027 static void cleanUp(); 00028 static void clearAnalysisRunning(const QString& analysisName); 00029 static unsigned int getAnalysisID(const QString& analysisName); 00030 static AnalysisDao* getAnalysisDao(); 00031 static Archive* getArchive(); 00032 static ArchiveDao* getArchiveDao(); 00033 static EventRouter* getEventRouter() {return eventRouter; } 00034 static Network* getNetwork(); 00035 static NetworkDao* getNetworkDao(); 00036 static NetworkDisplay* getNetworkDisplay(); 00037 static AbstractSimulation* getSimulation(); 00038 static QString getSpikeStreamRoot(); 00039 static QString getWorkingDirectory(); 00040 static bool isAnalysisRunning(); 00041 static bool isArchivePlaying(); 00042 static bool isAnalysisLoaded(const QString& analysisName); 00043 static bool isSimulationLoaded(); 00044 static bool isSimulationRunning(); 00045 static bool isRendering(); 00046 static bool networkChangeOk(); 00047 static bool networkLoaded(); 00048 static void setAnalysisID(const QString& analysisName, unsigned int id); 00049 static void setAnalysisRunning(const QString& analysisName); 00050 static void setArchivePlaying(bool archivePlaying); 00051 static void setNetwork(Network* network); 00052 static void setSimulation(AbstractSimulation* simulation); 00053 static void setSimulationLoading(bool simulationLoading); 00054 static void setSimulationRunning(bool simulationRunning); 00055 00056 /* Friend classes that are allowed to change the state of Globals 00057 by accessing private setter methods*/ 00058 friend class SpikeStreamMainWindow; 00059 friend class spikestream::NetworksWidget; 00060 friend class spikestream::NetworkViewer; 00061 friend class spikestream::ArchiveWidget; 00062 00063 private: 00064 //===================== VARIABLES ============================ 00066 static AnalysisDao* analysisDao; 00067 00069 static NetworkDao* networkDao; 00070 00072 static ArchiveDao* archiveDao; 00073 00076 static QString spikeStreamRoot; 00077 00079 static QString workingDirectory; 00080 00082 static Network* network; 00083 00085 static Archive* archive; 00086 00088 static AbstractSimulation* simulation; 00089 00092 static QHash<QString, unsigned int> analysisMap; 00093 00095 static QHash<QString, bool> analysisRunningMap; 00096 00098 static bool simulationLoading; 00099 00101 static bool simulationRunning; 00102 00104 static NetworkDisplay* networkDisplay; 00105 00107 static EventRouter* eventRouter; 00108 00110 static bool rendering; 00111 00113 static bool archivePlaying; 00114 00115 00116 //====================== METHODS ============================ 00117 static void setAnalysisDao(AnalysisDao* analysisDao); 00118 static void setArchive(Archive* archive); 00119 static void setArchiveDao(ArchiveDao* archiveDao); 00120 static void setEventRouter(EventRouter* eventRouter); 00121 static void setNetworkDisplay(NetworkDisplay* networkDisplay); 00122 static void setNetworkDao(NetworkDao* networkDao); 00123 static void setRendering(bool rendering); 00124 static void setSpikeStreamRoot(QString rootDir); 00125 static void setWorkingDirectory(QString workingDir); 00126 00127 }; 00128 00129 } 00130 00131 #endif // GLOBALS_H