Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
Application.h
1#ifndef Application_h
2#define Application_h
3
8
9/* SPDX-License-Identifier: CC0-1.0 */
10
11#include "Environment.h"
12
13#include <sys/types.h>
14#include <unistd.h>
15#include <sys/socket.h>
16#include <sys/un.h>
17
18#include <iostream>
19#include <fstream>
20#include <QString>
21#include <QElapsedTimer>
22#include <string>
23#include <ctime>
24
25#include "Pvl.h"
26#include "UserInterface.h"
27
28class QLocalSocket;
29
30namespace Isis {
31 class Gui;
32 class IException;
33 class Progress;
34
101 class Application : public Environment {
102 public:
103 Application(int &argc, char *argv[]);
104 ~Application();
105
106 int Run(void (*funct)());
107 PvlGroup Accounting();
108 PvlObject History();
109
111 static void Log(PvlGroup &results);
112 static void AppendAndLog(PvlGroup &results, Pvl *log);
113 static void GuiLog(const Pvl &results);
114 static void GuiLog(const PvlGroup &results);
115 static void GuiLog(const QString &results);
116 static QString Name();
117 static QString formatError(IException &e);
118
119 static bool p_applicationForceGuiApp;
120
124 void RegisterGuiHelpers(std::map<QString, void *> helpers) {
125 p_guiHelpers = helpers;
126 };
127
131 void *GetGuiHelper(QString helper) {
132 return p_guiHelpers[helper];
133 };
134
135 void GuiReportError(IException &e);
136
137 static QString UserName();
138 static QString HostName();
139 static QString DateTime(time_t *curtime = 0);
140 static QString Version();
141 static QString AleVersion();
142
143 static bool HasParent();
144
145 private:
146 int p_BatchlistPass;
147 int DirectIO();
148 int PageFaults();
149 int ProcessSwaps();
150
151 QLocalSocket *p_connectionToParent;
152 time_t p_startTime;
153 clock_t p_startClock;
154 QElapsedTimer m_connectTime;
155 QString p_datetime;
156 int p_startDirectIO;
157 int p_startPageFaults;
158 int p_startProcessSwaps;
159 pid_t p_childPid;
160 bool p_childCaught;
161
163
164 void SendParentData(QString, const QString &);
165 void SendParentErrors(PvlObject &errors);
166
167 static PvlGroup GetUnameInfo();
168 static PvlGroup GetEnviromentInfo();
169 static QString GetSystemDiskSpace();
170 static QString GetLibraryDependencies(QString file);
171
172 friend class Gui;
173 void FunctionCleanup();
174 int FunctionError(IException &e);
175
176 friend class Progress;
177 friend class ProgramLauncher;
178 void UpdateProgress(const QString &text, bool print);
179 void UpdateProgress(int percent, bool print);
180 void ProcessGuiEvents();
181
185 void SetParentConnection(QLocalSocket *p_connection) {
186 p_connectionToParent = p_connection;
187 }
188 void EstablishConnections();
189 void WaitForCommand(int childSocket);
190
191 pid_t p_pid;
192 std::map<QString, void *> p_guiHelpers;
193 static QString p_appName;
194
195 };
196
197 extern Application *iApp;
198};
199
200#endif
int Run(void(*funct)())
Runs the program defined in the function funct.
static QString DateTime(time_t *curtime=0)
Returns the date and time as a QString.
PvlObject History()
Creates an application history PvlObject.
void FunctionCleanup()
Cleans up after the function by writing the log, saving the history, and either sending the log to th...
static void Log(PvlGroup &results)
Writes Pvl results to sessionlog and printfile.
PvlGroup Accounting()
Creates accounting PvlGroup.
void SendParentData(QString, const QString &)
static QString AleVersion()
The Ale Version for this application.
static void GuiLog(const Pvl &results)
Writes the Pvl results to the sessionlog, but not to the printfile.
static QString HostName()
Returns the host name.
void GuiReportError(IException &e)
Loads the error message into the gui, but does not write it to the session log.
int DirectIO()
Returns the current number of I/O's.
QElapsedTimer m_connectTime
Used to calculate program's run time.
static QString Version()
The Isis Version for this application.
static QString Name()
Returns the name of the application.
void RegisterGuiHelpers(std::map< QString, void * > helpers)
int PageFaults()
Returns the current number of faults.
static void AppendAndLog(PvlGroup &results, Pvl *log)
Writes the pvl group results to both a passed in Pvl log and the applications log (either GUI or comm...
void ProcessGuiEvents()
Processes the gui events.
int ProcessSwaps()
Returns the current number of swaps.
static QString GetLibraryDependencies(QString file)
Runs ldd on linux and sun and otool on macs to get information about the applicaiton run.
static bool HasParent()
Returns whether the application has a parent or not.
static QString GetSystemDiskSpace()
Runs df to see the disk space availability.
void UpdateProgress(const QString &text, bool print)
Updates the progress bar in the gui.
void SendParentErrors(PvlObject &errors)
Sends errors to the parent.
UserInterface * p_ui
Pointer to a User Interface object.
static PvlGroup GetEnviromentInfo()
Returns ISIS-related Enviroment Variables.
static QString UserName()
Returns the user name.
void * GetGuiHelper(QString helper)
static UserInterface & GetUserInterface()
Returns the UserInterface object.
Application(int &argc, char *argv[])
Constuctor for the Application object.
void SetParentConnection(QLocalSocket *p_connection)
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...
~Application()
Destroys the Application object.
static PvlGroup GetUnameInfo()
Runs various system specific uname commands and returns the results.
Gui for Isis Applications.
Definition Gui.h:73
Program progress reporter.
Definition Progress.h:42
Command Line and Xml loader, validation, and access.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16