summaryrefslogtreecommitdiff
path: root/project2/common/lifeCycle.h
blob: 2a6b5b2fd4cb998c0322cd78e9431c3351ded7d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef LIFECYCLE_H
#define LIFECYCLE_H

#include <plugins.h>
#include <boost/function/function_fwd.hpp>

/// Helper for loading and maintaining Project2 components
class LifeCycle : public virtual AdHoc::AbstractPluginImplementation {
	public:
		virtual ~LifeCycle() = 0;

		virtual void onBegin();		// App engine start up (before settings are processed)
		virtual void onBefore();		// Before the app engine processes a request (after settings are processed)
		virtual void onIdle();		// When the app engine goes idle
		virtual void onIteration();	// When the app engine has completed an iteration
		virtual void onPeriodic();	// When the app engine feels like it
		virtual void onConfigLoad(); // When the environment reloads the configuration
		virtual bool cacheable() const { return true; } // The component can be cached for next run

		static void onAllComponents(const boost::function<void(LifeCycle *)> & func);
};
typedef AdHoc::PluginOf<LifeCycle> LifeCycleComponentPlugin;

#endif