Isis 3.0 Programmer Reference
Back | Home
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 <string>
38 #include <ctime>
39 
40 #include "Pvl.h"
41 #include "UserInterface.h"
42 
43 class QLocalSocket;
44 
45 namespace Isis {
46  class Gui;
47  class IException;
48  class Progress;
49 
114  class Application : public Environment {
115  public:
116  Application(int &argc, char *argv[]);
117  ~Application();
118 
119  int Run(void (*funct)());
121  PvlObject History();
122 
124  static void Log(PvlGroup &results);
125  static void GuiLog(const Pvl &results);
126  static void GuiLog(const PvlGroup &results);
127  static void GuiLog(const QString &results);
128  static QString Name();
129 
130  static bool p_applicationForceGuiApp;
131 
135  void RegisterGuiHelpers(std::map<QString, void *> helpers) {
136  p_guiHelpers = helpers;
137  };
138 
142  void *GetGuiHelper(QString helper) {
143  return p_guiHelpers[helper];
144  };
145 
146  void GuiReportError(IException &e);
147 
148  static QString UserName();
149  static QString HostName();
150  static QString DateTime(time_t *curtime = 0);
151  static QString Version();
152 
153  static bool HasParent();
154 
155  private:
156  int p_BatchlistPass;
157  int DirectIO();
158  int PageFaults();
159  int ProcessSwaps();
160 
161  QLocalSocket *p_connectionToParent;
162  time_t p_startTime;
163  clock_t p_startClock;
164  QString p_datetime;
165  int p_startDirectIO;
166  int p_startPageFaults;
167  int p_startProcessSwaps;
168  pid_t p_childPid;
169  bool p_childCaught;
170 
172 
173  void SendParentData(QString, const QString &);
174  void SendParentErrors(PvlObject &errors);
175 
176  static PvlGroup GetUnameInfo();
177  static PvlGroup GetEnviromentInfo();
178  static QString GetSystemDiskSpace();
179  static QString GetLibraryDependencies(QString file);
180 
181  friend class Gui;
182  void FunctionCleanup();
183  int FunctionError(IException &e);
184 
185  friend class Progress;
186  friend class ProgramLauncher;
187  void UpdateProgress(const QString &text, bool print);
188  void UpdateProgress(int percent, bool print);
189  void ProcessGuiEvents();
190 
194  void SetParentConnection(QLocalSocket *p_connection) {
195  p_connectionToParent = p_connection;
196  }
197  void EstablishConnections();
198  void WaitForCommand(int childSocket);
199 
200  pid_t p_pid;
201  std::map<QString, void *> p_guiHelpers;
202  static QString p_appName;
203 
204  };
205 
206  extern Application *iApp;
207 };
208 
209 #endif
void FunctionCleanup()
Cleans up after the function by writing the log, saving the history, and either sending the log to th...
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:171
void SetParentConnection(QLocalSocket *p_connection)
Definition: Application.h:194
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.
void RegisterGuiHelpers(std::map< QString, void * > helpers)
Definition: Application.h:135
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:99
Command Line and Xml loader, validation, and access.
Application(int &argc, char *argv[])
Constuctor for the Application object.
Definition: Application.cpp:79
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
int ProcessSwaps()
Returns the current number of swaps.
void * GetGuiHelper(QString helper)
Definition: Application.h:142
Gui for Isis Applications.
Definition: Gui.h:86

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:14:26