2012-03-31 15:18:09 +02:00
|
|
|
#ifndef I2_COMPONENT_H
|
|
|
|
#define I2_COMPONENT_H
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
class Component : public Object
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
Application::WeakRefType m_Application;
|
2012-03-31 16:03:42 +02:00
|
|
|
ConfigObject::RefType m_Config;
|
2012-03-31 15:18:09 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
typedef shared_ptr<Component> RefType;
|
|
|
|
typedef weak_ptr<Component> WeakRefType;
|
|
|
|
|
2012-03-31 16:03:42 +02:00
|
|
|
void SetApplication(const Application::WeakRefType& application);
|
2012-03-31 15:18:09 +02:00
|
|
|
Application::RefType GetApplication(void);
|
|
|
|
|
2012-03-31 16:03:42 +02:00
|
|
|
void SetConfig(ConfigObject::RefType componentConfig);
|
|
|
|
ConfigObject::RefType GetConfig(void);
|
|
|
|
|
2012-03-31 15:18:09 +02:00
|
|
|
virtual string GetName(void) = 0;
|
2012-03-31 16:03:42 +02:00
|
|
|
virtual void Start(void) = 0;
|
2012-03-31 15:18:09 +02:00
|
|
|
virtual void Stop(void) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define EXPORT_COMPONENT(klass) \
|
|
|
|
extern "C" I2_EXPORT icinga::Component *CreateComponent(void) \
|
|
|
|
{ \
|
|
|
|
return new klass(); \
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* I2_COMPONENT_H */
|