#ifndef COMPONENTLOADER_H #define COMPONENTLOADER_H #include "plugable.h" /// Helper for loading and maintaining Project2 components class ComponentLoader { public: virtual ~ComponentLoader() = 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 }; typedef PluginsSameBase Components; #define DECLARE_COMPONENT(Id, Inst) \ static void init_optionsSource_##Type() __attribute__ ((constructor(200))); \ static void init_optionsSource_##Type() { Components::Add(Id, new Inst()); } \ static void kill_optionsSource_##Type() __attribute__ ((destructor(200))); \ static void kill_optionsSource_##Type() { Components::Remove(Id); } #endif