|
Isis 3.0 Object Programmers' Reference |
Home |
#include <Application.h>
Collaboration diagram for Isis::Application:

For internal use only.
Definition at line 79 of file Application.h.
Public Member Functions | |
| Application (int argc, char *argv[]) | |
| Constuctor for the Application object . | |
| ~Application () | |
| Destroys the Application object. | |
| int | Exec (void(*funct)()) |
| Executes a function. | |
| PvlGroup | Accounting () |
| Creates accounting PvlGroup. | |
| PvlObject | History () |
| Creates an application history PvlObject. | |
| void | RegisterGuiHelpers (std::map< std::string, void * > helpers) |
| void * | GetGuiHelper (std::string helper) |
| void | GuiReportError (Isis::iException &e) |
| Loads the error message into the gui, but does not write it to the session log. | |
| void | Exec (const std::string &program, const std::string ¶meters) |
| Executes the program passed in with the given string of parameters. | |
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 (Pvl &results) |
| Writes the Pvl results to the sessionlog, but not to the printfile. | |
| static void | GuiLog (PvlGroup &results) |
| Writes the PvlGroup results to the sessionlog, but not to the printfile. | |
| static void | GuiLog (std::string &results) |
| Writes the results to the sessionlog, but not to the printfile. | |
| static std::string | Name () |
| static std::string | UserName () |
| Returns the user name. | |
| static std::string | HostName () |
| Returns the host name. | |
| static std::string | DateTime (time_t *curtime=0) |
| Returns the date and time as a string. | |
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 | SendParentErrors (Isis::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 (Isis::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 std::string &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 | ParentFork (const std::string &command, const std::string &program) |
| void | ChildFork (const std::string &command) |
| Runs the entered command line and returns the status to the parent. | |
| void | EstablishConnections () |
| Establishes a connection by creating a new socket, getting the process id number and creating a unique filename that it binds to the socket. | |
| void | WaitForCommand (int childSocket) |
| Trys to accept a connection from the child socket. | |
Static Private Member Functions | |
| static bool | HasParent () |
| Returns whether the application has a parent or not. | |
| static void | SendParentData (const std::string code, const std::string &message) |
Private Attributes | |
| int | p_BatchlistPass |
| time_t | p_startTime |
| clock_t | p_startClock |
| std::string | p_datetime |
| int | p_startDirectIO |
| int | p_startPageFaults |
| int | p_startProcessSwaps |
| UserInterface * | p_ui |
| Pointer to a User Interface object. | |
| int | p_socket |
| pid_t | p_pid |
| std::string | p_buffer |
| std::string | p_socketFile |
| sockaddr_un | p_socketName |
| std::vector< std::string > | p_queue |
| std::map< std::string, void * > | p_guiHelpers |
Static Private Attributes | |
| static int | p_childSocket = -1 |
| Sends data from the child to the parent. | |
| static QString | p_appName |
| Returns the name of the application. | |
Friends | |
| class | Gui |
| class | Progress |
| Isis::Application::Application | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Constuctor for the Application object .
| argc | Number of arguments in argv[] | |
| *argv[] | An array containing the command line arguments |
| Isis::iException::Io | - FileOpen error |
Definition at line 60 of file Application.cpp.
References _FILEINFO_, DateTime(), DirectIO(), e, Isis::Filename::Exists(), Isis::Filename::Expanded(), Isis::Message::FileOpen(), Isis::iApp, Isis::UserInterface::IsInteractive(), Isis::iException::Message(), Isis::Filename::Name(), p_appName, p_BatchlistPass, p_childSocket, p_datetime, p_socket, p_socketFile, p_startClock, p_startDirectIO, p_startPageFaults, p_startProcessSwaps, p_startTime, p_ui, PageFaults(), Isis::Preference::Preferences(), and ProcessSwaps().
| Isis::Application::~Application | ( | ) |
Destroys the Application object.
Definition at line 115 of file Application.cpp.
References HasParent(), p_childSocket, p_socket, p_socketFile, p_ui, and SendParentData().
| PvlGroup Isis::Application::Accounting | ( | ) |
Creates accounting PvlGroup.
Definition at line 230 of file Application.cpp.
References p_startClock, and p_startTime.
| void Isis::Application::ChildFork | ( | const std::string & | commandLine | ) | [private] |
Runs the entered command line and returns the status to the parent.
| commandLine | The command line to be run |
Definition at line 848 of file Application.cpp.
References p_pid, and p_socket.
Referenced by Exec().
| std::string Isis::Application::DateTime | ( | time_t * | curtime = 0 |
) | [static] |
Returns the date and time as a string.
| *curtime |
Definition at line 1048 of file Application.cpp.
Referenced by Application(), and Exec().
| int Isis::Application::DirectIO | ( | ) | [private] |
Returns the current number of I/O's.
Definition at line 275 of file Application.cpp.
References p_startDirectIO.
Referenced by Application(), and Exec().
| void Isis::Application::EstablishConnections | ( | ) | [private] |
Establishes a connection by creating a new socket, getting the process id number and creating a unique filename that it binds to the socket.
It then sets up the socket to listen.
| Isis::iException::System | - Unable to create the socket | |
| Isis::iException::System | - Unable to bind the socket to the filename | |
| Isis::iException::System | - Unable to listen to the socket |
Definition at line 815 of file Application.cpp.
References _FILEINFO_, Isis::iException::Message(), p_pid, p_socket, p_socketFile, and p_socketName.
Referenced by Exec().
| void Isis::Application::Exec | ( | const std::string & | program, | |
| const std::string & | parameters | |||
| ) |
Executes the program passed in with the given string of parameters.
| &program | The program name to be run | |
| ¶meters | A string of the parameters and their values to be run with the application name passed in |
| Isis::iException::System | - Unable to execute the command |
Definition at line 764 of file Application.cpp.
References _FILEINFO_, bin, ChildFork(), EstablishConnections(), HasParent(), Isis::UserInterface::IsInteractive(), Isis::iException::Message(), p_childSocket, p_pid, p_ui, ParentFork(), Isis::UserInterface::ParentId(), ProcessGuiEvents(), SendParentData(), and Isis::System().
| int Isis::Application::Exec | ( | void(*)() | funct | ) |
Executes a function.
| *funct |
Definition at line 138 of file Application.cpp.
References _FILEINFO_, Isis::UserInterface::AbortOnError(), Isis::UserInterface::BatchListSize(), DateTime(), DirectIO(), e, Isis::Gui::Exec(), FunctionCleanup(), FunctionError(), Isis::UserInterface::IsInteractive(), p_BatchlistPass, p_datetime, p_startClock, p_startDirectIO, p_startPageFaults, p_startProcessSwaps, p_startTime, p_ui, PageFaults(), ProcessSwaps(), Isis::UserInterface::SaveHistory(), Isis::UserInterface::SetBatchList(), Isis::UserInterface::SetErrorList(), Isis::UserInterface::TheGui(), Isis::SessionLog::TheLog(), and IsisAml::VerifyAll().
Referenced by main(), Isis::Cube::ReformatOldIsisLabel(), and Isis::Pipeline::Run().
| 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 496 of file Application.cpp.
References _FILEINFO_, Isis::CubeManager::CleanUp(), Isis::GetEnviromentInfo(), Isis::UserInterface::GetInfoFileName(), Isis::UserInterface::GetInfoFlag(), Isis::GetLibraryDependencies(), Isis::GetUnameInfo(), HasParent(), Isis::UserInterface::IsInteractive(), Isis::Gui::Log(), Isis::iException::Message(), p_appName, p_BatchlistPass, p_ui, Isis::Preference::Preferences(), SendParentData(), Isis::Gui::ShowLog(), ss, Isis::SystemDiskSpace(), Isis::UserInterface::TheGui(), Isis::SessionLog::TheLog(), and Isis::SessionLog::Write().
Referenced by Exec(), and Isis::Gui::StartProcess().
| int Isis::Application::FunctionError | ( | Isis::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.
| e | The Isis::iException |
Definition at line 582 of file Application.cpp.
References _FILEINFO_, Isis::SessionLog::AddError(), e, Isis::GetEnviromentInfo(), Isis::UserInterface::GetInfoFileName(), Isis::UserInterface::GetInfoFlag(), Isis::GetLibraryDependencies(), Isis::GetUnameInfo(), HasParent(), Isis::UserInterface::IsInteractive(), Isis::Gui::LoadMessage(), Isis::iException::Message(), p_appName, p_BatchlistPass, p_ui, Isis::Preference::Preferences(), SendParentErrors(), ss, Isis::SystemDiskSpace(), Isis::UserInterface::TheGui(), Isis::SessionLog::TheLog(), and Isis::SessionLog::Write().
Referenced by Exec(), and Isis::Gui::StartProcess().
| Isis::UserInterface & Isis::Application::GetUserInterface | ( | ) | [static] |
Returns the UserInterface object.
Definition at line 405 of file Application.cpp.
References Isis::iApp, and p_ui.
Referenced by Isis::Gui::AboutProgram(), Isis::PipelineApplication::AddParameter(), Isis::ProcessByQuickFilter::GetFilterParameters(), GuiLog(), Isis::Gui::InvokeHelper(), Log(), Isis::Gui::ResetParameters(), SendParentData(), Isis::Process::SetInputCube(), Isis::Pipeline::SetInputFile(), Isis::Pipeline::SetInputListFile(), Isis::ProcessExport::SetInputRange(), Isis::ProcessPolygons::SetOutputCube(), Isis::ProcessMosaic::SetOutputCube(), Isis::ProcessImport::SetOutputCube(), Isis::ProcessGroundPolygons::SetOutputCube(), Isis::Process::SetOutputCube(), Isis::Pipeline::SetOutputFile(), Isis::Pipeline::SetOutputListFile(), Isis::Gui::ShowWarning(), Isis::Gui::StartProcess(), Isis::Gui::StopProcessing(), Isis::Gui::UpdateCommandLine(), and Isis::Gui::UpdateHistory().
| void Isis::Application::GuiLog | ( | std::string & | results | ) | [static] |
Writes the results to the sessionlog, but not to the printfile.
| results | string containing the results to add to the session log |
Definition at line 387 of file Application.cpp.
References GetUserInterface(), HasParent(), Isis::iApp, Isis::UserInterface::IsInteractive(), Isis::Gui::Log(), SendParentData(), Isis::Gui::ShowLog(), and Isis::UserInterface::TheGui().
| void Isis::Application::GuiLog | ( | PvlGroup & | results | ) | [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 364 of file Application.cpp.
References GetUserInterface(), HasParent(), Isis::iApp, Isis::UserInterface::IsInteractive(), Isis::Gui::Log(), SendParentData(), Isis::Gui::ShowLog(), and Isis::UserInterface::TheGui().
| void Isis::Application::GuiLog | ( | Pvl & | results | ) | [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 341 of file Application.cpp.
References GetUserInterface(), HasParent(), Isis::iApp, Isis::UserInterface::IsInteractive(), Isis::Gui::Log(), SendParentData(), Isis::Gui::ShowLog(), and Isis::UserInterface::TheGui().
Referenced by Isis::GuiCubeParameter::ViewLabel().
| void Isis::Application::GuiReportError | ( | Isis::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 668 of file Application.cpp.
References e, 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().
| bool Isis::Application::HasParent | ( | ) | [static, private] |
Returns whether the application has a parent or not.
Definition at line 414 of file Application.cpp.
References Isis::iApp, p_ui, and Isis::UserInterface::ParentId().
Referenced by Exec(), FunctionCleanup(), FunctionError(), GuiLog(), Log(), UpdateProgress(), and ~Application().
| PvlObject Isis::Application::History | ( | ) |
Creates an application history PvlObject.
Definition at line 206 of file Application.cpp.
References IsisAml::Brief(), IsisAml::CommandLine(), HostName(), p_datetime, p_ui, IsisAml::ProgramName(), pvl(), UserName(), IsisAml::Version(), and Isis::version().
Referenced by Isis::History::AddEntry().
| std::string Isis::Application::HostName | ( | ) | [static] |
Returns the host name.
Returns 'Unknown' if it cannot find the host name.
Definition at line 1074 of file Application.cpp.
Referenced by History().
| void Isis::Application::Log | ( | PvlGroup & | results | ) | [static] |
Writes Pvl results to sessionlog and printfile.
| results | PvlGroup of results to add to the session log |
Definition at line 302 of file Application.cpp.
References Isis::SessionLog::AddResults(), GetUserInterface(), HasParent(), Isis::iApp, Isis::UserInterface::IsInteractive(), Isis::Gui::Log(), SendParentData(), Isis::Gui::ShowLog(), Isis::UserInterface::TheGui(), and Isis::SessionLog::TheLog().
Referenced by Isis::BundleAdjust::IterationSummary().
| int Isis::Application::PageFaults | ( | ) | [private] |
Returns the current number of faults.
Definition at line 284 of file Application.cpp.
References p_startPageFaults.
Referenced by Application(), and Exec().
| void Isis::Application::ParentFork | ( | const std::string & | command, | |
| const std::string & | program | |||
| ) | [private] |
| &command | The command to run | |
| &program | The program name currently running |
| Isis::iException::System | - Unable to execute the command | |
| Isis::iException::System | - Unknown command on the socket |
Definition at line 909 of file Application.cpp.
References _FILEINFO_, g, Isis::Gui::Log(), Isis::iException::Message(), p_buffer, p_queue, p_socket, p_socketFile, p_socketName, p_ui, ProcessGuiEvents(), Isis::Gui::Progress(), Isis::Gui::ProgressText(), str, Isis::UserInterface::TheGui(), ToInteger(), and WaitForCommand().
Referenced by Exec().
| void Isis::Application::ProcessGuiEvents | ( | ) | [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 745 of file Application.cpp.
References _FILEINFO_, Isis::UserInterface::IsInteractive(), Isis::iException::Message(), p_ui, Isis::Gui::ProcessEvents(), and Isis::UserInterface::TheGui().
Referenced by Isis::Progress::CheckStatus(), Exec(), and ParentFork().
| int Isis::Application::ProcessSwaps | ( | ) | [private] |
Returns the current number of swaps.
Definition at line 293 of file Application.cpp.
References p_startProcessSwaps.
Referenced by Application(), and Exec().
| void Isis::Application::SendParentErrors | ( | Isis::PvlObject & | errors | ) | [private] |
Sends errors to the parent.
| &errors | A PvlObject of the errors |
Definition at line 426 of file Application.cpp.
References Isis::PvlObject::Group(), Isis::PvlObject::Groups(), and SendParentData().
Referenced by FunctionError().
| void Isis::Application::UpdateProgress | ( | int | percent, | |
| bool | ||||
| ) | [private] |
Updates the progress bar percent.
| percent | The percent of the application that is complete | |
Definition at line 724 of file Application.cpp.
References HasParent(), Isis::UserInterface::IsInteractive(), p_ui, Isis::Gui::Progress(), SendParentData(), and Isis::UserInterface::TheGui().
| void Isis::Application::UpdateProgress | ( | const std::string & | text, | |
| bool | ||||
| ) | [private] |
Updates the progress bar in the gui.
| text | Progress text | |
Definition at line 705 of file Application.cpp.
References HasParent(), Isis::UserInterface::IsInteractive(), p_ui, IsisAml::ProgramName(), Isis::Gui::ProgressText(), SendParentData(), and Isis::UserInterface::TheGui().
Referenced by Isis::Progress::CheckStatus().
| std::string Isis::Application::UserName | ( | ) | [static] |
Returns the user name.
Returns 'Unknown' if it cannot find the user name.
Definition at line 1062 of file Application.cpp.
Referenced by History(), Qisis::SocketThread::run(), and Isis::ControlMeasure::SetChooserName().
| void Isis::Application::WaitForCommand | ( | int | childSocket | ) | [private] |
Trys to accept a connection from the child socket.
When it does accept the connection it receives the command from the child and pushes it into a buffer which is then pushed onto the queue.
| childSocket | The child socket to establish connection to |
| Isis::iException::System | - Unable to read from the socket |
Definition at line 1019 of file Application.cpp.
References _FILEINFO_, Isis::iException::Message(), p_buffer, p_queue, p_socketFile, and pos.
Referenced by ParentFork().
QString Isis::Application::p_appName [static, private] |
Returns the name of the application.
Returns 'Unknown' if the application or gui equal NULL
Definition at line 148 of file Application.h.
Referenced by Application(), FunctionCleanup(), FunctionError(), and Name().
int Isis::Application::p_childSocket = -1 [static, private] |
Sends data from the child to the parent.
| code | ||
| &message | The message the child is sending to the parent |
| Isis::iException::System | - Unable to connect to the parent | |
| Isis::iException::System | - Unable to send to the parent |
Definition at line 140 of file Application.h.
Referenced by Application(), Exec(), SendParentData(), and ~Application().
UserInterface* Isis::Application::p_ui [private] |
Pointer to a User Interface object.
Definition at line 119 of file Application.h.
Referenced by Application(), Exec(), FunctionCleanup(), FunctionError(), GetUserInterface(), GuiReportError(), HasParent(), History(), ParentFork(), ProcessGuiEvents(), UpdateProgress(), and ~Application().