File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
Isis::Application Class Reference

#include <Application.h>

Inheritance diagram for Isis::Application:
Inheritance graph
Collaboration diagram for Isis::Application:
Collaboration graph

Public Member Functions

 Application (int &argc, char *argv[])
 Constuctor for the Application object.
 
 ~Application ()
 Destroys the Application object.
 
int Run (void(*funct)())
 Runs the program defined in the function funct.
 
PvlGroup Accounting ()
 Creates accounting PvlGroup.
 
PvlObject History ()
 Creates an application history PvlObject.
 
void RegisterGuiHelpers (std::map< QString, void * > helpers)
 
void * GetGuiHelper (QString helper)
 
void GuiReportError (IException &e)
 Loads the error message into the gui, but does not write it to the session log.
 

Static Public Member Functions

static UserInterfaceGetUserInterface ()
 Returns the UserInterface object.
 
static void Log (PvlGroup &results)
 Writes Pvl results to sessionlog and printfile.
 
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 command line)
 
static void GuiLog (const Pvl &results)
 Writes the Pvl results to the sessionlog, but not to the printfile.
 
static void GuiLog (const PvlGroup &results)
 Writes the PvlGroup results to the sessionlog, but not to the printfile.
 
static void GuiLog (const QString &results)
 Writes the results to the sessionlog, but not to the printfile.
 
static QString Name ()
 Returns the name of the application.
 
static QString formatError (IException &e)
 
static QString UserName ()
 Returns the user name.
 
static QString HostName ()
 Returns the host name.
 
static QString DateTime (time_t *curtime=0)
 Returns the date and time as a QString.
 
static QString Version ()
 The Isis Version for this application.
 
static bool HasParent ()
 Returns whether the application has a parent or not.
 
static QString userName ()
 @Returns the user name.
 
static QString hostName ()
 
static QString isisVersion ()
 
static QString getEnvironmentValue (QString, QString)
 

Static Public Attributes

static bool p_applicationForceGuiApp = false
 

Private Member Functions

int DirectIO ()
 Returns the current number of I/O's.
 
int PageFaults ()
 Returns the current number of faults.
 
int ProcessSwaps ()
 Returns the current number of swaps.
 
void SendParentData (QString, const QString &)
 
void SendParentErrors (PvlObject &errors)
 Sends errors to the parent.
 
void FunctionCleanup ()
 Cleans up after the function by writing the log, saving the history, and either sending the log to the parent if it has one, printing the log data to the terminal or showing the log in the gui.
 
int FunctionError (IException &e)
 Adds the error to the session log, sends the error to the parent if it has one, loads the error message into the gui or prints it to the command line, gets the error type and returns it.
 
void UpdateProgress (const QString &text, bool print)
 Updates the progress bar in the gui.
 
void UpdateProgress (int percent, bool print)
 Updates the progress bar percent.
 
void ProcessGuiEvents ()
 Processes the gui events.
 
void SetParentConnection (QLocalSocket *p_connection)
 
void EstablishConnections ()
 
void WaitForCommand (int childSocket)
 

Static Private Member Functions

static PvlGroup GetUnameInfo ()
 Runs various system specific uname commands and returns the results.
 
static PvlGroup GetEnviromentInfo ()
 Runs some printenv commands that return Isis related Enviroment Variables.
 
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.
 

Private Attributes

int p_BatchlistPass
 
QLocalSocket * p_connectionToParent
 
time_t p_startTime
 
clock_t p_startClock
 
QElapsedTimer m_connectTime
 Used to calculate program's run time.
 
QString p_datetime
 
int p_startDirectIO
 
int p_startPageFaults
 
int p_startProcessSwaps
 
pid_t p_childPid
 
bool p_childCaught
 
UserInterfacep_ui
 Pointer to a User Interface object.
 
pid_t p_pid
 
std::map< QString, void * > p_guiHelpers
 

Static Private Attributes

static QString p_appName
 
static Environment automaticEnvironmentSetup
 Construct an environment in static space to initialize some global Isis environment options.
 

Friends

class Gui
 
class Progress
 
class ProgramLauncher
 

Detailed Description

Author
????-??-?? Unknown
History

2005-12-16 Elizabeth Miller - Added documentation and -BATCHLIST capabilities

2006-02-13 Elizabeth Miller - Added GuiHelper Capabilities

2006-02-16 Jeff Anderson - Fixed race condition on sockets between communicating ISIS programs

2006-02-17 Fixed bug with application name being unknown if the user interface threw an error

