Isis 3 Programmer Reference
|
#include <Application.h>
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 UserInterface & | GetUserInterface () |
Returns the UserInterface object. | |
static void | Log (PvlGroup &results) |
Writes Pvl results to sessionlog and printfile. | |
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 | 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 |
UserInterface * | p_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 |
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.
Isis::Application::Application | ( | int & | argc, |
char * | argv[] ) |
Constuctor for the Application object.
argc | Number of arguments in argv[]. This must be passed by reference!! |
*argv[] | An array containing the command line arguments |
Isis::iException::Io | - FileOpen error |
Definition at line 63 of file Application.cpp.
References DateTime(), DirectIO(), Isis::FileName::expanded(), Isis::FileName::fileExists(), Isis::Message::FileOpen(), GetUserInterface(), Isis::IException::Io, Isis::UserInterface::IsInteractive(), m_connectTime, Isis::FileName::name(), p_ui, PageFaults(), ProcessSwaps(), Isis::toString(), and UserName().
Isis::Application::~Application | ( | ) |
PvlGroup Isis::Application::Accounting | ( | ) |
Creates accounting PvlGroup.
Definition at line 280 of file Application.cpp.
References m_connectTime.
|
static |
Returns the date and time as a QString.
*curtime |
Definition at line 802 of file Application.cpp.
Referenced by Application(), Isis::ControlNet::ControlNet(), Isis::ControlMeasure::GetDateTime(), History(), Isis::ProcessExportPds4::identificationArea(), Run(), and Isis::ControlMeasure::SetDateTime().
|
private |
Returns the current number of I/O's.
Definition at line 325 of file Application.cpp.
Referenced by Application(), and Run().
|
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 536 of file Application.cpp.
References GetEnviromentInfo(), Isis::UserInterface::GetInfoFileName(), Isis::UserInterface::GetInfoFlag(), GetLibraryDependencies(), GetSystemDiskSpace(), GetUnameInfo(), HasParent(), Isis::IException::Io, Isis::UserInterface::IsInteractive(), Isis::Gui::Log(), p_ui, SendParentData(), and Isis::UserInterface::TheGui().
Referenced by Run(), and Isis::Gui::StartProcess().
|
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.
e | The Isis::iException |
Definition at line 626 of file Application.cpp.
References GetEnviromentInfo(), Isis::UserInterface::GetInfoFileName(), Isis::UserInterface::GetInfoFlag(), GetLibraryDependencies(), GetSystemDiskSpace(), GetUnameInfo(), HasParent(), Isis::IException::Io, Isis::UserInterface::IsInteractive(), Isis::Gui::LoadMessage(), p_ui, SendParentErrors(), and Isis::UserInterface::TheGui().
Referenced by Run(), and Isis::Gui::StartProcess().
|
staticprivate |
Runs some printenv commands that return Isis related Enviroment Variables.
Definition at line 924 of file Application.cpp.
References Isis::FileName::createTempFile(), and Isis::ProgramLauncher::RunSystemCommand().
Referenced by FunctionCleanup(), and FunctionError().
|
staticinherited |
variable | The environment variable to get |
defaultValue | The returned value for variable if variable doesn't exist. |
Definition at line 92 of file Environment.cpp.
Referenced by Isis::Environment::hostName(), and Isis::Environment::userName().
|
inline |
helper |
Definition at line 129 of file Application.h.
Referenced by Isis::Gui::InvokeHelper().
|
staticprivate |
Runs ldd on linux and sun and otool on macs to get information about the applicaiton run.
Definition at line 993 of file Application.cpp.
References Isis::FileName::createTempFile(), and Isis::ProgramLauncher::RunSystemCommand().
Referenced by FunctionCleanup(), and FunctionError().
|
staticprivate |
Runs df to see the disk space availability.
Definition at line 966 of file Application.cpp.
References Isis::FileName::createTempFile(), and Isis::ProgramLauncher::RunSystemCommand().
Referenced by FunctionCleanup(), and FunctionError().
|
staticprivate |
Runs various system specific uname commands and returns the results.
Definition at line 844 of file Application.cpp.
References Isis::FileName::createTempFile(), and Isis::ProgramLauncher::RunSystemCommand().
Referenced by FunctionCleanup(), and FunctionError().
|
static |
Returns the UserInterface object.
Definition at line 463 of file Application.cpp.
References p_ui.
Referenced by Isis::PipelineApplication::AddParameter(), Isis::PipelineApplication::AddParameter(), Application(), Isis::ProcessByQuickFilter::GetFilterParameters(), GuiLog(), GuiLog(), GuiLog(), Isis::Gui::InvokeHelper(), Log(), Isis::Gui::ResetParameters(), SendParentData(), Isis::Process::SetInputCube(), Isis::Pipeline::SetInputFile(), Isis::Pipeline::SetInputFile(), Isis::Pipeline::SetInputListFile(), Isis::ProcessExport::SetInputRange(), Isis::ProcessImport::SetOutputCube(), Isis::Process::SetOutputCube(), Isis::ProcessMosaic::SetOutputCube(), Isis::Process::SetOutputCubeStretch(), Isis::Pipeline::SetOutputFile(), Isis::Pipeline::SetOutputListFile(), Isis::ProcessPolygons::SetStatCubes(), Isis::ProcessGroundPolygons::SetStatCubes(), Isis::ProcessGroundPolygons::SetStatCubes(), Isis::Gui::ShowWarning(), Isis::Gui::StartProcess(), Isis::Gui::StopProcessing(), Isis::Gui::UpdateCommandLine(), and Isis::Gui::UpdateHistory().
|
static |
Writes the Pvl results to the sessionlog, but not to the printfile.
results | Pvl containing the results to add to the session log |
Definition at line 395 of file Application.cpp.
References GetUserInterface(), HasParent(), and SendParentData().
Referenced by Isis::ProgramLauncher::ProcessIsisMessageFromChild(), and Isis::GuiCubeParameter::ViewLabel().
|
static |
Writes the PvlGroup results to the sessionlog, but not to the printfile.
results | PvlGroup containing the results to add to the session log |
Definition at line 420 of file Application.cpp.
References GetUserInterface(), HasParent(), and SendParentData().
|
static |
Writes the results to the sessionlog, but not to the printfile.
results | QString containing the results to add to the session log |
Definition at line 445 of file Application.cpp.
References GetUserInterface(), HasParent(), and SendParentData().
void Isis::Application::GuiReportError | ( | IException & | e | ) |
Loads the error message into the gui, but does not write it to the session log.
e | The Isis::iException |
Definition at line 708 of file Application.cpp.
References Isis::Gui::LoadMessage(), p_ui, Isis::Gui::ProgressText(), Isis::Gui::ShowWarning(), and Isis::UserInterface::TheGui().
Referenced by Isis::Gui::InvokeHelper(), Isis::GuiCubeParameter::ViewCube(), and Isis::GuiCubeParameter::ViewLabel().
|
static |
Returns whether the application has a parent or not.
Definition at line 472 of file Application.cpp.
References p_ui, and Isis::UserInterface::ParentId().
Referenced by FunctionCleanup(), FunctionError(), GuiLog(), GuiLog(), GuiLog(), Log(), SendParentErrors(), UpdateProgress(), and UpdateProgress().
PvlObject Isis::Application::History | ( | ) |
Creates an application history PvlObject.
Definition at line 250 of file Application.cpp.
References Isis::PvlObject::addGroup(), IsisAml::Brief(), IsisAml::CommandLine(), DateTime(), HostName(), Isis::UserInterface::IsInteractive(), m_connectTime, p_ui, IsisAml::ProgramName(), UserName(), Version(), and IsisAml::Version().
Referenced by Isis::History::AddEntry().
|
static |
Returns the host name.
Returns 'Unknown' if it cannot find the host name.
Definition at line 825 of file Application.cpp.
References Isis::Environment::hostName().
Referenced by History().
|
staticinherited |
Definition at line 80 of file Environment.cpp.
References Isis::Environment::getEnvironmentValue().
Referenced by HostName().
|
staticinherited |
Definition at line 108 of file Environment.cpp.
References Isis::IException::Programmer.
Referenced by Version().
|
static |
Writes Pvl results to sessionlog and printfile.
results | PvlGroup of results to add to the session log |
Definition at line 352 of file Application.cpp.
References GetUserInterface(), HasParent(), and SendParentData().
Referenced by Isis::PvlObject::addLogGroup(), Isis::BundleAdjust::iterationSummary(), and Isis::ProgramLauncher::ProcessIsisMessageFromChild().
|
static |
Returns the name of the application.
Returns 'Unknown' if the application or gui equal NULL
Definition at line 729 of file Application.cpp.
Referenced by Isis::ControlMeasure::GetChooserName(), Isis::ProcessExportPds4::identificationArea(), and Isis::IException::toPvl().
|
private |
Returns the current number of faults.
Definition at line 334 of file Application.cpp.
Referenced by Application(), and Run().
|
private |
Processes the gui events.
If the event is cancel, it throws a cancel exception
Isis::iException::Cancel | - The event was cancelled |
Definition at line 786 of file Application.cpp.
References Isis::UserInterface::IsInteractive(), p_ui, Isis::Gui::ProcessEvents(), and Isis::UserInterface::TheGui().
Referenced by Isis::Progress::CheckStatus(), and UpdateProgress().
|
private |
Returns the current number of swaps.
Definition at line 343 of file Application.cpp.
Referenced by Application(), and Run().
|
inline |
helpers |
Definition at line 122 of file Application.h.
int Isis::Application::Run | ( | void(*)() | funct | ) |
Runs the program defined in the function funct.
*funct |
Definition at line 176 of file Application.cpp.
References Isis::UserInterface::AbortOnError(), Isis::UserInterface::BatchListSize(), DateTime(), DirectIO(), Isis::Gui::Exec(), FunctionCleanup(), FunctionError(), Isis::UserInterface::IsInteractive(), m_connectTime, p_ui, PageFaults(), ProcessSwaps(), Isis::UserInterface::SaveHistory(), Isis::UserInterface::SetBatchList(), Isis::UserInterface::SetErrorList(), Isis::UserInterface::TheGui(), and IsisAml::VerifyAll().
|
private |
code | |
message |
Definition at line 500 of file Application.cpp.
References GetUserInterface(), Isis::toString(), and Isis::IException::Unknown.
Referenced by FunctionCleanup(), GuiLog(), GuiLog(), GuiLog(), Log(), SendParentErrors(), UpdateProgress(), and UpdateProgress().
|
private |
Sends errors to the parent.
&errors | A PvlObject of the errors |
Definition at line 484 of file Application.cpp.
References Isis::PvlObject::group(), Isis::PvlObject::groups(), HasParent(), and SendParentData().
Referenced by FunctionError().
|
inlineprivate |
p_connection |
Definition at line 182 of file Application.h.
|
private |
Updates the progress bar in the gui.
text | Progress text |
Definition at line 740 of file Application.cpp.
References HasParent(), Isis::UserInterface::IsInteractive(), p_ui, ProcessGuiEvents(), IsisAml::ProgramName(), Isis::Gui::ProgressText(), SendParentData(), and Isis::UserInterface::TheGui().
Referenced by Isis::Progress::CheckStatus(), and Isis::ProgramLauncher::ProcessIsisMessageFromChild().
|
private |
Updates the progress bar percent.
percent | The percent of the application that is complete |
Definition at line 762 of file Application.cpp.
References HasParent(), Isis::UserInterface::IsInteractive(), p_ui, Isis::Gui::Progress(), SendParentData(), Isis::UserInterface::TheGui(), and Isis::toString().
|
static |
Returns the user name.
Returns 'Unknown' if it cannot find the user name.
Definition at line 816 of file Application.cpp.
References Isis::Environment::userName().
Referenced by Isis::QnetTool::addMeasure(), Application(), Isis::ControlPointEditWidget::createControlPoint(), Isis::QnetTool::createFixedPoint(), Isis::QnetTool::createPoint(), Isis::StereoTool::createPoint(), Isis::MatchTool::createPoint(), History(), Isis::ControlPointEditWidget::measureSaved(), Isis::MatchTool::measureSaved(), Isis::QnetTool::measureSaved(), Isis::QnetFileTool::open(), Isis::SocketThread::run(), Isis::ProgramLauncher::RunIsisProgram(), Isis::ControlMeasureEditWidget::saveMeasure(), and Isis::ControlPointEdit::saveMeasure().
|
staticinherited |
@Returns the user name.
Returns 'Unknown' if it cannot find the user name.
Definition at line 72 of file Environment.cpp.
References Isis::Environment::getEnvironmentValue().
Referenced by Isis::Project::clear(), Isis::Project::Project(), and UserName().
|
static |
The Isis Version for this application.
Definition at line 834 of file Application.cpp.
References Isis::Environment::isisVersion().
Referenced by History(), and Isis::ProcessExportPds4::identificationArea().
|
friend |
Definition at line 169 of file Application.h.
|
friend |
Definition at line 174 of file Application.h.
|
friend |
Definition at line 173 of file Application.h.
|
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.
|
private |
Used to calculate program's run time.
Definition at line 151 of file Application.h.
Referenced by Accounting(), Application(), History(), and Run().
|
static |
Definition at line 117 of file Application.h.
|
staticprivate |
Definition at line 190 of file Application.h.
|
private |
Definition at line 143 of file Application.h.
|
private |
Definition at line 157 of file Application.h.
|
private |
Definition at line 156 of file Application.h.
|
private |
Definition at line 148 of file Application.h.
|
private |
Definition at line 152 of file Application.h.
|
private |
Definition at line 189 of file Application.h.
|
private |
Definition at line 188 of file Application.h.
|
private |
Definition at line 150 of file Application.h.
|
private |
Definition at line 153 of file Application.h.
|
private |
Definition at line 154 of file Application.h.
|
private |
Definition at line 155 of file Application.h.
|
private |
Definition at line 149 of file Application.h.
|
private |
Pointer to a User Interface object.
Definition at line 159 of file Application.h.
Referenced by Application(), FunctionCleanup(), FunctionError(), GetUserInterface(), GuiReportError(), HasParent(), History(), ProcessGuiEvents(), Run(), UpdateProgress(), UpdateProgress(), and ~Application().