From 170c5a59e46ac76a0c50485d2b47c80912ebce3f Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 3 Nov 2014 00:44:04 +0100 Subject: [PATCH] Implement typeof() function --- lib/base/application.hpp | 2 +- lib/base/array.hpp | 2 +- lib/base/dictionary.hpp | 2 +- lib/base/dynamicobject.hpp | 4 ++-- lib/base/dynamictype.cpp | 4 ++-- lib/base/dynamictype.hpp | 2 +- lib/base/fifo.hpp | 2 +- lib/base/filelogger.hpp | 4 ++-- lib/base/logger.hpp | 2 +- lib/base/networkstream.hpp | 2 +- lib/base/object.cpp | 12 +++++++----- lib/base/object.hpp | 15 +++++++++++++-- lib/base/primitivetype.cpp | 4 ++-- lib/base/primitivetype.hpp | 4 ++-- lib/base/process.hpp | 2 +- lib/base/ringbuffer.hpp | 2 +- lib/base/scriptfunction.hpp | 2 +- lib/base/scriptutils.cpp | 17 +++++++++++++++++ lib/base/scriptutils.hpp | 1 + lib/base/scriptvariable.hpp | 2 +- lib/base/serializer.cpp | 6 +++--- lib/base/socket.hpp | 2 +- lib/base/statsfunction.hpp | 2 +- lib/base/stdiostream.hpp | 2 +- lib/base/stream.hpp | 2 +- lib/base/streamlogger.hpp | 2 +- lib/base/sysloglogger.hpp | 4 ++-- lib/base/tcpsocket.hpp | 2 +- lib/base/timer.hpp | 2 +- lib/base/tlsstream.hpp | 2 +- lib/base/type.cpp | 14 +++++++------- lib/base/type.hpp | 20 +++++++++++--------- lib/base/unixsocket.hpp | 2 +- lib/base/value.cpp | 2 +- lib/checker/checkercomponent.hpp | 4 ++-- lib/cli/clicommand.cpp | 2 +- lib/cli/clicommand.hpp | 5 +++-- lib/cli/daemoncommand.hpp | 2 +- lib/cli/featuredisablecommand.hpp | 2 +- lib/cli/featureenablecommand.hpp | 2 +- lib/cli/featurelistcommand.hpp | 2 +- lib/cli/nodeaddcommand.hpp | 2 +- lib/cli/nodeblackandwhitelistcommand.hpp | 2 +- lib/cli/nodelistcommand.hpp | 2 +- lib/cli/noderemovecommand.hpp | 2 +- lib/cli/nodesetcommand.hpp | 2 +- lib/cli/nodesetupcommand.hpp | 2 +- lib/cli/nodeupdateconfigcommand.hpp | 2 +- lib/cli/nodewizardcommand.hpp | 2 +- lib/cli/objectlistcommand.hpp | 2 +- lib/cli/pkinewcacommand.hpp | 2 +- lib/cli/pkinewcertcommand.hpp | 2 +- lib/cli/pkirequestcommand.hpp | 2 +- lib/cli/pkisavecertcommand.hpp | 2 +- lib/cli/pkisigncsrcommand.hpp | 2 +- lib/cli/pkiticketcommand.hpp | 2 +- lib/cli/repositoryclearchangescommand.hpp | 2 +- lib/cli/repositorycommitcommand.hpp | 2 +- lib/cli/repositoryobjectcommand.cpp | 2 +- lib/cli/repositoryobjectcommand.hpp | 2 +- lib/cli/variablegetcommand.hpp | 2 +- lib/cli/variablelistcommand.hpp | 2 +- lib/compat/checkresultreader.hpp | 4 ++-- lib/compat/compatlogger.hpp | 4 ++-- lib/compat/externalcommandlistener.hpp | 4 ++-- lib/compat/statusdatawriter.hpp | 4 ++-- lib/config/configitem.cpp | 4 ++-- lib/config/configitem.hpp | 2 +- lib/config/configitembuilder.hpp | 2 +- lib/config/configtype.hpp | 2 +- lib/config/expression.cpp | 4 ++-- lib/config/expression.hpp | 2 +- lib/config/typerulelist.hpp | 2 +- lib/db_ido/commanddbobject.hpp | 2 +- lib/db_ido/dbconnection.hpp | 2 +- lib/db_ido/dbobject.hpp | 2 +- lib/db_ido/dbtype.hpp | 2 +- lib/db_ido/dbvalue.hpp | 2 +- lib/db_ido/endpointdbobject.hpp | 2 +- lib/db_ido/hostdbobject.hpp | 2 +- lib/db_ido/hostgroupdbobject.hpp | 2 +- lib/db_ido/servicedbobject.hpp | 2 +- lib/db_ido/servicegroupdbobject.hpp | 2 +- lib/db_ido/timeperioddbobject.hpp | 2 +- lib/db_ido/userdbobject.hpp | 2 +- lib/db_ido/usergroupdbobject.hpp | 2 +- lib/db_ido_mysql/idomysqlconnection.hpp | 4 ++-- lib/db_ido_pgsql/idopgsqlconnection.hpp | 4 ++-- lib/demo/demo.hpp | 4 ++-- lib/hello/hello.hpp | 4 ++-- lib/icinga/checkable.hpp | 4 ++-- lib/icinga/checkcommand.hpp | 4 ++-- lib/icinga/checkresult.hpp | 2 +- lib/icinga/command.hpp | 2 +- lib/icinga/comment.hpp | 2 +- lib/icinga/customvarobject.hpp | 2 +- lib/icinga/dependency.hpp | 4 ++-- lib/icinga/downtime.hpp | 2 +- lib/icinga/eventcommand.hpp | 4 ++-- lib/icinga/host.hpp | 4 ++-- lib/icinga/hostgroup.hpp | 4 ++-- lib/icinga/icingaapplication.hpp | 4 ++-- lib/icinga/icingastatuswriter.hpp | 4 ++-- lib/icinga/macroprocessor.cpp | 2 +- lib/icinga/macroresolver.hpp | 2 +- lib/icinga/notification.hpp | 4 ++-- lib/icinga/notificationcommand.hpp | 4 ++-- lib/icinga/perfdatavalue.hpp | 2 +- lib/icinga/scheduleddowntime.hpp | 4 ++-- lib/icinga/service.hpp | 4 ++-- lib/icinga/servicegroup.hpp | 4 ++-- lib/icinga/timeperiod.hpp | 4 ++-- lib/icinga/user.hpp | 4 ++-- lib/icinga/usergroup.hpp | 4 ++-- lib/livestatus/aggregator.hpp | 2 +- lib/livestatus/andfilter.hpp | 2 +- lib/livestatus/attributefilter.hpp | 2 +- lib/livestatus/avgaggregator.hpp | 2 +- lib/livestatus/combinerfilter.hpp | 2 +- lib/livestatus/commandstable.hpp | 2 +- lib/livestatus/commentstable.hpp | 2 +- lib/livestatus/contactgroupstable.hpp | 2 +- lib/livestatus/contactstable.hpp | 2 +- lib/livestatus/countaggregator.hpp | 2 +- lib/livestatus/downtimestable.hpp | 2 +- lib/livestatus/endpointstable.hpp | 2 +- lib/livestatus/filter.hpp | 2 +- lib/livestatus/hostgroupstable.hpp | 2 +- lib/livestatus/hoststable.hpp | 2 +- lib/livestatus/invavgaggregator.hpp | 2 +- lib/livestatus/invsumaggregator.hpp | 2 +- lib/livestatus/livestatuslistener.hpp | 4 ++-- lib/livestatus/livestatusquery.hpp | 2 +- lib/livestatus/logtable.hpp | 2 +- lib/livestatus/maxaggregator.hpp | 2 +- lib/livestatus/minaggregator.hpp | 2 +- lib/livestatus/negatefilter.hpp | 2 +- lib/livestatus/orfilter.hpp | 2 +- lib/livestatus/servicegroupstable.hpp | 2 +- lib/livestatus/servicestable.hpp | 2 +- lib/livestatus/statehisttable.hpp | 2 +- lib/livestatus/statustable.hpp | 2 +- lib/livestatus/stdaggregator.hpp | 2 +- lib/livestatus/sumaggregator.hpp | 2 +- lib/livestatus/table.hpp | 2 +- lib/livestatus/timeperiodstable.hpp | 2 +- lib/notification/notificationcomponent.hpp | 4 ++-- lib/perfdata/graphitewriter.hpp | 4 ++-- lib/perfdata/perfdatawriter.hpp | 4 ++-- lib/remote/apiclient.hpp | 2 +- lib/remote/apifunction.hpp | 2 +- lib/remote/apilistener.hpp | 4 ++-- lib/remote/endpoint.hpp | 4 ++-- lib/remote/zone.hpp | 4 ++-- test/base-object.cpp | 2 +- test/base-type.cpp | 10 +++++----- tools/mkclass/classcompiler.cpp | 13 ++++--------- 157 files changed, 258 insertions(+), 229 deletions(-) diff --git a/lib/base/application.hpp b/lib/base/application.hpp index ac5becb0d..c346183cf 100644 --- a/lib/base/application.hpp +++ b/lib/base/application.hpp @@ -36,7 +36,7 @@ namespace icinga */ class I2_BASE_API Application : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Application); + DECLARE_OBJECT(Application); static boost::signals2::signal OnReopenLogs; diff --git a/lib/base/array.hpp b/lib/base/array.hpp index bfbea2588..6ac24d1ed 100644 --- a/lib/base/array.hpp +++ b/lib/base/array.hpp @@ -36,7 +36,7 @@ namespace icinga class I2_BASE_API Array : public Object { public: - DECLARE_PTR_TYPEDEFS(Array); + DECLARE_OBJECT(Array); /** * An iterator that can be used to iterate over array elements. diff --git a/lib/base/dictionary.hpp b/lib/base/dictionary.hpp index 754182b1c..c90f5f170 100644 --- a/lib/base/dictionary.hpp +++ b/lib/base/dictionary.hpp @@ -37,7 +37,7 @@ namespace icinga class I2_BASE_API Dictionary : public Object { public: - DECLARE_PTR_TYPEDEFS(Dictionary); + DECLARE_OBJECT(Dictionary); /** * An iterator that can be used to iterate over dictionary elements. diff --git a/lib/base/dynamicobject.hpp b/lib/base/dynamicobject.hpp index 68611f89a..31e764146 100644 --- a/lib/base/dynamicobject.hpp +++ b/lib/base/dynamicobject.hpp @@ -42,7 +42,7 @@ class DynamicType; class I2_BASE_API DynamicObject : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(DynamicObject); + DECLARE_OBJECT(DynamicObject); static boost::signals2::signal OnStarted; static boost::signals2::signal OnStopped; @@ -101,7 +101,7 @@ private: DebugInfo m_DebugInfo; }; -#define DECLARE_TYPENAME(klass) \ +#define DECLARE_OBJECTNAME(klass) \ inline static String GetTypeName(void) \ { \ return #klass; \ diff --git a/lib/base/dynamictype.cpp b/lib/base/dynamictype.cpp index 6ee72e716..024c59136 100644 --- a/lib/base/dynamictype.cpp +++ b/lib/base/dynamictype.cpp @@ -37,7 +37,7 @@ DynamicType::Ptr DynamicType::GetByName(const String& name) DynamicType::TypeMap::const_iterator tt = InternalGetTypeMap().find(name); if (tt == InternalGetTypeMap().end()) { - const Type *type = Type::GetByName(name); + Type::Ptr type = Type::GetByName(name); if (!type || !Type::GetByName("DynamicObject")->IsAssignableFrom(type) || type->IsAbstract()) @@ -127,7 +127,7 @@ DynamicObject::Ptr DynamicType::CreateObject(const Dictionary::Ptr& serializedUp { ASSERT(!OwnsLock()); - const Type *type = Type::GetByName(m_Name); + Type::Ptr type = Type::GetByName(m_Name); Object::Ptr object = type->Instantiate(); diff --git a/lib/base/dynamictype.hpp b/lib/base/dynamictype.hpp index fd5271f59..824d04e67 100644 --- a/lib/base/dynamictype.hpp +++ b/lib/base/dynamictype.hpp @@ -36,7 +36,7 @@ class DynamicTypeIterator; class I2_BASE_API DynamicType : public Object { public: - DECLARE_PTR_TYPEDEFS(DynamicType); + DECLARE_OBJECT(DynamicType); DynamicType(const String& name); diff --git a/lib/base/fifo.hpp b/lib/base/fifo.hpp index 5534e5e4f..4fffc0126 100644 --- a/lib/base/fifo.hpp +++ b/lib/base/fifo.hpp @@ -34,7 +34,7 @@ namespace icinga class I2_BASE_API FIFO : public Stream { public: - DECLARE_PTR_TYPEDEFS(FIFO); + DECLARE_OBJECT(FIFO); static const size_t BlockSize = 16 * 1024; diff --git a/lib/base/filelogger.hpp b/lib/base/filelogger.hpp index 4130d6d0e..f818482ca 100644 --- a/lib/base/filelogger.hpp +++ b/lib/base/filelogger.hpp @@ -34,8 +34,8 @@ namespace icinga class I2_BASE_API FileLogger : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(FileLogger); - DECLARE_TYPENAME(FileLogger); + DECLARE_OBJECT(FileLogger); + DECLARE_OBJECTNAME(FileLogger); static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata); diff --git a/lib/base/logger.hpp b/lib/base/logger.hpp index f434de7bd..e8b1c141c 100644 --- a/lib/base/logger.hpp +++ b/lib/base/logger.hpp @@ -62,7 +62,7 @@ struct LogEntry { class I2_BASE_API Logger : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Logger); + DECLARE_OBJECT(Logger); static String SeverityToString(LogSeverity severity); static LogSeverity StringToSeverity(const String& severity); diff --git a/lib/base/networkstream.hpp b/lib/base/networkstream.hpp index aae07edf5..c123063a0 100644 --- a/lib/base/networkstream.hpp +++ b/lib/base/networkstream.hpp @@ -35,7 +35,7 @@ namespace icinga class I2_BASE_API NetworkStream : public Stream { public: - DECLARE_PTR_TYPEDEFS(NetworkStream); + DECLARE_OBJECT(NetworkStream); NetworkStream(const Socket::Ptr& socket); diff --git a/lib/base/object.cpp b/lib/base/object.cpp index 713e51a77..b4361f901 100644 --- a/lib/base/object.cpp +++ b/lib/base/object.cpp @@ -22,6 +22,8 @@ using namespace icinga; +REGISTER_PRIMITIVE_TYPE(Object); + #ifdef _DEBUG boost::mutex Object::m_DebugMutex; #endif /* _DEBUG */ @@ -70,11 +72,6 @@ Object::SharedPtrHolder::operator Value(void) const return m_Object; } -const Type *Object::GetReflectionType(void) const -{ - return NULL; -} - void Object::SetField(int, const Value&) { BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID.")); @@ -85,3 +82,8 @@ Value Object::GetField(int) const BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID.")); } +Type::Ptr icinga::LookupType(const char *name) +{ + return Type::GetByName(name); +} + diff --git a/lib/base/object.hpp b/lib/base/object.hpp index c4832010a..c158b9a5c 100644 --- a/lib/base/object.hpp +++ b/lib/base/object.hpp @@ -53,8 +53,20 @@ class Value; typedef shared_ptr Ptr; \ typedef weak_ptr WeakPtr +#define IMPL_TYPE_LOOKUP(klass) \ + inline virtual shared_ptr GetReflectionType(void) const \ + { \ + return LookupType(#klass); \ + } + +#define DECLARE_OBJECT(klass) \ + DECLARE_PTR_TYPEDEFS(klass); \ + IMPL_TYPE_LOOKUP(klass); + class Type; +I2_BASE_API shared_ptr LookupType(const char *name); + /** * Base class for all heap-allocated objects. At least one of its methods * has to be virtual for RTTI to work. @@ -64,12 +76,11 @@ class Type; class I2_BASE_API Object : public enable_shared_from_this { public: - DECLARE_PTR_TYPEDEFS(Object); + DECLARE_OBJECT(Object); Object(void); virtual ~Object(void); - virtual const Type *GetReflectionType(void) const; virtual void SetField(int id, const Value& value); virtual Value GetField(int id) const; diff --git a/lib/base/primitivetype.cpp b/lib/base/primitivetype.cpp index 306070c63..161b889bb 100644 --- a/lib/base/primitivetype.cpp +++ b/lib/base/primitivetype.cpp @@ -34,9 +34,9 @@ String PrimitiveType::GetName(void) const return m_Name; } -const Type *PrimitiveType::GetBaseType(void) const +Type::Ptr PrimitiveType::GetBaseType(void) const { - return NULL; + return Type::Ptr(); } int PrimitiveType::GetAttributes(void) const diff --git a/lib/base/primitivetype.hpp b/lib/base/primitivetype.hpp index 8e82edaa9..70e942a58 100644 --- a/lib/base/primitivetype.hpp +++ b/lib/base/primitivetype.hpp @@ -33,7 +33,7 @@ public: PrimitiveType(const String& name); virtual String GetName(void) const; - virtual const Type *GetBaseType(void) const; + virtual Type::Ptr GetBaseType(void) const; virtual int GetAttributes(void) const; virtual int GetFieldId(const String& name) const; virtual Field GetFieldInfo(int id) const; @@ -47,7 +47,7 @@ private: namespace { namespace UNIQUE_NAME(prt) { \ void RegisterPrimitiveType ## type(void) \ { \ - icinga::Type *t = new PrimitiveType(#type); \ + icinga::Type::Ptr t = make_shared(#type); \ icinga::Type::Register(t); \ } \ \ diff --git a/lib/base/process.hpp b/lib/base/process.hpp index a23942ba2..2ccda78f6 100644 --- a/lib/base/process.hpp +++ b/lib/base/process.hpp @@ -53,7 +53,7 @@ struct ProcessResult class I2_BASE_API Process : public Object { public: - DECLARE_PTR_TYPEDEFS(Process); + DECLARE_OBJECT(Process); #ifdef _WIN32 typedef String Arguments; diff --git a/lib/base/ringbuffer.hpp b/lib/base/ringbuffer.hpp index cb8d96950..3ca2b821d 100644 --- a/lib/base/ringbuffer.hpp +++ b/lib/base/ringbuffer.hpp @@ -35,7 +35,7 @@ namespace icinga class I2_BASE_API RingBuffer : public Object { public: - DECLARE_PTR_TYPEDEFS(RingBuffer); + DECLARE_OBJECT(RingBuffer); typedef std::vector::size_type SizeType; diff --git a/lib/base/scriptfunction.hpp b/lib/base/scriptfunction.hpp index aa50d7f7c..99055b2ee 100644 --- a/lib/base/scriptfunction.hpp +++ b/lib/base/scriptfunction.hpp @@ -37,7 +37,7 @@ namespace icinga class I2_BASE_API ScriptFunction : public Object { public: - DECLARE_PTR_TYPEDEFS(ScriptFunction); + DECLARE_OBJECT(ScriptFunction); typedef boost::function& arguments)> Callback; diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index a4573ff66..c7496640e 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -40,6 +40,7 @@ REGISTER_SCRIPTFUNCTION(intersection, &ScriptUtils::Intersection); REGISTER_SCRIPTFUNCTION(log, &ScriptUtils::Log); REGISTER_SCRIPTFUNCTION(range, &ScriptUtils::Range); REGISTER_SCRIPTFUNCTION(exit, &ScriptUtils::Exit); +REGISTER_SCRIPTFUNCTION(typeof, &ScriptUtils::TypeOf); bool ScriptUtils::Regex(const String& pattern, const String& text) { @@ -179,3 +180,19 @@ void ScriptUtils::Exit(int code) { exit(code); } + +Type::Ptr ScriptUtils::TypeOf(const Value& value) +{ + switch (value.GetType()) { + case ValueEmpty: + return Type::GetByName("Object"); + case ValueNumber: + return Type::GetByName("double"); + case ValueString: + return Type::GetByName("String"); + case ValueObject: + return static_cast(value)->GetReflectionType(); + default: + VERIFY(!"Invalid value type."); + } +} diff --git a/lib/base/scriptutils.hpp b/lib/base/scriptutils.hpp index 633d74009..99e5f000a 100644 --- a/lib/base/scriptutils.hpp +++ b/lib/base/scriptutils.hpp @@ -40,6 +40,7 @@ public: static void Log(const std::vector& arguments); static Array::Ptr Range(const std::vector& arguments); static void Exit(int code); + static Type::Ptr TypeOf(const Value& value); private: ScriptUtils(void); diff --git a/lib/base/scriptvariable.hpp b/lib/base/scriptvariable.hpp index 602c524c0..a0a80b0d2 100644 --- a/lib/base/scriptvariable.hpp +++ b/lib/base/scriptvariable.hpp @@ -43,7 +43,7 @@ public: class I2_BASE_API ScriptVariable : public Object { public: - DECLARE_PTR_TYPEDEFS(ScriptVariable); + DECLARE_OBJECT(ScriptVariable); ScriptVariable(const Value& data); diff --git a/lib/base/serializer.cpp b/lib/base/serializer.cpp index 196adc77b..2b3478fa5 100644 --- a/lib/base/serializer.cpp +++ b/lib/base/serializer.cpp @@ -53,7 +53,7 @@ static Dictionary::Ptr SerializeDictionary(const Dictionary::Ptr& input, int att static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes) { - const Type *type = input->GetReflectionType(); + Type::Ptr type = input->GetReflectionType(); VERIFY(type); @@ -101,11 +101,11 @@ static Dictionary::Ptr DeserializeDictionary(const Dictionary::Ptr& input, bool static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary::Ptr& input, bool safe_mode, int attributeTypes) { - const Type *type; - if (!object && safe_mode) BOOST_THROW_EXCEPTION(std::runtime_error("Tried to instantiate object while safe mode is enabled.")); + Type::Ptr type; + if (object) type = object->GetReflectionType(); else diff --git a/lib/base/socket.hpp b/lib/base/socket.hpp index 429b7f24e..a118d85f8 100644 --- a/lib/base/socket.hpp +++ b/lib/base/socket.hpp @@ -38,7 +38,7 @@ namespace icinga class I2_BASE_API Socket : public Object { public: - DECLARE_PTR_TYPEDEFS(Socket); + DECLARE_OBJECT(Socket); Socket(void); Socket(SOCKET fd); diff --git a/lib/base/statsfunction.hpp b/lib/base/statsfunction.hpp index 3f08565de..3dd2ddb75 100644 --- a/lib/base/statsfunction.hpp +++ b/lib/base/statsfunction.hpp @@ -38,7 +38,7 @@ namespace icinga class I2_BASE_API StatsFunction : public Object { public: - DECLARE_PTR_TYPEDEFS(StatsFunction); + DECLARE_OBJECT(StatsFunction); typedef boost::function Callback; diff --git a/lib/base/stdiostream.hpp b/lib/base/stdiostream.hpp index b79fcceff..937d6b5be 100644 --- a/lib/base/stdiostream.hpp +++ b/lib/base/stdiostream.hpp @@ -29,7 +29,7 @@ namespace icinga { class I2_BASE_API StdioStream : public Stream { public: - DECLARE_PTR_TYPEDEFS(StdioStream); + DECLARE_OBJECT(StdioStream); StdioStream(std::iostream *innerStream, bool ownsStream); ~StdioStream(void); diff --git a/lib/base/stream.hpp b/lib/base/stream.hpp index 8a6120b08..c8a7d272f 100644 --- a/lib/base/stream.hpp +++ b/lib/base/stream.hpp @@ -54,7 +54,7 @@ struct ReadLineContext class I2_BASE_API Stream : public Object { public: - DECLARE_PTR_TYPEDEFS(Stream); + DECLARE_OBJECT(Stream); /** * Reads data from the stream. diff --git a/lib/base/streamlogger.hpp b/lib/base/streamlogger.hpp index bc340f6a9..d9682fb08 100644 --- a/lib/base/streamlogger.hpp +++ b/lib/base/streamlogger.hpp @@ -36,7 +36,7 @@ namespace icinga class I2_BASE_API StreamLogger : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(StreamLogger); + DECLARE_OBJECT(StreamLogger); virtual void Start(void); virtual void Stop(void); diff --git a/lib/base/sysloglogger.hpp b/lib/base/sysloglogger.hpp index 694e44b01..d29d2627d 100644 --- a/lib/base/sysloglogger.hpp +++ b/lib/base/sysloglogger.hpp @@ -35,8 +35,8 @@ namespace icinga class I2_BASE_API SyslogLogger : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(SyslogLogger); - DECLARE_TYPENAME(SyslogLogger); + DECLARE_OBJECT(SyslogLogger); + DECLARE_OBJECTNAME(SyslogLogger); static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata); diff --git a/lib/base/tcpsocket.hpp b/lib/base/tcpsocket.hpp index 902874eaf..c250e53c9 100644 --- a/lib/base/tcpsocket.hpp +++ b/lib/base/tcpsocket.hpp @@ -34,7 +34,7 @@ namespace icinga class I2_BASE_API TcpSocket : public Socket { public: - DECLARE_PTR_TYPEDEFS(TcpSocket); + DECLARE_OBJECT(TcpSocket); void Bind(const String& service, int family); void Bind(const String& node, const String& service, int family); diff --git a/lib/base/timer.hpp b/lib/base/timer.hpp index 8c8550715..bb70d5173 100644 --- a/lib/base/timer.hpp +++ b/lib/base/timer.hpp @@ -34,7 +34,7 @@ namespace icinga { class I2_BASE_API Timer : public Object { public: - DECLARE_PTR_TYPEDEFS(Timer); + DECLARE_OBJECT(Timer); Timer(void); ~Timer(void); diff --git a/lib/base/tlsstream.hpp b/lib/base/tlsstream.hpp index 00b24ce3b..6303a17f6 100644 --- a/lib/base/tlsstream.hpp +++ b/lib/base/tlsstream.hpp @@ -36,7 +36,7 @@ namespace icinga class I2_BASE_API TlsStream : public Stream { public: - DECLARE_PTR_TYPEDEFS(TlsStream); + DECLARE_OBJECT(TlsStream); TlsStream(const Socket::Ptr& socket, ConnectionRole role, const shared_ptr& sslContext); diff --git a/lib/base/type.cpp b/lib/base/type.cpp index 4e191c5df..f14102a68 100644 --- a/lib/base/type.cpp +++ b/lib/base/type.cpp @@ -28,21 +28,21 @@ Type::TypeMap& Type::GetTypes(void) return types; } -void Type::Register(const Type *type) +void Type::Register(const Type::Ptr& type) { VERIFY(GetByName(type->GetName()) == NULL); GetTypes()[type->GetName()] = type; } -const Type *Type::GetByName(const String& name) +Type::Ptr Type::GetByName(const String& name) { - std::map::const_iterator it; + std::map::const_iterator it; it = GetTypes().find(name); if (it == GetTypes().end()) - return NULL; + return Type::Ptr(); return it->second; } @@ -57,10 +57,10 @@ bool Type::IsAbstract(void) const return ((GetAttributes() & TAAbstract) != 0); } -bool Type::IsAssignableFrom(const Type *other) const +bool Type::IsAssignableFrom(const Type::Ptr& other) const { - for (const Type *t = other; t; t = t->GetBaseType()) { - if (t == this) + for (Type::Ptr t = other; t; t = t->GetBaseType()) { + if (t.get() == this) return true; } diff --git a/lib/base/type.hpp b/lib/base/type.hpp index 67ffceee9..b4ab7b6ff 100644 --- a/lib/base/type.hpp +++ b/lib/base/type.hpp @@ -42,11 +42,11 @@ class Type; struct Field { int ID; - const Type *FType; + shared_ptr FType; const char *Name; int Attributes; - Field(int id, const Type *type, const char *name, int attributes) + Field(int id, const shared_ptr& type, const char *name, int attributes) : ID(id), FType(type), Name(name), Attributes(attributes) { } }; @@ -56,13 +56,15 @@ enum TypeAttribute TAAbstract = 1 }; -class I2_BASE_API Type +class I2_BASE_API Type : public Object { public: + DECLARE_OBJECT(Type); + typedef boost::function Factory; virtual String GetName(void) const = 0; - virtual const Type *GetBaseType(void) const = 0; + virtual Type::Ptr GetBaseType(void) const = 0; virtual int GetAttributes(void) const = 0; virtual int GetFieldId(const String& name) const = 0; virtual Field GetFieldInfo(int id) const = 0; @@ -70,17 +72,17 @@ public: Object::Ptr Instantiate(void) const; - bool IsAssignableFrom(const Type *other) const; + bool IsAssignableFrom(const Type::Ptr& other) const; bool IsAbstract(void) const; - static void Register(const Type *type); - static const Type *GetByName(const String& name); + static void Register(const Type::Ptr& type); + static Type::Ptr GetByName(const String& name); void SetFactory(const Factory& factory); private: - typedef std::map TypeMap; + typedef std::map TypeMap; static TypeMap& GetTypes(void); @@ -111,7 +113,7 @@ struct FactoryHelper namespace { namespace UNIQUE_NAME(rt) { \ void RegisterType ## type(void) \ { \ - icinga::Type *t = new TypeImpl(); \ + icinga::Type::Ptr t = make_shared >(); \ t->SetFactory(FactoryHelper().GetFactory()); \ icinga::Type::Register(t); \ } \ diff --git a/lib/base/unixsocket.hpp b/lib/base/unixsocket.hpp index f72ac9a93..1d120133a 100644 --- a/lib/base/unixsocket.hpp +++ b/lib/base/unixsocket.hpp @@ -29,7 +29,7 @@ namespace icinga class I2_BASE_API UnixSocket : public Socket { public: - DECLARE_PTR_TYPEDEFS(UnixSocket); + DECLARE_OBJECT(UnixSocket); UnixSocket(void); diff --git a/lib/base/value.cpp b/lib/base/value.cpp index 9dff7cee2..0f68ef799 100644 --- a/lib/base/value.cpp +++ b/lib/base/value.cpp @@ -148,7 +148,7 @@ ValueType Value::GetType(void) const String Value::GetTypeName(void) const { - const Type *t; + Type::Ptr t; switch (GetType()) { case ValueEmpty: diff --git a/lib/checker/checkercomponent.hpp b/lib/checker/checkercomponent.hpp index ad83ad980..53b6b4aed 100644 --- a/lib/checker/checkercomponent.hpp +++ b/lib/checker/checkercomponent.hpp @@ -57,8 +57,8 @@ struct CheckableNextCheckExtractor class CheckerComponent : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(CheckerComponent); - DECLARE_TYPENAME(CheckerComponent); + DECLARE_OBJECT(CheckerComponent); + DECLARE_OBJECTNAME(CheckerComponent); typedef boost::multi_index_container< Checkable::Ptr, diff --git a/lib/cli/clicommand.cpp b/lib/cli/clicommand.cpp index 159f9d7e5..62e899bd2 100644 --- a/lib/cli/clicommand.cpp +++ b/lib/cli/clicommand.cpp @@ -68,7 +68,7 @@ std::vector icinga::GetBashCompletionSuggestions(const String& type, con return result; } -std::vector icinga::GetFieldCompletionSuggestions(const Type *type, const String& word) +std::vector icinga::GetFieldCompletionSuggestions(const Type::Ptr& type, const String& word) { std::vector result; diff --git a/lib/cli/clicommand.hpp b/lib/cli/clicommand.hpp index 20ad1f80d..a4362f48d 100644 --- a/lib/cli/clicommand.hpp +++ b/lib/cli/clicommand.hpp @@ -23,6 +23,7 @@ #include "cli/i2-cli.hpp" #include "base/value.hpp" #include "base/utility.hpp" +#include "base/type.hpp" #include #include @@ -30,7 +31,7 @@ namespace icinga { std::vector I2_CLI_API GetBashCompletionSuggestions(const String& type, const String& word); -std::vector I2_CLI_API GetFieldCompletionSuggestions(const Type *type, const String& word); +std::vector I2_CLI_API GetFieldCompletionSuggestions(const Type::Ptr& type, const String& word); enum ImpersonationLevel { @@ -47,7 +48,7 @@ enum ImpersonationLevel class I2_CLI_API CLICommand : public Object { public: - DECLARE_PTR_TYPEDEFS(CLICommand); + DECLARE_OBJECT(CLICommand); typedef std::vector(*ArgumentCompletionCallback)(const String&, const String&); diff --git a/lib/cli/daemoncommand.hpp b/lib/cli/daemoncommand.hpp index 5a95d218d..8674a5546 100644 --- a/lib/cli/daemoncommand.hpp +++ b/lib/cli/daemoncommand.hpp @@ -33,7 +33,7 @@ namespace icinga class DaemonCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(DaemonCommand); + DECLARE_OBJECT(DaemonCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/featuredisablecommand.hpp b/lib/cli/featuredisablecommand.hpp index 722d89abb..21960fa7e 100644 --- a/lib/cli/featuredisablecommand.hpp +++ b/lib/cli/featuredisablecommand.hpp @@ -33,7 +33,7 @@ namespace icinga class FeatureDisableCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(FeatureDisableCommand); + DECLARE_OBJECT(FeatureDisableCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/featureenablecommand.hpp b/lib/cli/featureenablecommand.hpp index 4a94aa019..b0a0d16f6 100644 --- a/lib/cli/featureenablecommand.hpp +++ b/lib/cli/featureenablecommand.hpp @@ -33,7 +33,7 @@ namespace icinga class FeatureEnableCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(FeatureEnableCommand); + DECLARE_OBJECT(FeatureEnableCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/featurelistcommand.hpp b/lib/cli/featurelistcommand.hpp index df9f8d3a3..0894dc2d1 100644 --- a/lib/cli/featurelistcommand.hpp +++ b/lib/cli/featurelistcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class FeatureListCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(FeatureListCommand); + DECLARE_OBJECT(FeatureListCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/nodeaddcommand.hpp b/lib/cli/nodeaddcommand.hpp index d791fe24e..504f1b522 100644 --- a/lib/cli/nodeaddcommand.hpp +++ b/lib/cli/nodeaddcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class NodeAddCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(NodeAddCommand); + DECLARE_OBJECT(NodeAddCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/nodeblackandwhitelistcommand.hpp b/lib/cli/nodeblackandwhitelistcommand.hpp index cd103660e..b061353e6 100644 --- a/lib/cli/nodeblackandwhitelistcommand.hpp +++ b/lib/cli/nodeblackandwhitelistcommand.hpp @@ -40,7 +40,7 @@ enum BlackAndWhitelistCommandType class I2_CLI_API BlackAndWhitelistCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(BlackAndWhitelistCommand); + DECLARE_OBJECT(BlackAndWhitelistCommand); BlackAndWhitelistCommand(const String& type, BlackAndWhitelistCommandType command); diff --git a/lib/cli/nodelistcommand.hpp b/lib/cli/nodelistcommand.hpp index e194c7824..fb30ad3ee 100644 --- a/lib/cli/nodelistcommand.hpp +++ b/lib/cli/nodelistcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class NodeListCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(NodeListCommand); + DECLARE_OBJECT(NodeListCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/noderemovecommand.hpp b/lib/cli/noderemovecommand.hpp index b41a6244f..3f183eb7c 100644 --- a/lib/cli/noderemovecommand.hpp +++ b/lib/cli/noderemovecommand.hpp @@ -33,7 +33,7 @@ namespace icinga class NodeRemoveCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(NodeRemoveCommand); + DECLARE_OBJECT(NodeRemoveCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/nodesetcommand.hpp b/lib/cli/nodesetcommand.hpp index a8c2434fa..d13634a00 100644 --- a/lib/cli/nodesetcommand.hpp +++ b/lib/cli/nodesetcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class NodeSetCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(NodeSetCommand); + DECLARE_OBJECT(NodeSetCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/nodesetupcommand.hpp b/lib/cli/nodesetupcommand.hpp index 47d094e31..cf7c13238 100644 --- a/lib/cli/nodesetupcommand.hpp +++ b/lib/cli/nodesetupcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class NodeSetupCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(NodeSetupCommand); + DECLARE_OBJECT(NodeSetupCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/nodeupdateconfigcommand.hpp b/lib/cli/nodeupdateconfigcommand.hpp index b35f252d3..1ff2ba852 100644 --- a/lib/cli/nodeupdateconfigcommand.hpp +++ b/lib/cli/nodeupdateconfigcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class NodeUpdateConfigCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(NodeUpdateConfigCommand); + DECLARE_OBJECT(NodeUpdateConfigCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/nodewizardcommand.hpp b/lib/cli/nodewizardcommand.hpp index daf257dc2..077425714 100644 --- a/lib/cli/nodewizardcommand.hpp +++ b/lib/cli/nodewizardcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class NodeWizardCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(NodeWizardCommand); + DECLARE_OBJECT(NodeWizardCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/objectlistcommand.hpp b/lib/cli/objectlistcommand.hpp index 324cdbe8d..e3cfc7fe7 100644 --- a/lib/cli/objectlistcommand.hpp +++ b/lib/cli/objectlistcommand.hpp @@ -36,7 +36,7 @@ namespace icinga class ObjectListCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(ObjectListCommand); + DECLARE_OBJECT(ObjectListCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/pkinewcacommand.hpp b/lib/cli/pkinewcacommand.hpp index e1a3ff57c..7c5c411e8 100644 --- a/lib/cli/pkinewcacommand.hpp +++ b/lib/cli/pkinewcacommand.hpp @@ -33,7 +33,7 @@ namespace icinga class PKINewCACommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(PKINewCACommand); + DECLARE_OBJECT(PKINewCACommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/pkinewcertcommand.hpp b/lib/cli/pkinewcertcommand.hpp index 770f19c5a..c1ee23efc 100644 --- a/lib/cli/pkinewcertcommand.hpp +++ b/lib/cli/pkinewcertcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class PKINewCertCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(PKINewCertCommand); + DECLARE_OBJECT(PKINewCertCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/pkirequestcommand.hpp b/lib/cli/pkirequestcommand.hpp index 225237725..c61cb8de7 100644 --- a/lib/cli/pkirequestcommand.hpp +++ b/lib/cli/pkirequestcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class PKIRequestCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(PKIRequestCommand); + DECLARE_OBJECT(PKIRequestCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/pkisavecertcommand.hpp b/lib/cli/pkisavecertcommand.hpp index 9ed935abb..a12fbca02 100644 --- a/lib/cli/pkisavecertcommand.hpp +++ b/lib/cli/pkisavecertcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class PKISaveCertCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(PKISaveCertCommand); + DECLARE_OBJECT(PKISaveCertCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/pkisigncsrcommand.hpp b/lib/cli/pkisigncsrcommand.hpp index 8a2789f12..77d165eec 100644 --- a/lib/cli/pkisigncsrcommand.hpp +++ b/lib/cli/pkisigncsrcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class PKISignCSRCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(PKISignCSRCommand); + DECLARE_OBJECT(PKISignCSRCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/pkiticketcommand.hpp b/lib/cli/pkiticketcommand.hpp index d8009030a..92bee25cd 100644 --- a/lib/cli/pkiticketcommand.hpp +++ b/lib/cli/pkiticketcommand.hpp @@ -33,7 +33,7 @@ namespace icinga class PKITicketCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(PKITicketCommand); + DECLARE_OBJECT(PKITicketCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/repositoryclearchangescommand.hpp b/lib/cli/repositoryclearchangescommand.hpp index ac4332e48..4e64e1219 100644 --- a/lib/cli/repositoryclearchangescommand.hpp +++ b/lib/cli/repositoryclearchangescommand.hpp @@ -36,7 +36,7 @@ namespace icinga class RepositoryClearChangesCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(RepositoryClearChangesCommand); + DECLARE_OBJECT(RepositoryClearChangesCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/repositorycommitcommand.hpp b/lib/cli/repositorycommitcommand.hpp index d853d25e1..d63c9e9bd 100644 --- a/lib/cli/repositorycommitcommand.hpp +++ b/lib/cli/repositorycommitcommand.hpp @@ -36,7 +36,7 @@ namespace icinga class RepositoryCommitCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(RepositoryCommitCommand); + DECLARE_OBJECT(RepositoryCommitCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/repositoryobjectcommand.cpp b/lib/cli/repositoryobjectcommand.cpp index 7ce0ae9d0..a3bbba435 100644 --- a/lib/cli/repositoryobjectcommand.cpp +++ b/lib/cli/repositoryobjectcommand.cpp @@ -129,7 +129,7 @@ std::vector RepositoryObjectCommand::GetPositionalSuggestions(const Stri { if (m_Command == RepositoryCommandAdd) { Utility::LoadExtensionLibrary("icinga"); - const Type *ptype = Type::GetByName(m_Type); + Type::Ptr ptype = Type::GetByName(m_Type); ASSERT(ptype); return GetFieldCompletionSuggestions(ptype, word); } else if (m_Command == RepositoryCommandRemove) { diff --git a/lib/cli/repositoryobjectcommand.hpp b/lib/cli/repositoryobjectcommand.hpp index 9472f5e86..9aafad5f3 100644 --- a/lib/cli/repositoryobjectcommand.hpp +++ b/lib/cli/repositoryobjectcommand.hpp @@ -41,7 +41,7 @@ enum RepositoryCommandType class I2_CLI_API RepositoryObjectCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(RepositoryObjectCommand); + DECLARE_OBJECT(RepositoryObjectCommand); RepositoryObjectCommand(const String& type, RepositoryCommandType command); diff --git a/lib/cli/variablegetcommand.hpp b/lib/cli/variablegetcommand.hpp index da72618e2..3273c8f85 100644 --- a/lib/cli/variablegetcommand.hpp +++ b/lib/cli/variablegetcommand.hpp @@ -36,7 +36,7 @@ namespace icinga class VariableGetCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(VariableGetCommand); + DECLARE_OBJECT(VariableGetCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/cli/variablelistcommand.hpp b/lib/cli/variablelistcommand.hpp index 566f2e49c..825bac9ef 100644 --- a/lib/cli/variablelistcommand.hpp +++ b/lib/cli/variablelistcommand.hpp @@ -36,7 +36,7 @@ namespace icinga class VariableListCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(VariableListCommand); + DECLARE_OBJECT(VariableListCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; diff --git a/lib/compat/checkresultreader.hpp b/lib/compat/checkresultreader.hpp index 84d3d23bd..e8c94c74c 100644 --- a/lib/compat/checkresultreader.hpp +++ b/lib/compat/checkresultreader.hpp @@ -35,8 +35,8 @@ namespace icinga class CheckResultReader : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(CheckResultReader); - DECLARE_TYPENAME(CheckResultReader); + DECLARE_OBJECT(CheckResultReader); + DECLARE_OBJECTNAME(CheckResultReader); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/compat/compatlogger.hpp b/lib/compat/compatlogger.hpp index ebd8e1209..82f5c36ea 100644 --- a/lib/compat/compatlogger.hpp +++ b/lib/compat/compatlogger.hpp @@ -36,8 +36,8 @@ namespace icinga class CompatLogger : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(CompatLogger); - DECLARE_TYPENAME(CompatLogger); + DECLARE_OBJECT(CompatLogger); + DECLARE_OBJECTNAME(CompatLogger); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/compat/externalcommandlistener.hpp b/lib/compat/externalcommandlistener.hpp index 49494c890..486711d5f 100644 --- a/lib/compat/externalcommandlistener.hpp +++ b/lib/compat/externalcommandlistener.hpp @@ -36,8 +36,8 @@ namespace icinga class ExternalCommandListener : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(ExternalCommandListener); - DECLARE_TYPENAME(ExternalCommandListener); + DECLARE_OBJECT(ExternalCommandListener); + DECLARE_OBJECTNAME(ExternalCommandListener); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/compat/statusdatawriter.hpp b/lib/compat/statusdatawriter.hpp index 3024bb101..37e04d375 100644 --- a/lib/compat/statusdatawriter.hpp +++ b/lib/compat/statusdatawriter.hpp @@ -41,8 +41,8 @@ namespace icinga class StatusDataWriter : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(StatusDataWriter); - DECLARE_TYPENAME(StatusDataWriter); + DECLARE_OBJECT(StatusDataWriter); + DECLARE_OBJECTNAME(StatusDataWriter); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 1ccec6ce3..45cd19ced 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -143,7 +143,7 @@ Dictionary::Ptr ConfigItem::GetProperties(void) String name = m_Name; if (!m_Abstract) { - const NameComposer *nc = dynamic_cast(Type::GetByName(m_Type)); + shared_ptr nc = dynamic_pointer_cast(Type::GetByName(m_Type)); if (nc) { name = nc->MakeName(m_Name, m_Properties); @@ -212,7 +212,7 @@ void ConfigItem::Register(void) /* If this is a non-abstract object we need to figure out * its real name now - or assign it a temporary name. */ if (!m_Abstract) { - const NameComposer *nc = dynamic_cast(Type::GetByName(m_Type)); + shared_ptr nc = dynamic_pointer_cast(Type::GetByName(m_Type)); if (nc) { name = nc->MakeName(m_Name, Dictionary::Ptr()); diff --git a/lib/config/configitem.hpp b/lib/config/configitem.hpp index 1c7d23820..7d905247e 100644 --- a/lib/config/configitem.hpp +++ b/lib/config/configitem.hpp @@ -35,7 +35,7 @@ namespace icinga */ class I2_CONFIG_API ConfigItem : public Object { public: - DECLARE_PTR_TYPEDEFS(ConfigItem); + DECLARE_OBJECT(ConfigItem); ConfigItem(const String& type, const String& name, bool abstract, const Expression::Ptr& exprl, const DebugInfo& debuginfo, diff --git a/lib/config/configitembuilder.hpp b/lib/config/configitembuilder.hpp index 30b16f0c9..53a5970f8 100644 --- a/lib/config/configitembuilder.hpp +++ b/lib/config/configitembuilder.hpp @@ -37,7 +37,7 @@ namespace icinga class I2_CONFIG_API ConfigItemBuilder : public Object { public: - DECLARE_PTR_TYPEDEFS(ConfigItemBuilder); + DECLARE_OBJECT(ConfigItemBuilder); ConfigItemBuilder(void); explicit ConfigItemBuilder(const DebugInfo& debugInfo); diff --git a/lib/config/configtype.hpp b/lib/config/configtype.hpp index aa8b770ad..5c8332c9e 100644 --- a/lib/config/configtype.hpp +++ b/lib/config/configtype.hpp @@ -37,7 +37,7 @@ namespace icinga */ class I2_CONFIG_API ConfigType : public Object { public: - DECLARE_PTR_TYPEDEFS(ConfigType); + DECLARE_OBJECT(ConfigType); ConfigType(const String& name, const DebugInfo& debuginfo); diff --git a/lib/config/expression.cpp b/lib/config/expression.cpp index 234a04526..538aad6a1 100644 --- a/lib/config/expression.cpp +++ b/lib/config/expression.cpp @@ -480,7 +480,7 @@ Value Expression::OpIndexer(const Expression *expr, const Dictionary::Ptr& local return arr->Get(index); } else if (value.IsObjectType()) { Object::Ptr object = value; - const Type *type = object->GetReflectionType(); + Type::Ptr type = object->GetReflectionType(); if (!type) BOOST_THROW_EXCEPTION(ConfigError("Dot operator applied to object which does not support reflection")); @@ -578,7 +578,7 @@ Value Expression::OpObject(const Expression* expr, const Dictionary::Ptr& locals String checkName = name; if (!abstract) { - const NameComposer *nc = dynamic_cast(Type::GetByName(type)); + shared_ptr nc = dynamic_pointer_cast(Type::GetByName(type)); if (nc) checkName = nc->MakeName(name, Dictionary::Ptr()); diff --git a/lib/config/expression.hpp b/lib/config/expression.hpp index 430c75f0c..874f6ff73 100644 --- a/lib/config/expression.hpp +++ b/lib/config/expression.hpp @@ -52,7 +52,7 @@ struct DebugHint class I2_CONFIG_API Expression : public Object { public: - DECLARE_PTR_TYPEDEFS(Expression); + DECLARE_OBJECT(Expression); typedef Value (*OpCallback)(const Expression *, const Dictionary::Ptr&, DebugHint *dhint); diff --git a/lib/config/typerulelist.hpp b/lib/config/typerulelist.hpp index a131b4960..4e5f9c68c 100644 --- a/lib/config/typerulelist.hpp +++ b/lib/config/typerulelist.hpp @@ -48,7 +48,7 @@ enum TypeValidationResult class I2_CONFIG_API TypeRuleList : public Object { public: - DECLARE_PTR_TYPEDEFS(TypeRuleList); + DECLARE_OBJECT(TypeRuleList); void SetValidator(const String& validator); String GetValidator(void) const; diff --git a/lib/db_ido/commanddbobject.hpp b/lib/db_ido/commanddbobject.hpp index c414b6cd7..58d601350 100644 --- a/lib/db_ido/commanddbobject.hpp +++ b/lib/db_ido/commanddbobject.hpp @@ -34,7 +34,7 @@ namespace icinga class CommandDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(CommandDbObject); + DECLARE_OBJECT(CommandDbObject); CommandDbObject(const shared_ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/dbconnection.hpp b/lib/db_ido/dbconnection.hpp index b0812250d..cac7f210d 100644 --- a/lib/db_ido/dbconnection.hpp +++ b/lib/db_ido/dbconnection.hpp @@ -37,7 +37,7 @@ namespace icinga class I2_DB_IDO_API DbConnection : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(DbConnection); + DECLARE_OBJECT(DbConnection); static void StaticInitialize(void); diff --git a/lib/db_ido/dbobject.hpp b/lib/db_ido/dbobject.hpp index 80f85bbd2..32eb567bf 100644 --- a/lib/db_ido/dbobject.hpp +++ b/lib/db_ido/dbobject.hpp @@ -61,7 +61,7 @@ enum DbObjectType class I2_DB_IDO_API DbObject : public Object { public: - DECLARE_PTR_TYPEDEFS(DbObject); + DECLARE_OBJECT(DbObject); static void StaticInitialize(void); diff --git a/lib/db_ido/dbtype.hpp b/lib/db_ido/dbtype.hpp index 199a04b2c..4a5a66558 100644 --- a/lib/db_ido/dbtype.hpp +++ b/lib/db_ido/dbtype.hpp @@ -39,7 +39,7 @@ class DbObject; class I2_DB_IDO_API DbType : public Object { public: - DECLARE_PTR_TYPEDEFS(DbType); + DECLARE_OBJECT(DbType); typedef boost::function (const shared_ptr&, const String&, const String&)> ObjectFactory; typedef std::map TypeMap; diff --git a/lib/db_ido/dbvalue.hpp b/lib/db_ido/dbvalue.hpp index 1c7e184ab..89a0a9704 100644 --- a/lib/db_ido/dbvalue.hpp +++ b/lib/db_ido/dbvalue.hpp @@ -42,7 +42,7 @@ enum DbValueType struct I2_DB_IDO_API DbValue : public Object { public: - DECLARE_PTR_TYPEDEFS(DbValue); + DECLARE_OBJECT(DbValue); DbValue(DbValueType type, const Value& value); diff --git a/lib/db_ido/endpointdbobject.hpp b/lib/db_ido/endpointdbobject.hpp index e11fe1b85..6598b1b24 100644 --- a/lib/db_ido/endpointdbobject.hpp +++ b/lib/db_ido/endpointdbobject.hpp @@ -35,7 +35,7 @@ namespace icinga class EndpointDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(EndpointDbObject); + DECLARE_OBJECT(EndpointDbObject); EndpointDbObject(const shared_ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/hostdbobject.hpp b/lib/db_ido/hostdbobject.hpp index aabf45401..cb2449aa3 100644 --- a/lib/db_ido/hostdbobject.hpp +++ b/lib/db_ido/hostdbobject.hpp @@ -34,7 +34,7 @@ namespace icinga class HostDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(HostDbObject); + DECLARE_OBJECT(HostDbObject); HostDbObject(const DbType::Ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/hostgroupdbobject.hpp b/lib/db_ido/hostgroupdbobject.hpp index d9f4c6a2d..2fa717fee 100644 --- a/lib/db_ido/hostgroupdbobject.hpp +++ b/lib/db_ido/hostgroupdbobject.hpp @@ -35,7 +35,7 @@ namespace icinga class HostGroupDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(HostGroupDbObject); + DECLARE_OBJECT(HostGroupDbObject); HostGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/servicedbobject.hpp b/lib/db_ido/servicedbobject.hpp index c99d4a824..43e3f338b 100644 --- a/lib/db_ido/servicedbobject.hpp +++ b/lib/db_ido/servicedbobject.hpp @@ -35,7 +35,7 @@ namespace icinga class ServiceDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(ServiceDbObject); + DECLARE_OBJECT(ServiceDbObject); ServiceDbObject(const DbType::Ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/servicegroupdbobject.hpp b/lib/db_ido/servicegroupdbobject.hpp index dc79ef766..a91f5a867 100644 --- a/lib/db_ido/servicegroupdbobject.hpp +++ b/lib/db_ido/servicegroupdbobject.hpp @@ -35,7 +35,7 @@ namespace icinga class ServiceGroupDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(ServiceGroupDbObject); + DECLARE_OBJECT(ServiceGroupDbObject); ServiceGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/timeperioddbobject.hpp b/lib/db_ido/timeperioddbobject.hpp index b68eebe43..b568b0e63 100644 --- a/lib/db_ido/timeperioddbobject.hpp +++ b/lib/db_ido/timeperioddbobject.hpp @@ -34,7 +34,7 @@ namespace icinga class TimePeriodDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(TimePeriodDbObject); + DECLARE_OBJECT(TimePeriodDbObject); TimePeriodDbObject(const DbType::Ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/userdbobject.hpp b/lib/db_ido/userdbobject.hpp index 6ad2225a4..2f4da9a2b 100644 --- a/lib/db_ido/userdbobject.hpp +++ b/lib/db_ido/userdbobject.hpp @@ -34,7 +34,7 @@ namespace icinga class UserDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(UserDbObject); + DECLARE_OBJECT(UserDbObject); UserDbObject(const DbType::Ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido/usergroupdbobject.hpp b/lib/db_ido/usergroupdbobject.hpp index 05e9ef2ba..ee9d36b01 100644 --- a/lib/db_ido/usergroupdbobject.hpp +++ b/lib/db_ido/usergroupdbobject.hpp @@ -35,7 +35,7 @@ namespace icinga class UserGroupDbObject : public DbObject { public: - DECLARE_PTR_TYPEDEFS(UserGroupDbObject); + DECLARE_OBJECT(UserGroupDbObject); UserGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2); diff --git a/lib/db_ido_mysql/idomysqlconnection.hpp b/lib/db_ido_mysql/idomysqlconnection.hpp index aa9c11dcd..5e383921e 100644 --- a/lib/db_ido_mysql/idomysqlconnection.hpp +++ b/lib/db_ido_mysql/idomysqlconnection.hpp @@ -39,8 +39,8 @@ typedef shared_ptr IdoMysqlResult; class IdoMysqlConnection : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(IdoMysqlConnection); - DECLARE_TYPENAME(IdoMysqlConnection); + DECLARE_OBJECT(IdoMysqlConnection); + DECLARE_OBJECTNAME(IdoMysqlConnection); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/db_ido_pgsql/idopgsqlconnection.hpp b/lib/db_ido_pgsql/idopgsqlconnection.hpp index c2da9647c..00ed97198 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.hpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.hpp @@ -39,8 +39,8 @@ typedef shared_ptr IdoPgsqlResult; class IdoPgsqlConnection : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(IdoPgsqlConnection); - DECLARE_TYPENAME(IdoPgsqlConnection); + DECLARE_OBJECT(IdoPgsqlConnection); + DECLARE_OBJECTNAME(IdoPgsqlConnection); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/demo/demo.hpp b/lib/demo/demo.hpp index 7f4762e69..ae0d0e919 100644 --- a/lib/demo/demo.hpp +++ b/lib/demo/demo.hpp @@ -33,8 +33,8 @@ namespace icinga class Demo : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Demo); - DECLARE_TYPENAME(Demo); + DECLARE_OBJECT(Demo); + DECLARE_OBJECTNAME(Demo); virtual void Start(void); diff --git a/lib/hello/hello.hpp b/lib/hello/hello.hpp index 2283fe77f..ce027b8fa 100644 --- a/lib/hello/hello.hpp +++ b/lib/hello/hello.hpp @@ -33,8 +33,8 @@ namespace icinga class Hello : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Hello); - DECLARE_TYPENAME(Hello); + DECLARE_OBJECT(Hello); + DECLARE_OBJECTNAME(Hello); int Main(void); }; diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index 27468f94d..cc36c4331 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -77,8 +77,8 @@ class Dependency; class I2_ICINGA_API Checkable : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Checkable); - DECLARE_TYPENAME(Checkable); + DECLARE_OBJECT(Checkable); + DECLARE_OBJECTNAME(Checkable); Checkable(void); diff --git a/lib/icinga/checkcommand.hpp b/lib/icinga/checkcommand.hpp index 9b977ce15..dde46ec58 100644 --- a/lib/icinga/checkcommand.hpp +++ b/lib/icinga/checkcommand.hpp @@ -34,8 +34,8 @@ namespace icinga class I2_ICINGA_API CheckCommand : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(CheckCommand); - DECLARE_TYPENAME(CheckCommand); + DECLARE_OBJECT(CheckCommand); + DECLARE_OBJECTNAME(CheckCommand); virtual void Execute(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); }; diff --git a/lib/icinga/checkresult.hpp b/lib/icinga/checkresult.hpp index 87f366260..5717c8805 100644 --- a/lib/icinga/checkresult.hpp +++ b/lib/icinga/checkresult.hpp @@ -34,7 +34,7 @@ namespace icinga class I2_ICINGA_API CheckResult : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(CheckResult); + DECLARE_OBJECT(CheckResult); }; } diff --git a/lib/icinga/command.hpp b/lib/icinga/command.hpp index b1f05c68e..ad21659b2 100644 --- a/lib/icinga/command.hpp +++ b/lib/icinga/command.hpp @@ -35,7 +35,7 @@ namespace icinga class I2_ICINGA_API Command : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Command); + DECLARE_OBJECT(Command); //virtual Dictionary::Ptr Execute(const Object::Ptr& context) = 0; diff --git a/lib/icinga/comment.hpp b/lib/icinga/comment.hpp index 0b64d5ded..dd25e5931 100644 --- a/lib/icinga/comment.hpp +++ b/lib/icinga/comment.hpp @@ -34,7 +34,7 @@ namespace icinga class I2_ICINGA_API Comment : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Comment); + DECLARE_OBJECT(Comment); bool IsExpired(void) const; }; diff --git a/lib/icinga/customvarobject.hpp b/lib/icinga/customvarobject.hpp index c8929d8d2..8a3f3fd2b 100644 --- a/lib/icinga/customvarobject.hpp +++ b/lib/icinga/customvarobject.hpp @@ -57,7 +57,7 @@ enum ModifiedAttributeType class I2_ICINGA_API CustomVarObject : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(CustomVarObject); + DECLARE_OBJECT(CustomVarObject); static boost::signals2::signal OnVarsChanged; diff --git a/lib/icinga/dependency.hpp b/lib/icinga/dependency.hpp index 08e04e813..b6a8e21e6 100644 --- a/lib/icinga/dependency.hpp +++ b/lib/icinga/dependency.hpp @@ -37,8 +37,8 @@ class ApplyRule; class I2_ICINGA_API Dependency : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Dependency); - DECLARE_TYPENAME(Dependency); + DECLARE_OBJECT(Dependency); + DECLARE_OBJECTNAME(Dependency); shared_ptr GetParent(void) const; shared_ptr GetChild(void) const; diff --git a/lib/icinga/downtime.hpp b/lib/icinga/downtime.hpp index 73fffd310..439d76429 100644 --- a/lib/icinga/downtime.hpp +++ b/lib/icinga/downtime.hpp @@ -34,7 +34,7 @@ namespace icinga class I2_ICINGA_API Downtime : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Downtime); + DECLARE_OBJECT(Downtime); bool IsActive(void) const; bool IsTriggered(void) const; diff --git a/lib/icinga/eventcommand.hpp b/lib/icinga/eventcommand.hpp index 6717928da..605477526 100644 --- a/lib/icinga/eventcommand.hpp +++ b/lib/icinga/eventcommand.hpp @@ -34,8 +34,8 @@ namespace icinga class I2_ICINGA_API EventCommand : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(EventCommand); - DECLARE_TYPENAME(EventCommand); + DECLARE_OBJECT(EventCommand); + DECLARE_OBJECTNAME(EventCommand); virtual void Execute(const Checkable::Ptr& checkable); }; diff --git a/lib/icinga/host.hpp b/lib/icinga/host.hpp index 1101cae3d..1754debe6 100644 --- a/lib/icinga/host.hpp +++ b/lib/icinga/host.hpp @@ -38,8 +38,8 @@ class Service; class I2_ICINGA_API Host : public ObjectImpl, public MacroResolver { public: - DECLARE_PTR_TYPEDEFS(Host); - DECLARE_TYPENAME(Host); + DECLARE_OBJECT(Host); + DECLARE_OBJECTNAME(Host); shared_ptr GetServiceByShortName(const Value& name); diff --git a/lib/icinga/hostgroup.hpp b/lib/icinga/hostgroup.hpp index 69c39a789..1aa667a0e 100644 --- a/lib/icinga/hostgroup.hpp +++ b/lib/icinga/hostgroup.hpp @@ -37,8 +37,8 @@ class ObjectRule; class I2_ICINGA_API HostGroup : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(HostGroup); - DECLARE_TYPENAME(HostGroup); + DECLARE_OBJECT(HostGroup); + DECLARE_OBJECTNAME(HostGroup); std::set GetMembers(void) const; void AddMember(const Host::Ptr& host); diff --git a/lib/icinga/icingaapplication.hpp b/lib/icinga/icingaapplication.hpp index 4f159a8bf..a644ce871 100644 --- a/lib/icinga/icingaapplication.hpp +++ b/lib/icinga/icingaapplication.hpp @@ -35,8 +35,8 @@ namespace icinga class I2_ICINGA_API IcingaApplication : public ObjectImpl, public MacroResolver { public: - DECLARE_PTR_TYPEDEFS(IcingaApplication); - DECLARE_TYPENAME(IcingaApplication); + DECLARE_OBJECT(IcingaApplication); + DECLARE_OBJECTNAME(IcingaApplication); static void StaticInitialize(void); diff --git a/lib/icinga/icingastatuswriter.hpp b/lib/icinga/icingastatuswriter.hpp index 738abbcf6..652d7431c 100644 --- a/lib/icinga/icingastatuswriter.hpp +++ b/lib/icinga/icingastatuswriter.hpp @@ -32,8 +32,8 @@ namespace icinga class IcingaStatusWriter : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(IcingaStatusWriter); - DECLARE_TYPENAME(IcingaStatusWriter); + DECLARE_OBJECT(IcingaStatusWriter); + DECLARE_OBJECTNAME(IcingaStatusWriter); static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata); static Dictionary::Ptr GetStatusData(void); diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index 74108f9ea..8d0be46d8 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -122,7 +122,7 @@ bool MacroProcessor::ResolveMacro(const String& macro, const ResolverList& resol } else if (ref.IsObject()) { Object::Ptr object = ref; - const Type *type = object->GetReflectionType(); + Type::Ptr type = object->GetReflectionType(); if (!type) { valid = false; diff --git a/lib/icinga/macroresolver.hpp b/lib/icinga/macroresolver.hpp index 300145f2b..91631d4d7 100644 --- a/lib/icinga/macroresolver.hpp +++ b/lib/icinga/macroresolver.hpp @@ -36,7 +36,7 @@ namespace icinga class I2_ICINGA_API MacroResolver { public: - DECLARE_PTR_TYPEDEFS(MacroResolver); + DECLARE_OBJECT(MacroResolver); virtual bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const = 0; }; diff --git a/lib/icinga/notification.hpp b/lib/icinga/notification.hpp index 354f9d38b..9202c074c 100644 --- a/lib/icinga/notification.hpp +++ b/lib/icinga/notification.hpp @@ -76,8 +76,8 @@ class ApplyRule; class I2_ICINGA_API Notification : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Notification); - DECLARE_TYPENAME(Notification); + DECLARE_OBJECT(Notification); + DECLARE_OBJECTNAME(Notification); static void StaticInitialize(void); diff --git a/lib/icinga/notificationcommand.hpp b/lib/icinga/notificationcommand.hpp index 361541f18..2ab58e651 100644 --- a/lib/icinga/notificationcommand.hpp +++ b/lib/icinga/notificationcommand.hpp @@ -36,8 +36,8 @@ class Notification; class I2_ICINGA_API NotificationCommand : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(NotificationCommand); - DECLARE_TYPENAME(NotificationCommand); + DECLARE_OBJECT(NotificationCommand); + DECLARE_OBJECTNAME(NotificationCommand); virtual Dictionary::Ptr Execute(const shared_ptr& notification, const User::Ptr& user, const CheckResult::Ptr& cr, const NotificationType& type, diff --git a/lib/icinga/perfdatavalue.hpp b/lib/icinga/perfdatavalue.hpp index 019f590aa..0b413c005 100644 --- a/lib/icinga/perfdatavalue.hpp +++ b/lib/icinga/perfdatavalue.hpp @@ -29,7 +29,7 @@ namespace icinga class I2_ICINGA_API PerfdataValue : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(PerfdataValue); + DECLARE_OBJECT(PerfdataValue); PerfdataValue(void); diff --git a/lib/icinga/scheduleddowntime.hpp b/lib/icinga/scheduleddowntime.hpp index f34246a32..abc90f078 100644 --- a/lib/icinga/scheduleddowntime.hpp +++ b/lib/icinga/scheduleddowntime.hpp @@ -38,8 +38,8 @@ class ApplyRule; class I2_ICINGA_API ScheduledDowntime : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(ScheduledDowntime); - DECLARE_TYPENAME(ScheduledDowntime); + DECLARE_OBJECT(ScheduledDowntime); + DECLARE_OBJECTNAME(ScheduledDowntime); static void StaticInitialize(void); diff --git a/lib/icinga/service.hpp b/lib/icinga/service.hpp index 8219af067..2b51e9406 100644 --- a/lib/icinga/service.hpp +++ b/lib/icinga/service.hpp @@ -36,8 +36,8 @@ namespace icinga class I2_ICINGA_API Service : public ObjectImpl, public MacroResolver { public: - DECLARE_PTR_TYPEDEFS(Service); - DECLARE_TYPENAME(Service); + DECLARE_OBJECT(Service); + DECLARE_OBJECTNAME(Service); static Service::Ptr GetByNamePair(const String& hostName, const String& serviceName); diff --git a/lib/icinga/servicegroup.hpp b/lib/icinga/servicegroup.hpp index 8bffe6de4..016dc38a3 100644 --- a/lib/icinga/servicegroup.hpp +++ b/lib/icinga/servicegroup.hpp @@ -37,8 +37,8 @@ class ObjectRule; class I2_ICINGA_API ServiceGroup : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(ServiceGroup); - DECLARE_TYPENAME(ServiceGroup); + DECLARE_OBJECT(ServiceGroup); + DECLARE_OBJECTNAME(ServiceGroup); std::set GetMembers(void) const; void AddMember(const Service::Ptr& service); diff --git a/lib/icinga/timeperiod.hpp b/lib/icinga/timeperiod.hpp index 3e6d2a5da..4dd1de235 100644 --- a/lib/icinga/timeperiod.hpp +++ b/lib/icinga/timeperiod.hpp @@ -34,8 +34,8 @@ namespace icinga class I2_ICINGA_API TimePeriod : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(TimePeriod); - DECLARE_TYPENAME(TimePeriod); + DECLARE_OBJECT(TimePeriod); + DECLARE_OBJECTNAME(TimePeriod); static void StaticInitialize(void); diff --git a/lib/icinga/user.hpp b/lib/icinga/user.hpp index e001ad38e..304d8b995 100644 --- a/lib/icinga/user.hpp +++ b/lib/icinga/user.hpp @@ -36,8 +36,8 @@ namespace icinga class I2_ICINGA_API User : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(User); - DECLARE_TYPENAME(User); + DECLARE_OBJECT(User); + DECLARE_OBJECTNAME(User); void AddGroup(const String& name); diff --git a/lib/icinga/usergroup.hpp b/lib/icinga/usergroup.hpp index 9570161d0..981e385b2 100644 --- a/lib/icinga/usergroup.hpp +++ b/lib/icinga/usergroup.hpp @@ -37,8 +37,8 @@ class ObjectRule; class I2_ICINGA_API UserGroup : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(UserGroup); - DECLARE_TYPENAME(UserGroup); + DECLARE_OBJECT(UserGroup); + DECLARE_OBJECTNAME(UserGroup); std::set GetMembers(void) const; void AddMember(const User::Ptr& user); diff --git a/lib/livestatus/aggregator.hpp b/lib/livestatus/aggregator.hpp index 7c933b824..9e4a05c85 100644 --- a/lib/livestatus/aggregator.hpp +++ b/lib/livestatus/aggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class Aggregator : public Object { public: - DECLARE_PTR_TYPEDEFS(Aggregator); + DECLARE_OBJECT(Aggregator); virtual void Apply(const Table::Ptr& table, const Value& row) = 0; virtual double GetResult(void) const = 0; diff --git a/lib/livestatus/andfilter.hpp b/lib/livestatus/andfilter.hpp index 5b8a6b76f..9d36e4cfc 100644 --- a/lib/livestatus/andfilter.hpp +++ b/lib/livestatus/andfilter.hpp @@ -33,7 +33,7 @@ namespace icinga class AndFilter : public CombinerFilter { public: - DECLARE_PTR_TYPEDEFS(AndFilter); + DECLARE_OBJECT(AndFilter); AndFilter(void); diff --git a/lib/livestatus/attributefilter.hpp b/lib/livestatus/attributefilter.hpp index 43d750bb3..08a9aed67 100644 --- a/lib/livestatus/attributefilter.hpp +++ b/lib/livestatus/attributefilter.hpp @@ -33,7 +33,7 @@ namespace icinga class AttributeFilter : public Filter { public: - DECLARE_PTR_TYPEDEFS(AttributeFilter); + DECLARE_OBJECT(AttributeFilter); AttributeFilter(const String& column, const String& op, const String& operand); diff --git a/lib/livestatus/avgaggregator.hpp b/lib/livestatus/avgaggregator.hpp index 851a01796..4906dc5fe 100644 --- a/lib/livestatus/avgaggregator.hpp +++ b/lib/livestatus/avgaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class AvgAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(AvgAggregator); + DECLARE_OBJECT(AvgAggregator); AvgAggregator(const String& attr); diff --git a/lib/livestatus/combinerfilter.hpp b/lib/livestatus/combinerfilter.hpp index d962c36f2..ecfefee6c 100644 --- a/lib/livestatus/combinerfilter.hpp +++ b/lib/livestatus/combinerfilter.hpp @@ -33,7 +33,7 @@ namespace icinga class CombinerFilter : public Filter { public: - DECLARE_PTR_TYPEDEFS(CombinerFilter); + DECLARE_OBJECT(CombinerFilter); CombinerFilter(void); diff --git a/lib/livestatus/commandstable.hpp b/lib/livestatus/commandstable.hpp index 44bcf917a..36794b4a6 100644 --- a/lib/livestatus/commandstable.hpp +++ b/lib/livestatus/commandstable.hpp @@ -33,7 +33,7 @@ namespace icinga class CommandsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(CommandsTable); + DECLARE_OBJECT(CommandsTable); CommandsTable(void); diff --git a/lib/livestatus/commentstable.hpp b/lib/livestatus/commentstable.hpp index 0918c59f9..a42a4b9c7 100644 --- a/lib/livestatus/commentstable.hpp +++ b/lib/livestatus/commentstable.hpp @@ -33,7 +33,7 @@ namespace icinga class CommentsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(CommentsTable); + DECLARE_OBJECT(CommentsTable); CommentsTable(void); diff --git a/lib/livestatus/contactgroupstable.hpp b/lib/livestatus/contactgroupstable.hpp index 26f41b5e2..dd34ee387 100644 --- a/lib/livestatus/contactgroupstable.hpp +++ b/lib/livestatus/contactgroupstable.hpp @@ -33,7 +33,7 @@ namespace icinga class ContactGroupsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(ContactGroupsTable); + DECLARE_OBJECT(ContactGroupsTable); ContactGroupsTable(void); diff --git a/lib/livestatus/contactstable.hpp b/lib/livestatus/contactstable.hpp index dfabb9ef2..e8997bc0f 100644 --- a/lib/livestatus/contactstable.hpp +++ b/lib/livestatus/contactstable.hpp @@ -33,7 +33,7 @@ namespace icinga class ContactsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(ContactsTable); + DECLARE_OBJECT(ContactsTable); ContactsTable(void); diff --git a/lib/livestatus/countaggregator.hpp b/lib/livestatus/countaggregator.hpp index 61860962e..5e927934a 100644 --- a/lib/livestatus/countaggregator.hpp +++ b/lib/livestatus/countaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class CountAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(CountAggregator); + DECLARE_OBJECT(CountAggregator); CountAggregator(void); diff --git a/lib/livestatus/downtimestable.hpp b/lib/livestatus/downtimestable.hpp index 29435346d..b45d3940b 100644 --- a/lib/livestatus/downtimestable.hpp +++ b/lib/livestatus/downtimestable.hpp @@ -33,7 +33,7 @@ namespace icinga class DowntimesTable : public Table { public: - DECLARE_PTR_TYPEDEFS(DowntimesTable); + DECLARE_OBJECT(DowntimesTable); DowntimesTable(void); diff --git a/lib/livestatus/endpointstable.hpp b/lib/livestatus/endpointstable.hpp index 9ccc9f230..5d43e6dc2 100644 --- a/lib/livestatus/endpointstable.hpp +++ b/lib/livestatus/endpointstable.hpp @@ -33,7 +33,7 @@ namespace icinga class EndpointsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(EndpointsTable); + DECLARE_OBJECT(EndpointsTable); EndpointsTable(void); diff --git a/lib/livestatus/filter.hpp b/lib/livestatus/filter.hpp index f8d9d1ed5..3ee1e7c77 100644 --- a/lib/livestatus/filter.hpp +++ b/lib/livestatus/filter.hpp @@ -31,7 +31,7 @@ namespace icinga class Filter : public Object { public: - DECLARE_PTR_TYPEDEFS(Filter); + DECLARE_OBJECT(Filter); virtual bool Apply(const Table::Ptr& table, const Value& row) = 0; diff --git a/lib/livestatus/hostgroupstable.hpp b/lib/livestatus/hostgroupstable.hpp index 01872b4ae..68cd341d5 100644 --- a/lib/livestatus/hostgroupstable.hpp +++ b/lib/livestatus/hostgroupstable.hpp @@ -33,7 +33,7 @@ namespace icinga class HostGroupsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(HostGroupsTable); + DECLARE_OBJECT(HostGroupsTable); HostGroupsTable(void); diff --git a/lib/livestatus/hoststable.hpp b/lib/livestatus/hoststable.hpp index 9896615e0..57f260483 100644 --- a/lib/livestatus/hoststable.hpp +++ b/lib/livestatus/hoststable.hpp @@ -33,7 +33,7 @@ namespace icinga class HostsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(HostsTable); + DECLARE_OBJECT(HostsTable); HostsTable(void); diff --git a/lib/livestatus/invavgaggregator.hpp b/lib/livestatus/invavgaggregator.hpp index d85898483..adcfedc3b 100644 --- a/lib/livestatus/invavgaggregator.hpp +++ b/lib/livestatus/invavgaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class InvAvgAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(InvAvgAggregator); + DECLARE_OBJECT(InvAvgAggregator); InvAvgAggregator(const String& attr); diff --git a/lib/livestatus/invsumaggregator.hpp b/lib/livestatus/invsumaggregator.hpp index b15648bdc..e288813c7 100644 --- a/lib/livestatus/invsumaggregator.hpp +++ b/lib/livestatus/invsumaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class InvSumAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(InvSumAggregator); + DECLARE_OBJECT(InvSumAggregator); InvSumAggregator(const String& attr); diff --git a/lib/livestatus/livestatuslistener.hpp b/lib/livestatus/livestatuslistener.hpp index 56672721a..14cf5527d 100644 --- a/lib/livestatus/livestatuslistener.hpp +++ b/lib/livestatus/livestatuslistener.hpp @@ -36,8 +36,8 @@ namespace icinga class LivestatusListener : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(LivestatusListener); - DECLARE_TYPENAME(LivestatusListener); + DECLARE_OBJECT(LivestatusListener); + DECLARE_OBJECTNAME(LivestatusListener); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/livestatus/livestatusquery.hpp b/lib/livestatus/livestatusquery.hpp index 65af9fc38..da9a6d429 100644 --- a/lib/livestatus/livestatusquery.hpp +++ b/lib/livestatus/livestatusquery.hpp @@ -45,7 +45,7 @@ enum LivestatusError class LivestatusQuery : public Object { public: - DECLARE_PTR_TYPEDEFS(LivestatusQuery); + DECLARE_OBJECT(LivestatusQuery); LivestatusQuery(const std::vector& lines, const String& compat_log_path); diff --git a/lib/livestatus/logtable.hpp b/lib/livestatus/logtable.hpp index 44c3e1dc7..6f1c22cbe 100644 --- a/lib/livestatus/logtable.hpp +++ b/lib/livestatus/logtable.hpp @@ -34,7 +34,7 @@ namespace icinga class LogTable : public HistoryTable { public: - DECLARE_PTR_TYPEDEFS(LogTable); + DECLARE_OBJECT(LogTable); LogTable(const String& compat_log_path, time_t from, time_t until); diff --git a/lib/livestatus/maxaggregator.hpp b/lib/livestatus/maxaggregator.hpp index 315874803..9f2a9b062 100644 --- a/lib/livestatus/maxaggregator.hpp +++ b/lib/livestatus/maxaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class MaxAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(MaxAggregator); + DECLARE_OBJECT(MaxAggregator); MaxAggregator(const String& attr); diff --git a/lib/livestatus/minaggregator.hpp b/lib/livestatus/minaggregator.hpp index d1280e3c7..7e36c71d3 100644 --- a/lib/livestatus/minaggregator.hpp +++ b/lib/livestatus/minaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class MinAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(MinAggregator); + DECLARE_OBJECT(MinAggregator); MinAggregator(const String& attr); diff --git a/lib/livestatus/negatefilter.hpp b/lib/livestatus/negatefilter.hpp index 742902bf8..742a0bbcd 100644 --- a/lib/livestatus/negatefilter.hpp +++ b/lib/livestatus/negatefilter.hpp @@ -33,7 +33,7 @@ namespace icinga class NegateFilter : public Filter { public: - DECLARE_PTR_TYPEDEFS(NegateFilter); + DECLARE_OBJECT(NegateFilter); NegateFilter(const Filter::Ptr& inner); diff --git a/lib/livestatus/orfilter.hpp b/lib/livestatus/orfilter.hpp index 6f5fcf3c0..f1a4794df 100644 --- a/lib/livestatus/orfilter.hpp +++ b/lib/livestatus/orfilter.hpp @@ -33,7 +33,7 @@ namespace icinga class OrFilter : public CombinerFilter { public: - DECLARE_PTR_TYPEDEFS(OrFilter); + DECLARE_OBJECT(OrFilter); OrFilter(void); diff --git a/lib/livestatus/servicegroupstable.hpp b/lib/livestatus/servicegroupstable.hpp index bad828410..4f01b6ebe 100644 --- a/lib/livestatus/servicegroupstable.hpp +++ b/lib/livestatus/servicegroupstable.hpp @@ -33,7 +33,7 @@ namespace icinga class ServiceGroupsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(ServiceGroupsTable); + DECLARE_OBJECT(ServiceGroupsTable); ServiceGroupsTable(void); diff --git a/lib/livestatus/servicestable.hpp b/lib/livestatus/servicestable.hpp index 105d6d0be..8446a5819 100644 --- a/lib/livestatus/servicestable.hpp +++ b/lib/livestatus/servicestable.hpp @@ -33,7 +33,7 @@ namespace icinga class ServicesTable : public Table { public: - DECLARE_PTR_TYPEDEFS(ServicesTable); + DECLARE_OBJECT(ServicesTable); ServicesTable(void); diff --git a/lib/livestatus/statehisttable.hpp b/lib/livestatus/statehisttable.hpp index fa01cdca7..18b9595c3 100644 --- a/lib/livestatus/statehisttable.hpp +++ b/lib/livestatus/statehisttable.hpp @@ -35,7 +35,7 @@ namespace icinga class StateHistTable : public HistoryTable { public: - DECLARE_PTR_TYPEDEFS(StateHistTable); + DECLARE_OBJECT(StateHistTable); StateHistTable(const String& compat_log_path, time_t from, time_t until); diff --git a/lib/livestatus/statustable.hpp b/lib/livestatus/statustable.hpp index 43a694bde..97da50975 100644 --- a/lib/livestatus/statustable.hpp +++ b/lib/livestatus/statustable.hpp @@ -33,7 +33,7 @@ namespace icinga class StatusTable : public Table { public: - DECLARE_PTR_TYPEDEFS(StatusTable); + DECLARE_OBJECT(StatusTable); StatusTable(void); diff --git a/lib/livestatus/stdaggregator.hpp b/lib/livestatus/stdaggregator.hpp index 070bcca70..dfd0557e1 100644 --- a/lib/livestatus/stdaggregator.hpp +++ b/lib/livestatus/stdaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class StdAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(StdAggregator); + DECLARE_OBJECT(StdAggregator); StdAggregator(const String& attr); diff --git a/lib/livestatus/sumaggregator.hpp b/lib/livestatus/sumaggregator.hpp index b5693a776..811c62b4f 100644 --- a/lib/livestatus/sumaggregator.hpp +++ b/lib/livestatus/sumaggregator.hpp @@ -32,7 +32,7 @@ namespace icinga class SumAggregator : public Aggregator { public: - DECLARE_PTR_TYPEDEFS(SumAggregator); + DECLARE_OBJECT(SumAggregator); SumAggregator(const String& attr); diff --git a/lib/livestatus/table.hpp b/lib/livestatus/table.hpp index 5844f4acf..c04133fb5 100644 --- a/lib/livestatus/table.hpp +++ b/lib/livestatus/table.hpp @@ -38,7 +38,7 @@ class Filter; class Table : public Object { public: - DECLARE_PTR_TYPEDEFS(Table); + DECLARE_OBJECT(Table); static Table::Ptr GetByName(const String& name, const String& compat_log_path = "", const unsigned long& from = 0, const unsigned long& until = 0); diff --git a/lib/livestatus/timeperiodstable.hpp b/lib/livestatus/timeperiodstable.hpp index f473b1674..bbf13617f 100644 --- a/lib/livestatus/timeperiodstable.hpp +++ b/lib/livestatus/timeperiodstable.hpp @@ -33,7 +33,7 @@ namespace icinga class TimePeriodsTable : public Table { public: - DECLARE_PTR_TYPEDEFS(TimePeriodsTable); + DECLARE_OBJECT(TimePeriodsTable); TimePeriodsTable(void); diff --git a/lib/notification/notificationcomponent.hpp b/lib/notification/notificationcomponent.hpp index babca9897..ea1bcdfdb 100644 --- a/lib/notification/notificationcomponent.hpp +++ b/lib/notification/notificationcomponent.hpp @@ -34,8 +34,8 @@ namespace icinga class NotificationComponent : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(NotificationComponent); - DECLARE_TYPENAME(NotificationComponent); + DECLARE_OBJECT(NotificationComponent); + DECLARE_OBJECTNAME(NotificationComponent); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/perfdata/graphitewriter.hpp b/lib/perfdata/graphitewriter.hpp index 6e9520b5b..f0128266a 100644 --- a/lib/perfdata/graphitewriter.hpp +++ b/lib/perfdata/graphitewriter.hpp @@ -38,8 +38,8 @@ namespace icinga class GraphiteWriter : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(GraphiteWriter); - DECLARE_TYPENAME(GraphiteWriter); + DECLARE_OBJECT(GraphiteWriter); + DECLARE_OBJECTNAME(GraphiteWriter); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/perfdata/perfdatawriter.hpp b/lib/perfdata/perfdatawriter.hpp index b7d48e560..0e3caf0ab 100644 --- a/lib/perfdata/perfdatawriter.hpp +++ b/lib/perfdata/perfdatawriter.hpp @@ -37,8 +37,8 @@ namespace icinga class PerfdataWriter : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(PerfdataWriter); - DECLARE_TYPENAME(PerfdataWriter); + DECLARE_OBJECT(PerfdataWriter); + DECLARE_OBJECTNAME(PerfdataWriter); static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata); diff --git a/lib/remote/apiclient.hpp b/lib/remote/apiclient.hpp index 9c05a4f1e..eca972f2b 100644 --- a/lib/remote/apiclient.hpp +++ b/lib/remote/apiclient.hpp @@ -43,7 +43,7 @@ enum ClientRole class I2_REMOTE_API ApiClient : public Object { public: - DECLARE_PTR_TYPEDEFS(ApiClient); + DECLARE_OBJECT(ApiClient); ApiClient(const String& identity, bool authenticated, const TlsStream::Ptr& stream, ConnectionRole role); diff --git a/lib/remote/apifunction.hpp b/lib/remote/apifunction.hpp index 72da522d4..30abb9e83 100644 --- a/lib/remote/apifunction.hpp +++ b/lib/remote/apifunction.hpp @@ -39,7 +39,7 @@ namespace icinga class I2_REMOTE_API ApiFunction : public Object { public: - DECLARE_PTR_TYPEDEFS(ApiFunction); + DECLARE_OBJECT(ApiFunction); typedef boost::function Callback; diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index a02eb619f..deea3e746 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -42,8 +42,8 @@ class ApiClient; class I2_REMOTE_API ApiListener : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(ApiListener); - DECLARE_TYPENAME(ApiListener); + DECLARE_OBJECT(ApiListener); + DECLARE_OBJECTNAME(ApiListener); static boost::signals2::signal OnMasterChanged; diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index d732600ba..ee92088c7 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -38,8 +38,8 @@ class Zone; class I2_REMOTE_API Endpoint : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Endpoint); - DECLARE_TYPENAME(Endpoint); + DECLARE_OBJECT(Endpoint); + DECLARE_OBJECTNAME(Endpoint); static boost::signals2::signal&)> OnConnected; static boost::signals2::signal&)> OnDisconnected; diff --git a/lib/remote/zone.hpp b/lib/remote/zone.hpp index 1a17c5c18..ea1ab7464 100644 --- a/lib/remote/zone.hpp +++ b/lib/remote/zone.hpp @@ -33,8 +33,8 @@ namespace icinga class I2_REMOTE_API Zone : public ObjectImpl { public: - DECLARE_PTR_TYPEDEFS(Zone); - DECLARE_TYPENAME(Zone); + DECLARE_OBJECT(Zone); + DECLARE_OBJECTNAME(Zone); Zone::Ptr GetParent(void) const; std::set GetEndpoints(void) const; diff --git a/test/base-object.cpp b/test/base-object.cpp index 8be052703..985ae0dcd 100644 --- a/test/base-object.cpp +++ b/test/base-object.cpp @@ -26,7 +26,7 @@ using namespace icinga; class TestObject : public Object { public: - DECLARE_PTR_TYPEDEFS(TestObject); + DECLARE_OBJECT(TestObject); TestObject::Ptr GetTestRef(void) { diff --git a/test/base-type.cpp b/test/base-type.cpp index 8a4ee5e31..e03a68e0c 100644 --- a/test/base-type.cpp +++ b/test/base-type.cpp @@ -32,15 +32,15 @@ BOOST_AUTO_TEST_SUITE(base_type) BOOST_AUTO_TEST_CASE(gettype) { - const Type *t = Type::GetByName("Application"); + Type::Ptr t = Type::GetByName("Application"); BOOST_CHECK(t); } BOOST_AUTO_TEST_CASE(assign) { - const Type *t1 = Type::GetByName("Application"); - const Type *t2 = Type::GetByName("DynamicObject"); + Type::Ptr t1 = Type::GetByName("Application"); + Type::Ptr t2 = Type::GetByName("DynamicObject"); BOOST_CHECK(t1->IsAssignableFrom(t1)); BOOST_CHECK(t2->IsAssignableFrom(t1)); @@ -49,14 +49,14 @@ BOOST_AUTO_TEST_CASE(assign) BOOST_AUTO_TEST_CASE(byname) { - const Type *t = Type::GetByName("Application"); + Type::Ptr t = Type::GetByName("Application"); BOOST_CHECK(t); } BOOST_AUTO_TEST_CASE(instantiate) { - const Type *t = Type::GetByName("PerfdataValue"); + Type::Ptr t = Type::GetByName("PerfdataValue"); Object::Ptr p = t->Instantiate(); diff --git a/tools/mkclass/classcompiler.cpp b/tools/mkclass/classcompiler.cpp index 4795fecff..808b7a329 100644 --- a/tools/mkclass/classcompiler.cpp +++ b/tools/mkclass/classcompiler.cpp @@ -139,7 +139,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) << "\t" << "}" << std::endl << std::endl; /* GetBaseType */ - std::cout << "\t" << "virtual const Type *GetBaseType(void) const" << std::endl + std::cout << "\t" << "virtual Type::Ptr GetBaseType(void) const" << std::endl << "\t" << "{" << std::endl; std::cout << "\t\t" << "return "; @@ -147,7 +147,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) if (!klass.Parent.empty()) std::cout << "Type::GetByName(\"" << klass.Parent << "\")"; else - std::cout << "NULL"; + std::cout << "Type::Ptr()"; std::cout << ";" << std::endl << "\t" << "}" << std::endl << std::endl; @@ -302,13 +302,8 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) << " : public " << (klass.Parent.empty() ? "Object" : klass.Parent) << std::endl << "{" << std::endl << "public:" << std::endl - << "\t" << "DECLARE_PTR_TYPEDEFS(ObjectImpl<" << klass.Name << ">);" << std::endl << std::endl; - - /* GetReflectionType */ - std::cout << "\t" << "virtual const Type *GetReflectionType(void) const" << std::endl - << "\t" << "{" << std::endl - << "\t\t" << "return Type::GetByName(\"" << klass.Name << "\");" << std::endl - << "\t" << "}" << std::endl << std::endl; + << "\t" << "DECLARE_PTR_TYPEDEFS(ObjectImpl<" << klass.Name << ">);" << std::endl + << "\t" << "IMPL_TYPE_LOOKUP(" << klass.Name << ");" << std::endl << std::endl; if (!klass.Fields.empty()) { /* constructor */ -- 2.40.0