2006-02-27 Elizabeth Miller - Added GuiLog and GuiReportError methods

2006-07-28 Jeff Anderson - Fixed another race condition with sockets between communicating ISIS programs. Also updated progress to output name of the program

2006-08-30 Jeff Anderson - Create a QCoreApplication if in command line mode.

2007-10-04 Steven Koechle - Added output capability for debugging log for -info flag

2008-01-04 Jeannie Walldren - Changed description of Log method

2008-01-09 Steven Lambright - Fixed Memory Leak

2008-04-16 Steven Lambright - Added parameter check that was removed from UserInterface

2008-06-18 Christopher Austin - Fixed documentation error

2008-06-19 Steven Lambright - Added CubeManager::CleanUp call to clean up cubes in memory after calling IsisMain.

2008-06-24 Steven Koechle - Added Preferences to Debugging Log.

2008-07-08 Steven Lambright - Singletons now destroy themselves instead of Application deleting them

2008-07-08 Steven Lambright - p_ui is no longer static, which fixes issues with the mac unit tests.

2009-11-19 Kris Becker - Made argc pass by reference since Qt's QApplication/QCoreApplication requires it

2010-03-17 Stuart Sides - Added the location of the Qt plugins into the library path

2010-06-29 Steven Lambright - Added a setlocale to english for numeric values

2010-11-29 Steven Lambright - Added the Version() method

2010-11-30 Steven Lambright - Merged some of the the "System" functions' functionality. Moved some of the inter-process communication to ProgramLauncher.

2011-03-01 Steven Lambright - Fixed Version method

2011-04-01 Eric Hyer - Now inherits from Environment

2011-07-12 Sharmila Prasad - Fixed bug in "ExecutionDateTime" keyword

2011-08-19 Jeannie Backer - Modified unitTest to use $temporary variable instead of /tmp directory. Added some documentation to methods.

2013-02-28 Janet Barrett - Needed to instantiate a QApplication in the constructor instead of a QCoreApplication so that Qt Gui is accessible by the command line. Also needed to define a compiler directive, USE_GUI_QAPP, to bypass a problem the Macs have with using QApplication. References #575.

2016-08-15 Adam Paquette - Reset locale after QApplication or QCoreApplication are instantiated. Fixes #3908.

2017-06-08 Christopher Combs - Changed object used to calculate connectTime from a time_t to a QTime. Fixes #4618.

Definition at line 101 of file Application.h.

Constructor & Destructor Documentation

◆ Application()

Isis::Application::Application ( int & argc,
char * argv[] )

Constuctor for the Application object.

Parameters
argcNumber of arguments in argv[]. This must be passed by reference!!
*argv[]An array containing the command line arguments
Exceptions
Isis::iException::Io- FileOpen error

Definition at line 58 of file Application.cpp.

References DateTime(), DirectIO(), Isis::IException::errorType(), Isis::FileName::expanded(), Isis::FileName::fileExists(), Isis::Message::FileOpen(), GetUserInterface(), Isis::IException::Io, m_connectTime, Isis::FileName::name(), p_ui, PageFaults(), Isis::IException::print(), ProcessSwaps(), Isis::toString(), and UserName().

◆ ~Application()

Isis::Application::~Application ( )

Destroys the Application object.

Definition at line 157 of file Application.cpp.

References p_ui.

Member Function Documentation

◆ Accounting()

PvlGroup Isis::Application::Accounting ( )

Creates accounting PvlGroup.

Returns
PvlGroup Accounting Group

Definition at line 275 of file Application.cpp.

References m_connectTime.

◆ AppendAndLog()

void Isis::Application::AppendAndLog ( PvlGroup & results,
Pvl * log )
static

Writes the pvl group results to both a passed in Pvl log and the applications log (either GUI or command line)

Parameters
resultsPvl containing the results to add to the session log
logApp log for running in code

Definition at line 393 of file Application.cpp.

References Isis::PvlObject::addGroup(), and Log().

◆ DateTime()

QString Isis::Application::DateTime ( time_t * curtime = 0)
static

Returns the date and time as a QString.

Parameters
*curtime
Returns
QString The date and time

Definition at line 841 of file Application.cpp.

Referenced by Application(), Isis::ControlNet::ControlNet(), Isis::ControlMeasure::GetDateTime(), History(), Isis::ProcessExportPds4::identificationArea(), Run(), and Isis::ControlMeasure::SetDateTime().

◆ DirectIO()

int Isis::Application::DirectIO ( )
private

Returns the current number of I/O's.

Returns
int The current number of I/O's

