mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-04 12:17:37 +01:00
Add getter for an Application's list of Subsystems
This commit is contained in:
@@ -86,6 +86,8 @@ class Util_API Application: public Subsystem
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<std::string> ArgVec;
|
typedef std::vector<std::string> ArgVec;
|
||||||
|
typedef Poco::AutoPtr<Subsystem> SubsystemPtr;
|
||||||
|
typedef std::vector<SubsystemPtr> SubsystemVec;
|
||||||
|
|
||||||
enum ExitCode
|
enum ExitCode
|
||||||
/// Commonly used exit status codes.
|
/// Commonly used exit status codes.
|
||||||
@@ -218,6 +220,9 @@ public:
|
|||||||
/// Throws a NotFoundException if such a subsystem has
|
/// Throws a NotFoundException if such a subsystem has
|
||||||
/// not been registered.
|
/// not been registered.
|
||||||
|
|
||||||
|
SubsystemVec& subsystems();
|
||||||
|
/// Returns a reference to the subsystem list
|
||||||
|
|
||||||
virtual int run();
|
virtual int run();
|
||||||
/// Runs the application by performing additional (un)initializations
|
/// Runs the application by performing additional (un)initializations
|
||||||
/// and calling the main() method.
|
/// and calling the main() method.
|
||||||
@@ -367,8 +372,6 @@ private:
|
|||||||
void processOptions();
|
void processOptions();
|
||||||
bool findAppConfigFile(const std::string& appName, const std::string& extension, Poco::Path& path) const;
|
bool findAppConfigFile(const std::string& appName, const std::string& extension, Poco::Path& path) const;
|
||||||
|
|
||||||
typedef Poco::AutoPtr<Subsystem> SubsystemPtr;
|
|
||||||
typedef std::vector<SubsystemPtr> SubsystemVec;
|
|
||||||
typedef Poco::AutoPtr<LayeredConfiguration> ConfigPtr;
|
typedef Poco::AutoPtr<LayeredConfiguration> ConfigPtr;
|
||||||
|
|
||||||
ConfigPtr _pConfig;
|
ConfigPtr _pConfig;
|
||||||
@@ -410,6 +413,11 @@ template <class C> C& Application::getSubsystem() const
|
|||||||
throw Poco::NotFoundException("The subsystem has not been registered", typeid(C).name());
|
throw Poco::NotFoundException("The subsystem has not been registered", typeid(C).name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Application::SubsystemVec& Application::subsystems()
|
||||||
|
{
|
||||||
|
return _subsystems;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Application::initialized() const
|
inline bool Application::initialized() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ public:
|
|||||||
Subsystem();
|
Subsystem();
|
||||||
/// Creates the Subsystem.
|
/// Creates the Subsystem.
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const char* name() const = 0;
|
virtual const char* name() const = 0;
|
||||||
/// Returns the name of the subsystem.
|
/// Returns the name of the subsystem.
|
||||||
/// Must be implemented by subclasses.
|
/// Must be implemented by subclasses.
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual void initialize(Application& app) = 0;
|
virtual void initialize(Application& app) = 0;
|
||||||
/// Initializes the subsystem.
|
/// Initializes the subsystem.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user