4
* Copyright (C) 2010 Eric Day (eday@oddments.org)
7
* Use and distribution licensed under the BSD license. See the
8
* COPYING file in the root project directory for full text.
13
* @brief Kernel Declarations
16
#ifndef SCALESTACK_KERNEL_H
17
#define SCALESTACK_KERNEL_H
22
#include <ScaleStack/Common.h>
29
class SCALESTACK_API Kernel
34
* Constructor to use without argc/argv options.
39
* Constructor to use when argc and argv from main() should be available
42
* @param[in] argc_arg Argument count.
43
* @param[in] argv_arg Array of argument values.
45
Kernel(int argc_arg, char** argv_arg);
50
* Get argc and argv that may have been passed in during construction.
52
* @param[out] argc_arg Argument count.
53
* @param[out] argv_arg Array of argument values.
55
void getArgcArgv(int* argc_arg, char***argv_arg) const;
58
* Add a module to the kernel. If a module by the name already exists,
59
* a ModuleExists exception is throw.
61
* @param[in] module_name Name of the module to add. This is used in
62
* constructing the path of the module to load.
63
* @return Reference to module that was added.
65
Module& addModule(const std::string& module_name);
68
* Get a module that has been added to the kernel, or throw ModuleNotFound.
70
* @param[in] module_name Name of the module to look for. This is used to
71
* check both the name and canonical name.
72
* @return Reference to module that was found.
74
Module& getModule(const std::string& module_name) const;
77
* Get a module that has been added to the kernel if it exists, and if not,
80
* @param[in] module_name Name of the module to look for or add.
81
* @return Reference to module that was requested.
83
Module& getOrAddModule(const std::string& module_name);
86
* This is the main loop of the kernel and will continue running until
87
* all modules have been removed, a shutdown request is received, or an
88
* uncaught exception is throw.
95
* Don't allow copying or assignment of objects.
97
Kernel(const Kernel&);
98
Kernel& operator=(const Kernel&);
101
* Add a module, used by public functions.
103
* @param[in] module_name Name of the module to load.
104
* @return Pointer to module that was added.
106
Module* _addModule(const std::string& module_name);
109
* Get a module, used by public functions.
111
* @param[in] module_name Name of the module to look for. This is used to
112
* check both the name and canonical name.
113
* @return Pointer to module that was found.
115
Module* _getModule(const std::string& module_name) const;
119
std::vector<Module*> modules;
122
ScaleStackException(ModuleExists);
123
ScaleStackException(ModuleNotFound);
125
} /* namespace ScaleStack */
127
#endif /* SCALESTACK_KERNEL_H */