Definition at line 320 of file Application.cpp.

Referenced by Application(), and Run().

◆ formatError()

QString Isis::Application::formatError ( IException & e)
static

Definition at line 738 of file Application.cpp.

◆ FunctionCleanup()

void Isis::Application::FunctionCleanup ( )
private

Cleans up after the function by writing the log, saving the history, and either sending the log to the parent if it has one, printing the log data to the terminal or showing the log in the gui.

Definition at line 546 of file Application.cpp.

References GetEnviromentInfo(), GetLibraryDependencies(), GetSystemDiskSpace(), GetUnameInfo(), HasParent(), Isis::IException::Io, and p_ui.

Referenced by Run().

◆ FunctionError()

int Isis::Application::FunctionError ( IException & e)
private

Adds the error to the session log, sends the error to the parent if it has one, loads the error message into the gui or prints it to the command line, gets the error type and returns it.

Parameters
eThe Isis::iException
Returns
int The Error Type

Definition at line 636 of file Application.cpp.

References Isis::IException::errorType(), GetEnviromentInfo(), GetLibraryDependencies(), GetSystemDiskSpace(), GetUnameInfo(), Isis::PvlObject::group(), Isis::PvlObject::groups(), HasParent(), Isis::IException::Io, Isis::PvlContainer::isNamed(), Name(), p_ui, SendParentErrors(), and Isis::IException::toPvl().

Referenced by Run().

◆ GetEnviromentInfo()

PvlGroup Isis::Application::GetEnviromentInfo ( )
staticprivate

Runs some printenv commands that return Isis related Enviroment Variables.

Returns
PvlGroup containing Enviroment information
Todo
Replace printenv commands with c library getenv

Definition at line 963 of file Application.cpp.

References Isis::PvlContainer::addKeyword(), Isis::FileName::createTempFile(), Isis::FileName::expanded(), and Isis::ProgramLauncher::RunSystemCommand().

Referenced by FunctionCleanup(), and FunctionError().

◆ getEnvironmentValue()

QString Isis::Environment::getEnvironmentValue ( QString variable,
QString defaultValue )
staticinherited
Parameters
variableThe environment variable to get
defaultValueThe returned value for variable if variable doesn't exist.
Returns
The value for the environment variable requested.

Definition at line 92 of file Environment.cpp.

Referenced by hostName(), and userName().

◆ GetGuiHelper()

void * Isis::Application::GetGuiHelper ( QString helper)
inline
Parameters
helper

Definition at line 131 of file Application.h.

◆ GetLibraryDependencies()

QString Isis::Application::GetLibraryDependencies ( QString file)
staticprivate

Runs ldd on linux and sun and otool on macs to get information about the applicaiton run.

Returns
QString containing application information

Definition at line 1032 of file Application.cpp.

References Isis::FileName::createTempFile(), Isis::FileName::expanded(), and Isis::ProgramLauncher::RunSystemCommand().

Referenced by FunctionCleanup(), and FunctionError().

◆ GetSystemDiskSpace()

QString Isis::Application::GetSystemDiskSpace ( )
staticprivate

Runs df to see the disk space availability.

Returns
QString containing df results

Definition at line 1005 of file Application.cpp.

References Isis::FileName::createTempFile(), Isis::FileName::expanded(), and Isis::ProgramLauncher::RunSystemCommand().

Referenced by FunctionCleanup(), and FunctionError().

◆ GetUnameInfo()

PvlGroup Isis::Application::GetUnameInfo ( )
staticprivate

Runs various system specific uname commands and returns the results.

Returns
PvlGroup containing uname information

Definition at line 883 of file Application.cpp.

References Isis::PvlContainer::addKeyword(), Isis::FileName::createTempFile(), Isis::FileName::expanded(), and Isis::ProgramLauncher::RunSystemCommand().

Referenced by FunctionCleanup(), and FunctionError().

◆ GetUserInterface()

◆ GuiLog() [1/3]

void Isis::Application::GuiLog ( const Pvl & results)
static

Writes the Pvl results to the sessionlog, but not to the printfile.

Parameters
resultsPvl containing the results to add to the session log

Definition at line 405 of file Application.cpp.

References HasParent().

Referenced by Isis::GuiCubeParameter::ViewLabel().

◆ GuiLog() [2/3]

void Isis::Application::GuiLog ( const PvlGroup & results)
static

Writes the PvlGroup results to the sessionlog, but not to the printfile.

Parameters
resultsPvlGroup containing the results to add to the session log

Definition at line 430 of file Application.cpp.

