1 #ifndef BASE_APPLICATION_CLASS
2 #define BASE_APPLICATION_CLASS
5 // Name : base_application
6 // Author : Chris Koeritz
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.
19 #include <basis/contracts.h>
20 #include <loggers/logging_macros.h>
22 namespace application {
24 //! Provides a base object for the root application portion of a program.
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.
31 class base_application : public virtual basis::nameable
34 virtual const char *class_name() const = 0; // must be provided by implementor.
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. */
46 //! This is an example usage of the base_application class...
47 class example_application : public base_application
50 example_application() : base_application() {}
51 DEFINE_CLASS_NAME("example_application");
52 int execute() { /* do stuff and return final exit value. */ }
55 //! This is a sample main application for a console mode program...
56 int __example__main(int argc, char *argv[])
58 example_application root_program;
59 return root_program.execute();
62 #endif // example guard.
66 #endif // outer guard.