icinga2/base/component.h

37 lines
769 B
C
Raw Normal View History

#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;
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);
Application::RefType GetApplication(void);
2012-03-31 16:03:42 +02:00
void SetConfig(ConfigObject::RefType componentConfig);
ConfigObject::RefType GetConfig(void);
virtual string GetName(void) = 0;
2012-03-31 16:03:42 +02:00
virtual void Start(void) = 0;
virtual void Stop(void) = 0;
};
#define EXPORT_COMPONENT(klass) \
extern "C" I2_EXPORT icinga::Component *CreateComponent(void) \
{ \
return new klass(); \
}
}
#endif /* I2_COMPONENT_H */