mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-11-03 19:40: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:
 | 
			
		||||
	typedef std::vector<std::string> ArgVec;
 | 
			
		||||
	typedef Poco::AutoPtr<Subsystem> SubsystemPtr;
 | 
			
		||||
	typedef std::vector<SubsystemPtr> SubsystemVec;
 | 
			
		||||
 | 
			
		||||
	enum ExitCode
 | 
			
		||||
		/// Commonly used exit status codes.
 | 
			
		||||
@@ -218,6 +220,9 @@ public:
 | 
			
		||||
		/// Throws a NotFoundException if such a subsystem has
 | 
			
		||||
		/// not been registered.
 | 
			
		||||
 | 
			
		||||
	SubsystemVec& subsystems();
 | 
			
		||||
		/// Returns a reference to the subsystem list
 | 
			
		||||
 | 
			
		||||
	virtual int run();
 | 
			
		||||
		/// Runs the application by performing additional (un)initializations
 | 
			
		||||
		/// and calling the main() method.
 | 
			
		||||
@@ -367,8 +372,6 @@ private:
 | 
			
		||||
	void processOptions();
 | 
			
		||||
	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;
 | 
			
		||||
 | 
			
		||||
	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());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline Application::SubsystemVec& Application::subsystems()
 | 
			
		||||
{
 | 
			
		||||
	return _subsystems;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
inline bool Application::initialized() const
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -53,11 +53,11 @@ public:
 | 
			
		||||
	Subsystem();
 | 
			
		||||
		/// Creates the Subsystem.
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	virtual const char* name() const = 0;
 | 
			
		||||
		/// Returns the name of the subsystem.
 | 
			
		||||
		/// Must be implemented by subclasses.
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	virtual void initialize(Application& app) = 0;
 | 
			
		||||
		/// Initializes the subsystem.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user