first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / library / application / base_application.h
1 #ifndef BASE_APPLICATION_CLASS
2 #define BASE_APPLICATION_CLASS
3
4 //////////////
5 // Name   : base_application
6 // Author : Chris Koeritz
7 //////////////
8 // Copyright (c) 2000-$now By Author.  This program is free software; you can
9 // redistribute it and/or modify it under the terms of the GNU General Public
10 // License as published by the Free Software Foundation:
11 //     http://www.gnu.org/licenses/gpl.html
12 // or under the terms of the GNU Library license:
13 //     http://www.gnu.org/licenses/lgpl.html
14 // at your preference.  Those licenses describe your legal rights to this
15 // software, and no other rights or warranties apply.
16 // Please send updates for this code to: fred@gruntose.com -- Thanks, fred.
17 //////////////
18
19 #include <basis/contracts.h>
20 #include <loggers/logging_macros.h>
21
22 namespace application {
23
24 //! Provides a base object for the root application portion of a program.
25 /*!
26   This mainly defines an entry point into the application's real functionality.
27   Derived versions of the base_application can layer in more functionality as
28   appropriate for different types of applications.
29 */
30
31 class base_application : public virtual basis::nameable
32 {
33 public:
34   virtual const char *class_name() const = 0;  // must be provided by implementor.
35
36   virtual int execute() = 0;
37     //!< performs the main activity of this particular application object.
38     /*!< the method must be overridden by the derived object.  a return value
39     for the program as a whole should be returned. */
40 };
41
42 //////////////
43
44 #if 0
45
46 //! This is an example usage of the base_application class...
47 class example_application : public base_application
48 {
49 public:
50   example_application() : base_application() {}
51   DEFINE_CLASS_NAME("example_application");
52   int execute() { /* do stuff and return final exit value. */ }
53 };
54
55 //! This is a sample main application for a console mode program...
56 int __example__main(int argc, char *argv[])
57 {
58   example_application root_program;
59   return root_program.execute();
60 }
61
62 #endif // example guard.
63
64 } //namespace.
65
66 #endif // outer guard.
67