feisty meow concerns codebase 2.140
application_shell.h
Go to the documentation of this file.
1#ifndef APPLICATION_SHELL_CLASS
2#define APPLICATION_SHELL_CLASS
3
4/*****************************************************************************\
5* *
6* Name : application_shell *
7* Author : Chris Koeritz *
8* *
9*******************************************************************************
10* Copyright (c) 2000-$now By Author. This program is free software; you can *
11* redistribute it and/or modify it under the terms of the GNU General Public *
12* License as published by the Free Software Foundation; either version 2 of *
13* the License or (at your option) any later version. This is online at: *
14* http://www.fsf.org/copyleft/gpl.html *
15* Please send any updates to: fred@gruntose.com *
16\*****************************************************************************/
17
18#include "base_application.h"
19
20#include <basis/contracts.h>
21#include <mathematics/chaos.h>
22
23namespace application {
24
26
33{
34public:
37
38 virtual ~application_shell();
39
40 DEFINE_CLASS_NAME("application_shell")
41
44
50 virtual int execute_application();
52
55 int exit_value() const { return c_exit_value; }
57
58 const mathematics::chaos &randomizer() const { return c_rando; }
60
61// static basis::astring application_name();
63
64// static basis::u_int process_id();
66
67// static basis::astring current_directory();
69
70 virtual basis::outcome log(const basis::base_string &to_print, int filter = basis::ALWAYS_PRINT);
72
76#ifdef __UNIX__
77// static basis::astring get_cmdline_from_proc();
79// static basis::astring query_for_process_info();
81#endif
82
83protected:
84 virtual int execute() = 0;
86
89private:
90 mathematics::chaos c_rando;
91 int c_exit_value;
92
93 // not applicable.
95 application_shell &operator =(const application_shell &);
96};
97
98} //namespace.
99
100#endif // outer guard.
101
The application_shell is a base object for console programs.
int exit_value() const
once the application has finished executing, this will contain the exit value.
virtual int execute()=0
< retrieves the command line from the /proc hierarchy on linux.
application_shell()
constructs an application_shell to serve as the root of the program.
virtual int execute_application()
runs the base class's execute() method and catches any exceptions due to it.
virtual basis::outcome log(const basis::base_string &to_print, int filter=basis::ALWAYS_PRINT)
< returns the full name of the current application.
static application_shell * single_instance()
in a program with a single application_shell extant, this gives out the instance.
const mathematics::chaos & randomizer() const
provides access to the random number generator owned by this app.
Provides a base object for the root application portion of a program.
Defines the base class for all string processing objects in hoople.
Definition base_string.h:28
Outcomes describe the state of completion for an operation.
Definition outcome.h:31
a platform-independent way to acquire random numbers in a specific range.
Definition chaos.h:51
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
Definition enhance_cpp.h:42
Implements an application lock to ensure only one is running at once.