From b3ff87b9dde9bba8d3863874bc926f3e18d9a922 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 25 Sep 2013 09:39:31 +0200 Subject: [PATCH] Refactor the demo library. --- components/demo/Makefile.am | 4 ++-- components/demo/demo-type.conf | 2 +- components/demo/{democomponent.cpp => demo.cpp} | 12 ++++++------ components/demo/{democomponent.h => demo.h} | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) rename components/demo/{democomponent.cpp => demo.cpp} (88%) rename components/demo/{democomponent.h => demo.h} (89%) diff --git a/components/demo/Makefile.am b/components/demo/Makefile.am index c2389f1c5..df5e5963e 100644 --- a/components/demo/Makefile.am +++ b/components/demo/Makefile.am @@ -10,8 +10,8 @@ CLEANFILES = \ $(top_builddir)/tools/mkembedconfig/mkembedconfig $< $@ libdemo_la_SOURCES = \ - democomponent.cpp \ - democomponent.h \ + demo.cpp \ + demo.h \ demo-type.conf libdemo_la_CPPFLAGS = \ diff --git a/components/demo/demo-type.conf b/components/demo/demo-type.conf index 4d4fa17f2..1ec369dea 100644 --- a/components/demo/demo-type.conf +++ b/components/demo/demo-type.conf @@ -17,5 +17,5 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -type DemoComponent { +type Demo { } diff --git a/components/demo/democomponent.cpp b/components/demo/demo.cpp similarity index 88% rename from components/demo/democomponent.cpp rename to components/demo/demo.cpp index 7c94a6dc0..4ec78f9f7 100644 --- a/components/demo/democomponent.cpp +++ b/components/demo/demo.cpp @@ -17,32 +17,32 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "demo/democomponent.h" +#include "demo/demo.h" #include "base/dynamictype.h" #include "base/logger_fwd.h" #include using namespace icinga; -REGISTER_TYPE(DemoComponent); +REGISTER_TYPE(Demo); /** * Starts the component. */ -void DemoComponent::Start(void) +void Demo::Start(void) { DynamicObject::Start(); m_DemoTimer = boost::make_shared(); m_DemoTimer->SetInterval(5); - m_DemoTimer->OnTimerExpired.connect(boost::bind(&DemoComponent::DemoTimerHandler, this)); + m_DemoTimer->OnTimerExpired.connect(boost::bind(&Demo::DemoTimerHandler, this)); m_DemoTimer->Start(); } /** * Stops the component. */ -void DemoComponent::Stop(void) +void Demo::Stop(void) { /* Nothing to do here. */ } @@ -52,7 +52,7 @@ void DemoComponent::Stop(void) * * @param - Event arguments for the timer. */ -void DemoComponent::DemoTimerHandler(void) +void Demo::DemoTimerHandler(void) { Log(LogInformation, "demo", "Hello World!"); } diff --git a/components/demo/democomponent.h b/components/demo/demo.h similarity index 89% rename from components/demo/democomponent.h rename to components/demo/demo.h index a03671e9e..860ae2272 100644 --- a/components/demo/democomponent.h +++ b/components/demo/demo.h @@ -17,8 +17,8 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#ifndef DEMOCOMPONENT_H -#define DEMOCOMPONENT_H +#ifndef DEMO_H +#define DEMO_H #include "base/dynamicobject.h" #include "base/timer.h" @@ -29,11 +29,11 @@ namespace icinga /** * @ingroup demo */ -class DemoComponent : public DynamicObject +class Demo : public DynamicObject { public: - DECLARE_PTR_TYPEDEFS(DemoComponent); - DECLARE_TYPENAME(DemoComponent); + DECLARE_PTR_TYPEDEFS(Demo); + DECLARE_TYPENAME(Demo); virtual void Start(void); virtual void Stop(void); @@ -46,4 +46,4 @@ private: } -#endif /* DEMOCOMPONENT_H */ +#endif /* DEMO_H */