Isis 3 Developer Reference
Application.h
Go to the documentation of this file.
1 #ifndef Application_h
2 #define Application_h
3 
27 #include "Environment.h"
28 
29 #include <sys/types.h>
30 #include <unistd.h>
31 #include <sys/socket.h>
32 #include <sys/un.h>
33 
34 #include <iostream>
35 #include <fstream>
36 #include <QString>
37 #include <QTime>
38 #include <string>
39 #include <ctime>
40 
41 #include "Pvl.h"
42 #include "UserInterface.h"
43 
44 class QLocalSocket;
45 
46 namespace Isis {
47  class Gui;
48  class IException;
49  class Progress;
50 
117  class Application : public Environment {
118  public:
119  Application(int &argc, char *argv[]);
120  ~Application();
121 
122  int Run(void (*funct)());
124  PvlObject History();
125 
127  static void Log(PvlGroup &results);
128  static void GuiLog(const Pvl &results);
129  static void GuiLog(const PvlGroup &results);
130  static void GuiLog(const QString &results);
131  static QString Name();
132 
134 
138  void RegisterGuiHelpers(std::map<QString, void *> helpers) {
139  p_guiHelpers = helpers;
140  };
141 
145  void *GetGuiHelper(QString helper) {
146  return p_guiHelpers[helper];
147  };
148 
149  void GuiReportError(IException &e);
150 
151  static QString UserName();
152  static QString HostName();
153  static QString DateTime(time_t *curtime = 0);
154  static QString Version();
155 
156  static bool HasParent();
157 
158  private:
159  int p_BatchlistPass;
160  int DirectIO();
161  int PageFaults();
162  int ProcessSwaps();
163 
164  QLocalSocket *p_connectionToParent;
165  time_t p_startTime;
166  clock_t p_startClock;
167  QTime m_connectTime;
168  QString p_datetime;
169  int p_startDirectIO;
170  int p_startPageFaults;
171  int p_startProcessSwaps;
172  pid_t p_childPid;
173  bool p_childCaught;
174 
175  UserInterface *p_ui;
176 
177  void SendParentData(QString, const QString &);
178  void SendParentErrors(PvlObject &errors);
179 
180  static PvlGroup GetUnameInfo();
181  static PvlGroup GetEnviromentInfo();
182  static QString GetSystemDiskSpace();
183  static QString GetLibraryDependencies(QString file);
184 
185  friend class Gui;
186  void FunctionCleanup();
187  int FunctionError(IException &e);
188 
189  friend class Progress;
190  friend class ProgramLauncher;
191  void UpdateProgress(const QString &text, bool print);
192  void UpdateProgress(int percent, bool print);
193  void ProcessGuiEvents();
194 
198  void SetParentConnection(QLocalSocket *p_connection) {
199  p_connectionToParent = p_connection;
200  }
201  void EstablishConnections();
202  void WaitForCommand(int childSocket);
203 
204  pid_t p_pid;
205  std::map<QString, void *> p_guiHelpers;
206  static QString p_appName;
207 
208  };
209 
210  extern Application *iApp;
211 };
212 
213 #endif
Definition: Application.h:117
static UserInterface & GetUserInterface()
Returns the UserInterface object.
Definition: Application.cpp:479
static bool HasParent()
Returns whether the application has a parent or not.
Definition: Application.cpp:488
Application * iApp
Definition: Application.cpp:67
void GuiReportError(IException &e)
Loads the error message into the gui, but does not write it to the session log.
Definition: Application.cpp:724
Definition: Environment.h:52
static QString Version()
The Isis Version for this application.
Definition: Application.cpp:850
static QString Name()
Returns the name of the application.
Definition: Application.cpp:745
Execute External Programs and Commands.
Definition: ProgramLauncher.h:50
PvlGroup Accounting()
Creates accounting PvlGroup.
Definition: Application.cpp:297
Program progress reporter.
Definition: Progress.h:58
static void GuiLog(const Pvl &results)
Writes the Pvl results to the sessionlog, but not to the printfile.
Definition: Application.cpp:411
static QString DateTime(time_t *curtime=0)
Returns the date and time as a QString.
Definition: Application.cpp:818
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
static void Log(PvlGroup &results)
Writes Pvl results to sessionlog and printfile.
Definition: Application.cpp:369
static QString HostName()
Returns the host name.
Definition: Application.cpp:841
~Application()
Destroys the Application object.
Definition: Application.cpp:179
static bool p_applicationForceGuiApp
Definition: Application.h:133
Container for cube-like labels.
Definition: Pvl.h:135
PvlObject History()
Creates an application history PvlObject.
Definition: Application.cpp:267
static QString UserName()
Returns the user name.
Definition: Application.cpp:832
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Command Line and Xml loader, validation, and access.
Definition: UserInterface.h:155
Application(int &argc, char *argv[])
Constuctor for the Application object.
Definition: Application.cpp:80
int Run(void(*funct)())
Runs the program defined in the function funct.
Definition: Application.cpp:193
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
void RegisterGuiHelpers(std::map< QString, void *> helpers)
Definition: Application.h:138
void * GetGuiHelper(QString helper)
Definition: Application.h:145
Gui for Isis Applications.
Definition: Gui.h:90