Isis 3 Programmer 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 
133  static bool p_applicationForceGuiApp;
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;
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 
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
void FunctionCleanup()
Cleans up after the function by writing the log, saving the history, and either sending the log to th...
QTime m_connectTime
Used to calculate program&#39;s run time.
Definition: Application.h:167
static UserInterface & GetUserInterface()
Returns the UserInterface object.
static bool HasParent()
Returns whether the application has a parent or not.
void SendParentErrors(PvlObject &errors)
Sends errors to the parent.
void GuiReportError(IException &e)
Loads the error message into the gui, but does not write it to the session log.
UserInterface * p_ui
Pointer to a User Interface object.
Definition: Application.h:175
void SetParentConnection(QLocalSocket *p_connection)
Definition: Application.h:198
static QString Version()
The Isis Version for this application.
static QString Name()
Returns the name of the application.
Execute External Programs and Commands.
PvlGroup Accounting()
Creates accounting PvlGroup.
void SendParentData(QString, const QString &)
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.
static PvlGroup GetEnviromentInfo()
Runs some printenv commands that return Isis related Enviroment Variables.
static QString DateTime(time_t *curtime=0)
Returns the date and time as a QString.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
static void Log(PvlGroup &results)
Writes Pvl results to sessionlog and printfile.
static QString GetSystemDiskSpace()
Runs df to see the disk space availability.
static QString GetLibraryDependencies(QString file)
Runs ldd on linux and sun and otool on macs to get information about the applicaiton run...
static QString HostName()
Returns the host name.
~Application()
Destroys the Application object.
int DirectIO()
Returns the current number of I/O&#39;s.
Container for cube-like labels.
Definition: Pvl.h:135
int FunctionError(IException &e)
Adds the error to the session log, sends the error to the parent if it has one, loads the error messa...
int PageFaults()
Returns the current number of faults.
void ProcessGuiEvents()
Processes the gui events.
PvlObject History()
Creates an application history PvlObject.
static QString UserName()
Returns the user name.
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.
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.
static PvlGroup GetUnameInfo()
Runs various system specific uname commands and returns the results.
void UpdateProgress(const QString &text, bool print)
Updates the progress bar in the gui.
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
void RegisterGuiHelpers(std::map< QString, void *> helpers)
Definition: Application.h:138
int ProcessSwaps()
Returns the current number of swaps.
void * GetGuiHelper(QString helper)
Definition: Application.h:145
Gui for Isis Applications.
Definition: Gui.h:90