Isis 3 Programmer Reference
Application.h
1 #ifndef Application_h
2 #define Application_h
3 
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 <QTime>
22 #include <string>
23 #include <ctime>
24 
25 #include "Pvl.h"
26 #include "UserInterface.h"
27 
28 class QLocalSocket;
29 
30 namespace 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)());
108  PvlObject History();
109 
111  static void Log(PvlGroup &results);
112  static void GuiLog(const Pvl &results);
113  static void GuiLog(const PvlGroup &results);
114  static void GuiLog(const QString &results);
115  static QString Name();
116 
117  static bool p_applicationForceGuiApp;
118 
122  void RegisterGuiHelpers(std::map<QString, void *> helpers) {
123  p_guiHelpers = helpers;
124  };
125 
129  void *GetGuiHelper(QString helper) {
130  return p_guiHelpers[helper];
131  };
132 
133  void GuiReportError(IException &e);
134 
135  static QString UserName();
136  static QString HostName();
137  static QString DateTime(time_t *curtime = 0);
138  static QString Version();
139 
140  static bool HasParent();
141 
142  private:
143  int p_BatchlistPass;
144  int DirectIO();
145  int PageFaults();
146  int ProcessSwaps();
147 
148  QLocalSocket *p_connectionToParent;
149  time_t p_startTime;
150  clock_t p_startClock;
152  QString p_datetime;
153  int p_startDirectIO;
154  int p_startPageFaults;
155  int p_startProcessSwaps;
156  pid_t p_childPid;
157  bool p_childCaught;
158 
160 
161  void SendParentData(QString, const QString &);
162  void SendParentErrors(PvlObject &errors);
163 
164  static PvlGroup GetUnameInfo();
165  static PvlGroup GetEnviromentInfo();
166  static QString GetSystemDiskSpace();
167  static QString GetLibraryDependencies(QString file);
168 
169  friend class Gui;
170  void FunctionCleanup();
171  int FunctionError(IException &e);
172 
173  friend class Progress;
174  friend class ProgramLauncher;
175  void UpdateProgress(const QString &text, bool print);
176  void UpdateProgress(int percent, bool print);
177  void ProcessGuiEvents();
178 
182  void SetParentConnection(QLocalSocket *p_connection) {
183  p_connectionToParent = p_connection;
184  }
185  void EstablishConnections();
186  void WaitForCommand(int childSocket);
187 
188  pid_t p_pid;
189  std::map<QString, void *> p_guiHelpers;
190  static QString p_appName;
191 
192  };
193 
194  extern Application *iApp;
195 };
196 
197 #endif
Isis::Application::Accounting
PvlGroup Accounting()
Creates accounting PvlGroup.
Definition: Application.cpp:281
Isis::Application
Definition: Application.h:101
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::ProgramLauncher
Execute External Programs and Commands.
Definition: ProgramLauncher.h:34
Isis::Application::HasParent
static bool HasParent()
Returns whether the application has a parent or not.
Definition: Application.cpp:472
Isis::Application::GetLibraryDependencies
static QString GetLibraryDependencies(QString file)
Runs ldd on linux and sun and otool on macs to get information about the applicaiton run.
Definition: Application.cpp:993
Isis::Application::GuiLog
static void GuiLog(const Pvl &results)
Writes the Pvl results to the sessionlog, but not to the printfile.
Definition: Application.cpp:395
Isis::Application::SendParentErrors
void SendParentErrors(PvlObject &errors)
Sends errors to the parent.
Definition: Application.cpp:484
Isis::Environment
Definition: Environment.h:36
Isis::Application::SendParentData
void SendParentData(QString, const QString &)
Definition: Application.cpp:500
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::Application::m_connectTime
QTime m_connectTime
Used to calculate program's run time.
Definition: Application.h:151
Isis::Application::RegisterGuiHelpers
void RegisterGuiHelpers(std::map< QString, void * > helpers)
Definition: Application.h:122
Isis::Gui
Gui for Isis Applications.
Definition: Gui.h:73
Isis::Application::GetUserInterface
static UserInterface & GetUserInterface()
Returns the UserInterface object.
Definition: Application.cpp:463
Isis::Application::GetSystemDiskSpace
static QString GetSystemDiskSpace()
Runs df to see the disk space availability.
Definition: Application.cpp:966
Isis::Application::Version
static QString Version()
The Isis Version for this application.
Definition: Application.cpp:834
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::Application::GetUnameInfo
static PvlGroup GetUnameInfo()
Runs various system specific uname commands and returns the results.
Definition: Application.cpp:844
Isis::Application::GuiReportError
void GuiReportError(IException &e)
Loads the error message into the gui, but does not write it to the session log.
Definition: Application.cpp:708
Isis::Application::p_ui
UserInterface * p_ui
Pointer to a User Interface object.
Definition: Application.h:159
Isis::Application::Name
static QString Name()
Returns the name of the application.
Definition: Application.cpp:729
Isis::Application::FunctionCleanup
void FunctionCleanup()
Cleans up after the function by writing the log, saving the history, and either sending the log to th...
Definition: Application.cpp:536
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Application::Run
int Run(void(*funct)())
Runs the program defined in the function funct.
Definition: Application.cpp:177
Isis::Progress
Program progress reporter.
Definition: Progress.h:42
Isis::Application::Application
Application(int &argc, char *argv[])
Constuctor for the Application object.
Definition: Application.cpp:64
Isis::Application::ProcessGuiEvents
void ProcessGuiEvents()
Processes the gui events.
Definition: Application.cpp:786
Isis::Application::~Application
~Application()
Destroys the Application object.
Definition: Application.cpp:163
Isis::Application::GetGuiHelper
void * GetGuiHelper(QString helper)
Definition: Application.h:129
Isis::Application::UpdateProgress
void UpdateProgress(const QString &text, bool print)
Updates the progress bar in the gui.
Definition: Application.cpp:740
Isis::UserInterface
Command Line and Xml loader, validation, and access.
Definition: UserInterface.h:140
Isis::Application::ProcessSwaps
int ProcessSwaps()
Returns the current number of swaps.
Definition: Application.cpp:344
Isis::Application::Log
static void Log(PvlGroup &results)
Writes Pvl results to sessionlog and printfile.
Definition: Application.cpp:353
Isis::Application::GetEnviromentInfo
static PvlGroup GetEnviromentInfo()
Runs some printenv commands that return Isis related Enviroment Variables.
Definition: Application.cpp:924
Isis::Application::FunctionError
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...
Definition: Application.cpp:626
Isis::Application::UserName
static QString UserName()
Returns the user name.
Definition: Application.cpp:816
Isis::Application::DateTime
static QString DateTime(time_t *curtime=0)
Returns the date and time as a QString.
Definition: Application.cpp:802
Isis::Application::PageFaults
int PageFaults()
Returns the current number of faults.
Definition: Application.cpp:335
Isis::Application::DirectIO
int DirectIO()
Returns the current number of I/O's.
Definition: Application.cpp:326
Isis::Application::SetParentConnection
void SetParentConnection(QLocalSocket *p_connection)
Definition: Application.h:182
Isis::Application::History
PvlObject History()
Creates an application history PvlObject.
Definition: Application.cpp:251
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Application::HostName
static QString HostName()
Returns the host name.
Definition: Application.cpp:825