References HasParent().

◆ GuiLog() [3/3]

void Isis::Application::GuiLog ( const QString & results)
static

Writes the results to the sessionlog, but not to the printfile.

Parameters
resultsQString containing the results to add to the session log

Definition at line 455 of file Application.cpp.

References HasParent().

◆ GuiReportError()

void Isis::Application::GuiReportError ( IException & e)

Loads the error message into the gui, but does not write it to the session log.

Parameters
eThe Isis::iException

Definition at line 724 of file Application.cpp.

References p_ui.

◆ HasParent()

bool Isis::Application::HasParent ( )
static

Returns whether the application has a parent or not.

Returns
bool Returns true if it has a parent, and false if it does not

Definition at line 482 of file Application.cpp.

Referenced by FunctionCleanup(), FunctionError(), GuiLog(), GuiLog(), GuiLog(), Log(), SendParentErrors(), UpdateProgress(), and UpdateProgress().

◆ History()

PvlObject Isis::Application::History ( )

Creates an application history PvlObject.

Returns
PvlObject

Definition at line 245 of file Application.cpp.

References Isis::PvlObject::addGroup(), DateTime(), Isis::PvlObject::findGroup(), HostName(), m_connectTime, p_ui, UserName(), and Version().

◆ HostName()

QString Isis::Application::HostName ( )
static

Returns the host name.

Returns 'Unknown' if it cannot find the host name.

Returns
QString Host Name

Definition at line 864 of file Application.cpp.

References Isis::Environment::hostName().

Referenced by History().

◆ hostName()

QString Isis::Environment::hostName ( )
staticinherited
Returns
the host name. Returns 'Unknown' if it cannot find the host name.

Definition at line 80 of file Environment.cpp.

References getEnvironmentValue().

Referenced by Isis::Application::HostName().

◆ isisVersion()

QString Isis::Environment::isisVersion ( )
staticinherited
Returns
the Isis version in the format isis?.?.?.?qualifier | date

Definition at line 108 of file Environment.cpp.

References Isis::TextFile::GetLine(), and Isis::IException::Programmer.

Referenced by Isis::Application::Version().

◆ Log()

void Isis::Application::Log ( PvlGroup & results)
static

Writes Pvl results to sessionlog and printfile.

Parameters
resultsPvlGroup of results to add to the session log

Definition at line 347 of file Application.cpp.

References HasParent().

Referenced by AppendAndLog(), and Isis::BundleAdjust::iterationSummary().

◆ Name()

QString Isis::Application::Name ( )
static

Returns the name of the application.

Returns 'Unknown' if the application or gui equal NULL

Returns
QString The application name

Definition at line 768 of file Application.cpp.

Referenced by FunctionError(), Isis::ControlMeasure::GetChooserName(), Isis::ProcessExportPds4::identificationArea(), and Isis::IException::toPvl().

◆ PageFaults()

int Isis::Application::PageFaults ( )
private

Returns the current number of faults.

Returns
The current number of page faults

Definition at line 329 of file Application.cpp.

Referenced by Application(), and Run().

◆ ProcessGuiEvents()

void Isis::Application::ProcessGuiEvents ( )
private

Processes the gui events.

If the event is cancel, it throws a cancel exception

Exceptions
Isis::iException::Cancel- The event was cancelled

Definition at line 825 of file Application.cpp.

References p_ui.

Referenced by UpdateProgress().

◆ ProcessSwaps()

int Isis::Application::ProcessSwaps ( )
private

Returns the current number of swaps.

Returns
The current number of process swaps

Definition at line 338 of file Application.cpp.

Referenced by Application(), and Run().

◆ RegisterGuiHelpers()

void Isis::Application::RegisterGuiHelpers ( std::map< QString, void * > helpers)
inline
Parameters
helpers

Definition at line 124 of file Application.h.

◆ Run()

int Isis::Application::Run ( void(* funct )())

Runs the program defined in the function funct.

Parameters
*funct
Returns
int Status of the function execution

Definition at line 171 of file Application.cpp.

References DateTime(), DirectIO(), FunctionCleanup(), FunctionError(), m_connectTime, p_ui, PageFaults(), ProcessSwaps(), and Isis::IException::what().

◆ SendParentData()

void Isis::Application::SendParentData ( QString code,
const QString & message )
private
Parameters
code
message

Definition at line 510 of file Application.cpp.

References Isis::toString(), and Isis::IException::Unknown.

◆ SendParentErrors()

void Isis::Application::SendParentErrors ( Isis::PvlObject & errors)
private

