Isis 3.0 Object Programmers' Reference |
Home |
00001 #ifndef Application_h 00002 #define Application_h 00003 00027 #include "Environment.h" 00028 00029 #include <sys/types.h> 00030 #include <unistd.h> 00031 #include <sys/socket.h> 00032 #include <sys/un.h> 00033 00034 #include <iostream> 00035 #include <fstream> 00036 #include <QString> 00037 #include <string> 00038 #include <ctime> 00039 00040 #include "Pvl.h" 00041 #include "UserInterface.h" 00042 00043 class QLocalSocket; 00044 00045 namespace Isis { 00046 class Gui; 00047 class IException; 00048 class Progress; 00049 00112 class Application : public Environment { 00113 public: 00114 Application(int &argc, char *argv[]); 00115 ~Application(); 00116 00117 int Run(void (*funct)()); 00118 PvlGroup Accounting(); 00119 PvlObject History(); 00120 00121 static UserInterface &GetUserInterface(); 00122 static void Log(PvlGroup &results); 00123 static void GuiLog(const Pvl &results); 00124 static void GuiLog(const PvlGroup &results); 00125 static void GuiLog(const QString &results); 00126 static QString Name(); 00127 00128 static bool p_applicationForceGuiApp; 00129 00133 void RegisterGuiHelpers(std::map<QString, void *> helpers) { 00134 p_guiHelpers = helpers; 00135 }; 00136 00140 void *GetGuiHelper(QString helper) { 00141 return p_guiHelpers[helper]; 00142 }; 00143 00144 void GuiReportError(IException &e); 00145 00146 static QString UserName(); 00147 static QString HostName(); 00148 static QString DateTime(time_t *curtime = 0); 00149 static QString Version(); 00150 00151 static bool HasParent(); 00152 00153 private: 00154 int p_BatchlistPass; 00155 int DirectIO(); 00156 int PageFaults(); 00157 int ProcessSwaps(); 00158 00159 QLocalSocket *p_connectionToParent; 00160 time_t p_startTime; 00161 clock_t p_startClock; 00162 QString p_datetime; 00163 int p_startDirectIO; 00164 int p_startPageFaults; 00165 int p_startProcessSwaps; 00166 pid_t p_childPid; 00167 bool p_childCaught; 00168 00169 UserInterface *p_ui; 00170 00171 void SendParentData(QString, const QString &); 00172 void SendParentErrors(PvlObject &errors); 00173 00174 static PvlGroup GetUnameInfo(); 00175 static PvlGroup GetEnviromentInfo(); 00176 static QString GetSystemDiskSpace(); 00177 static QString GetLibraryDependencies(QString file); 00178 00179 friend class Gui; 00180 void FunctionCleanup(); 00181 int FunctionError(IException &e); 00182 00183 friend class Progress; 00184 friend class ProgramLauncher; 00185 void UpdateProgress(const QString &text, bool print); 00186 void UpdateProgress(int percent, bool print); 00187 void ProcessGuiEvents(); 00188 00192 void SetParentConnection(QLocalSocket *p_connection) { 00193 p_connectionToParent = p_connection; 00194 } 00195 void EstablishConnections(); 00196 void WaitForCommand(int childSocket); 00197 00198 pid_t p_pid; 00199 std::map<QString, void *> p_guiHelpers; 00200 static QString p_appName; 00201 00202 }; 00203 00204 extern Application *iApp; 00205 }; 00206 00207 #endif