FreeNOS
Public Member Functions | Protected Member Functions | Private Attributes
POSIXApplication Class Reference

POSIX-compatible application. More...

#include <POSIXApplication.h>

Inheritance diagram for POSIXApplication:
Application BenchMark Cat CreateFile Decompress DhcpClient Echo FileStatus Hostname Init ListFiles Login MakeNode Mount MpiPing MpiProxy NetCat NetCtl NetPing NetSend ProcessList Remove Shell Shutdown SievePrime Sleep SysControl SysInfo UnixName

Public Member Functions

 POSIXApplication (int argc, char **argv)
 Class constructor. More...
 
virtual ~POSIXApplication ()
 Class destructor. More...
 
- Public Member Functions inherited from Application
 Application (int argc, char **argv)
 Class constructor. More...
 
virtual ~Application ()
 Class destructor. More...
 
virtual int run ()
 Run the application. More...
 

Protected Member Functions

virtual Result output (const char *string) const
 Print text to output. More...
 
int runProgram (const char *path, const char **argv)
 Runs an external program. More...
 
- Protected Member Functions inherited from Application
virtual Result initialize ()
 Initialize the application. More...
 
virtual Result exec ()=0
 Execute the application event loop. More...
 
virtual Result output (String &string) const
 Print string to output. More...
 
ArgumentParserparser ()
 Get program arguments parser. More...
 
const ArgumentParserparser () const
 Get constant program arguments parser. More...
 
const ArgumentContainerarguments () const
 Get program arguments. More...
 
void setVersion (const String &version)
 Set program version. More...
 

Private Attributes

StdioLog m_log
 Logs to standard output. More...
 

Additional Inherited Members

- Public Types inherited from Application
enum  Result {
  Success, NotFound, IOError, InvalidArgument,
  ShowUsage, TimedOut, OutOfMemory
}
 Result codes. More...
 
- Protected Attributes inherited from Application
int m_argc
 Input argument count. More...
 
char ** m_argv
 Input argument values. More...
 

Detailed Description

POSIX-compatible application.

Definition at line 35 of file POSIXApplication.h.

Constructor & Destructor Documentation

◆ POSIXApplication()

POSIXApplication::POSIXApplication ( int  argc,
char **  argv 
)

Class constructor.

Parameters
argcArgument count
argvArgument values

Definition at line 23 of file POSIXApplication.cpp.

References Application::setVersion().

◆ ~POSIXApplication()

POSIXApplication::~POSIXApplication ( )
virtual

Class destructor.

Definition at line 29 of file POSIXApplication.cpp.

Member Function Documentation

◆ output()

POSIXApplication::Result POSIXApplication::output ( const char *  string) const
protectedvirtual

Print text to output.

Parameters
stringText to print to program output.
Returns
Result code.

Implements Application.

Definition at line 33 of file POSIXApplication.cpp.

References printf(), and Application::Success.

Referenced by Decompress::decompressFile(), MpiPrime::exec(), and SievePrime::reportResult().

◆ runProgram()

int POSIXApplication::runProgram ( const char *  path,
const char **  argv 
)
protected

Runs an external program.

Parameters
pathFull path to the program to run
argvArray with arguments
Returns
Program ID on success or -1 on failure

Definition at line 39 of file POSIXApplication.cpp.

References ApplicationLauncher::exec(), ApplicationLauncher::getPid(), and ApplicationLauncher::Success.

Referenced by Init::exec(), and Shell::executeInput().

Field Documentation

◆ m_log

StdioLog POSIXApplication::m_log
private

Logs to standard output.

Definition at line 76 of file POSIXApplication.h.


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