Sends errors to the parent.

Parameters
&errorsA PvlObject of the errors

Definition at line 494 of file Application.cpp.

References Isis::PvlObject::group(), Isis::PvlObject::groups(), and HasParent().

Referenced by FunctionError().

◆ SetParentConnection()

void Isis::Application::SetParentConnection ( QLocalSocket * p_connection)
inlineprivate
Parameters
p_connection

Definition at line 184 of file Application.h.

◆ UpdateProgress() [1/2]

void Isis::Application::UpdateProgress ( const QString & text,
bool print )
private

Updates the progress bar in the gui.

Parameters
textProgress text
print

Definition at line 779 of file Application.cpp.

References HasParent(), p_ui, and ProcessGuiEvents().

◆ UpdateProgress() [2/2]

void Isis::Application::UpdateProgress ( int percent,
bool print )
private

Updates the progress bar percent.

Parameters
percentThe percent of the application that is complete
print

Definition at line 801 of file Application.cpp.

References HasParent(), p_ui, and Isis::toString().

◆ UserName()

◆ userName()

QString Isis::Environment::userName ( )
staticinherited

@Returns the user name.

Returns 'Unknown' if it cannot find the user name.

Definition at line 72 of file Environment.cpp.

References getEnvironmentValue().

Referenced by Isis::Project::clear(), Isis::Project::Project(), and Isis::Application::UserName().

◆ Version()

QString Isis::Application::Version ( )
static

The Isis Version for this application.

Returns
QString

Definition at line 873 of file Application.cpp.

References Isis::Environment::isisVersion().

Referenced by History(), and Isis::ProcessExportPds4::identificationArea().

Friends And Related Symbol Documentation

◆ Gui

friend class Gui
friend

Definition at line 171 of file Application.h.

◆ ProgramLauncher

friend class ProgramLauncher
friend

Definition at line 176 of file Application.h.

◆ Progress

friend class Progress
friend

Definition at line 175 of file Application.h.

Member Data Documentation

◆ automaticEnvironmentSetup

Environment Isis::Environment::automaticEnvironmentSetup
staticprivateinherited

Construct an environment in static space to initialize some global Isis environment options.

This initialization applies to anything that links against the Isis library.

Definition at line 55 of file Environment.h.

◆ m_connectTime

QElapsedTimer Isis::Application::m_connectTime
private

Used to calculate program's run time.

Definition at line 153 of file Application.h.

Referenced by Accounting(), Application(), History(), and Run().

◆ p_applicationForceGuiApp

bool Isis::Application::p_applicationForceGuiApp = false
static

Definition at line 119 of file Application.h.

◆ p_appName

QString Isis::Application::p_appName
staticprivate

Definition at line 192 of file Application.h.

◆ p_BatchlistPass

int Isis::Application::p_BatchlistPass
private

Definition at line 145 of file Application.h.

◆ p_childCaught

bool Isis::Application::p_childCaught
private

Definition at line 159 of file Application.h.

◆ p_childPid

pid_t Isis::Application::p_childPid
private

Definition at line 158 of file Application.h.

◆ p_connectionToParent

QLocalSocket* Isis::Application::p_connectionToParent
private

Definition at line 150 of file Application.h.

◆ p_datetime

QString Isis::Application::p_datetime
private

Definition at line 154 of file Application.h.

◆ p_guiHelpers

std::map<QString, void *> Isis::Application::p_guiHelpers
private

Definition at line 191 of file Application.h.

◆ p_pid

pid_t Isis::Application::p_pid
private

Definition at line 190 of file Application.h.

◆ p_startClock

clock_t Isis::Application::p_startClock
private

Definition at line 152 of file Application.h.

◆ p_startDirectIO

int Isis::Application::p_startDirectIO
private

Definition at line 155 of file Application.h.

◆ p_startPageFaults

int Isis::Application::p_startPageFaults
private

Definition at line 156 of file Application.h.

◆ p_startProcessSwaps

int Isis::Application::p_startProcessSwaps
private

Definition at line 157 of file Application.h.

◆ p_startTime

time_t Isis::Application::p_startTime
private

Definition at line 151 of file Application.h.

◆ p_ui

UserInterface* Isis::Application::p_ui
private

Pointer to a User Interface object.

Definition at line 161 of file Application.h.

Referenced by Application(), FunctionCleanup(), FunctionError(), GuiReportError(), History(), ProcessGuiEvents(), Run(), UpdateProgress(), UpdateProgress(), and ~Application().


The documentation for this class was generated from the following files: