]> granicus.if.org Git - icinga2/commitdiff
Implement typeof() function
authorGunnar Beutner <gunnar@beutner.name>
Sun, 2 Nov 2014 23:44:04 +0000 (00:44 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sun, 2 Nov 2014 23:45:14 +0000 (00:45 +0100)
157 files changed:
lib/base/application.hpp
lib/base/array.hpp
lib/base/dictionary.hpp
lib/base/dynamicobject.hpp
lib/base/dynamictype.cpp
lib/base/dynamictype.hpp
lib/base/fifo.hpp
lib/base/filelogger.hpp
lib/base/logger.hpp
lib/base/networkstream.hpp
lib/base/object.cpp
lib/base/object.hpp
lib/base/primitivetype.cpp
lib/base/primitivetype.hpp
lib/base/process.hpp
lib/base/ringbuffer.hpp
lib/base/scriptfunction.hpp
lib/base/scriptutils.cpp
lib/base/scriptutils.hpp
lib/base/scriptvariable.hpp
lib/base/serializer.cpp
lib/base/socket.hpp
lib/base/statsfunction.hpp
lib/base/stdiostream.hpp
lib/base/stream.hpp
lib/base/streamlogger.hpp
lib/base/sysloglogger.hpp
lib/base/tcpsocket.hpp
lib/base/timer.hpp
lib/base/tlsstream.hpp
lib/base/type.cpp
lib/base/type.hpp
lib/base/unixsocket.hpp
lib/base/value.cpp
lib/checker/checkercomponent.hpp
lib/cli/clicommand.cpp
lib/cli/clicommand.hpp
lib/cli/daemoncommand.hpp
lib/cli/featuredisablecommand.hpp
lib/cli/featureenablecommand.hpp
lib/cli/featurelistcommand.hpp
lib/cli/nodeaddcommand.hpp
lib/cli/nodeblackandwhitelistcommand.hpp
lib/cli/nodelistcommand.hpp
lib/cli/noderemovecommand.hpp
lib/cli/nodesetcommand.hpp
lib/cli/nodesetupcommand.hpp
lib/cli/nodeupdateconfigcommand.hpp
lib/cli/nodewizardcommand.hpp
lib/cli/objectlistcommand.hpp
lib/cli/pkinewcacommand.hpp
lib/cli/pkinewcertcommand.hpp
lib/cli/pkirequestcommand.hpp
lib/cli/pkisavecertcommand.hpp
lib/cli/pkisigncsrcommand.hpp
lib/cli/pkiticketcommand.hpp
lib/cli/repositoryclearchangescommand.hpp
lib/cli/repositorycommitcommand.hpp
lib/cli/repositoryobjectcommand.cpp
lib/cli/repositoryobjectcommand.hpp
lib/cli/variablegetcommand.hpp
lib/cli/variablelistcommand.hpp
lib/compat/checkresultreader.hpp
lib/compat/compatlogger.hpp
lib/compat/externalcommandlistener.hpp
lib/compat/statusdatawriter.hpp
lib/config/configitem.cpp
lib/config/configitem.hpp
lib/config/configitembuilder.hpp
lib/config/configtype.hpp
lib/config/expression.cpp
lib/config/expression.hpp
lib/config/typerulelist.hpp
lib/db_ido/commanddbobject.hpp
lib/db_ido/dbconnection.hpp
lib/db_ido/dbobject.hpp
lib/db_ido/dbtype.hpp
lib/db_ido/dbvalue.hpp
lib/db_ido/endpointdbobject.hpp
lib/db_ido/hostdbobject.hpp
lib/db_ido/hostgroupdbobject.hpp
lib/db_ido/servicedbobject.hpp
lib/db_ido/servicegroupdbobject.hpp
lib/db_ido/timeperioddbobject.hpp
lib/db_ido/userdbobject.hpp
lib/db_ido/usergroupdbobject.hpp
lib/db_ido_mysql/idomysqlconnection.hpp
lib/db_ido_pgsql/idopgsqlconnection.hpp
lib/demo/demo.hpp
lib/hello/hello.hpp
lib/icinga/checkable.hpp
lib/icinga/checkcommand.hpp
lib/icinga/checkresult.hpp
lib/icinga/command.hpp
lib/icinga/comment.hpp
lib/icinga/customvarobject.hpp
lib/icinga/dependency.hpp
lib/icinga/downtime.hpp
lib/icinga/eventcommand.hpp
lib/icinga/host.hpp
lib/icinga/hostgroup.hpp
lib/icinga/icingaapplication.hpp
lib/icinga/icingastatuswriter.hpp
lib/icinga/macroprocessor.cpp
lib/icinga/macroresolver.hpp
lib/icinga/notification.hpp
lib/icinga/notificationcommand.hpp
lib/icinga/perfdatavalue.hpp
lib/icinga/scheduleddowntime.hpp
lib/icinga/service.hpp
lib/icinga/servicegroup.hpp
lib/icinga/timeperiod.hpp
lib/icinga/user.hpp
lib/icinga/usergroup.hpp
lib/livestatus/aggregator.hpp
lib/livestatus/andfilter.hpp
lib/livestatus/attributefilter.hpp
lib/livestatus/avgaggregator.hpp
lib/livestatus/combinerfilter.hpp
lib/livestatus/commandstable.hpp
lib/livestatus/commentstable.hpp
lib/livestatus/contactgroupstable.hpp
lib/livestatus/contactstable.hpp
lib/livestatus/countaggregator.hpp
lib/livestatus/downtimestable.hpp
lib/livestatus/endpointstable.hpp
lib/livestatus/filter.hpp
lib/livestatus/hostgroupstable.hpp
lib/livestatus/hoststable.hpp
lib/livestatus/invavgaggregator.hpp
lib/livestatus/invsumaggregator.hpp
lib/livestatus/livestatuslistener.hpp
lib/livestatus/livestatusquery.hpp
lib/livestatus/logtable.hpp
lib/livestatus/maxaggregator.hpp
lib/livestatus/minaggregator.hpp
lib/livestatus/negatefilter.hpp
lib/livestatus/orfilter.hpp
lib/livestatus/servicegroupstable.hpp
lib/livestatus/servicestable.hpp
lib/livestatus/statehisttable.hpp
lib/livestatus/statustable.hpp
lib/livestatus/stdaggregator.hpp
lib/livestatus/sumaggregator.hpp
lib/livestatus/table.hpp
lib/livestatus/timeperiodstable.hpp
lib/notification/notificationcomponent.hpp
lib/perfdata/graphitewriter.hpp
lib/perfdata/perfdatawriter.hpp
lib/remote/apiclient.hpp
lib/remote/apifunction.hpp
lib/remote/apilistener.hpp
lib/remote/endpoint.hpp
lib/remote/zone.hpp
test/base-object.cpp
test/base-type.cpp
tools/mkclass/classcompiler.cpp

index ac5becb0da7643e30600b0c58c0680f9d243eb0e..c346183cf561fdc038422eb77963e55037b19b15 100644 (file)
@@ -36,7 +36,7 @@ namespace icinga
  */
 class I2_BASE_API Application : public ObjectImpl<Application> {
 public:
-       DECLARE_PTR_TYPEDEFS(Application);
+       DECLARE_OBJECT(Application);
 
        static boost::signals2::signal<void (void)> OnReopenLogs;
 
index bfbea258847a9075c110c4d3b732ebc3b1012bd9..6ac24d1edbeda8dcb72f6668069ea43bd971f328 100644 (file)
@@ -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.
index 754182b1c4fce0be02b8480653abc06c06e294f7..c90f5f170ac7a93fc46c37d8d2b456f077aa2a45 100644 (file)
@@ -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.
index 68611f89ab726bbe16f67924020687b709b83e11..31e76414692d28278ab2d9f751583170f0099f9b 100644 (file)
@@ -42,7 +42,7 @@ class DynamicType;
 class I2_BASE_API DynamicObject : public ObjectImpl<DynamicObject>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(DynamicObject);
+       DECLARE_OBJECT(DynamicObject);
 
        static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStarted;
        static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStopped;
@@ -101,7 +101,7 @@ private:
        DebugInfo m_DebugInfo;
 };
 
-#define DECLARE_TYPENAME(klass)                                                \
+#define DECLARE_OBJECTNAME(klass)                                              \
        inline static String GetTypeName(void)                          \
        {                                                               \
                return #klass;                                          \
index 6ee72e716408f5539492f73e5cf79013598c5e1b..024c59136cae33d3e70a74f582fd12754b62b064 100644 (file)
@@ -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();
 
index fd5271f59a640eaae2f62f0fb7ad71dbd8ff8dff..824d04e67d58db7a1fced2bfebeb39e9823153c6 100644 (file)
@@ -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);
 
index 5534e5e4f381557c56014d6268f779cd0f6222ac..4fffc01264d3b2c97fc1a0cba3dd46905bd01dd5 100644 (file)
@@ -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;
 
index 4130d6d0e2ffd76d105ad3d34d22c825b37181d8..f818482ca257517a6a13863ddfc10ab3fd7aaa4c 100644 (file)
@@ -34,8 +34,8 @@ namespace icinga
 class I2_BASE_API FileLogger : public ObjectImpl<FileLogger>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(FileLogger);
-       DECLARE_TYPENAME(FileLogger);
+       DECLARE_OBJECT(FileLogger);
+       DECLARE_OBJECTNAME(FileLogger);
 
        static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata);
 
index f434de7bd2d02b3e65b42cecf8040c9bca6aad9e..e8b1c141c44e87625f056f3d3f1c4262de1e63b8 100644 (file)
@@ -62,7 +62,7 @@ struct LogEntry {
 class I2_BASE_API Logger : public ObjectImpl<Logger>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Logger);
+       DECLARE_OBJECT(Logger);
 
        static String SeverityToString(LogSeverity severity);
        static LogSeverity StringToSeverity(const String& severity);
index aae07edf573aa0e83990365e59a67afde257a119..c123063a01f310b47653889db22742b363422e0f 100644 (file)
@@ -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);
 
index 713e51a77ace7b4282b539cab195aca5d37848ca..b4361f901c5cdba6fd49e0a100eceeb39f636c83 100644 (file)
@@ -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);
+}
+
index c4832010ab672ca97ed0b6fe1c69b3a48b92d5b3..c158b9a5c2e591123aa1b829895466b7825c2100 100644 (file)
@@ -53,8 +53,20 @@ class Value;
        typedef shared_ptr<klass> Ptr; \
        typedef weak_ptr<klass> WeakPtr
 
+#define IMPL_TYPE_LOOKUP(klass) \
+       inline virtual shared_ptr<Type> 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<Type> 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<Object>
 {
 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;
 
index 306070c6379c4a513b80d6d7f63571bfa44adf94..161b889bb5fde267da7004967b9b157b255623ac 100644 (file)
@@ -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
index 8e82edaa94808d9f73362c16375d100be11f47af..70e942a589369ca7a1d41bd7dcb82a56ef1cf478 100644 (file)
@@ -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<PrimitiveType>(#type); \
                        icinga::Type::Register(t); \
                } \
                \
index a23942ba2601ba7dd58c80a6a053cdd126e0f1bd..2ccda78f64bc7ed3fa43dfac25d554d25250f33b 100644 (file)
@@ -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;
index cb8d96950ff5c074f42b24aee17b3cfe14cef44c..3ca2b821d556c4bf319be5a75c0aa68039a93c03 100644 (file)
@@ -35,7 +35,7 @@ namespace icinga
 class I2_BASE_API RingBuffer : public Object
 {
 public:
-       DECLARE_PTR_TYPEDEFS(RingBuffer);
+       DECLARE_OBJECT(RingBuffer);
 
        typedef std::vector<int>::size_type SizeType;
 
index aa50d7f7c804370e6c59e6dfedf98f3866a42eb0..99055b2ee9c4941961bb22211df81a0c1009e84d 100644 (file)
@@ -37,7 +37,7 @@ namespace icinga
 class I2_BASE_API ScriptFunction : public Object
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ScriptFunction);
+       DECLARE_OBJECT(ScriptFunction);
 
        typedef boost::function<Value (const std::vector<Value>& arguments)> Callback;
 
index a4573ff661242567168144137c435da264071eb9..c7496640ed39bfd152619692ed6d4685293e39b5 100644 (file)
@@ -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<Object::Ptr>(value)->GetReflectionType();
+               default:
+                       VERIFY(!"Invalid value type.");
+       }
+}
index 633d74009075bcf53b81518422a4af950cf1eaf5..99e5f000a6e8dc624b0b11703cfd2b8b90c7f6d1 100644 (file)
@@ -40,6 +40,7 @@ public:
        static void Log(const std::vector<Value>& arguments);
        static Array::Ptr Range(const std::vector<Value>& arguments);
        static void Exit(int code);
+       static Type::Ptr TypeOf(const Value& value);
 
 private:
        ScriptUtils(void);
index 602c524c084a8354be003055aea2a92225b9d6af..a0a80b0d21442cd00e2ad9ba7f97ecc817a14336 100644 (file)
@@ -43,7 +43,7 @@ public:
 class I2_BASE_API ScriptVariable : public Object
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ScriptVariable);
+       DECLARE_OBJECT(ScriptVariable);
 
        ScriptVariable(const Value& data);
 
index 196adc77b06713174b1f2e4a08dcd085e17b67fe..2b3478fa525d1864f39288957334ea3dc2520920 100644 (file)
@@ -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
index 429b7f24ebba9f2a100c446dc9af304b32c4f6c5..a118d85f82f0ab625d1a7334fa029df602a61826 100644 (file)
@@ -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);
index 3f08565deacda305d873785ac6d8c3423bad141c..3dd2ddb757eaee74bc706157a21373314a9210fa 100644 (file)
@@ -38,7 +38,7 @@ namespace icinga
 class I2_BASE_API StatsFunction : public Object
 {
 public:
-       DECLARE_PTR_TYPEDEFS(StatsFunction);
+       DECLARE_OBJECT(StatsFunction);
 
        typedef boost::function<Value (Dictionary::Ptr& status, Array::Ptr& perfdata)> Callback;
 
index b79fcceffde3b2ffb3647e3e1779d321d760fab3..937d6b5be579c6b484c3dec879f9c8638b4a787a 100644 (file)
@@ -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);
index 8a6120b08847614b3a4334fde61347f86500f3fa..c8a7d272f7a75b668c231af16b4a3a5ac252cc8c 100644 (file)
@@ -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.
index bc340f6a9e2e48e938982e754b38e89a00e2e73e..d9682fb0852d011015ad97295a2c11f4276ac6ec 100644 (file)
@@ -36,7 +36,7 @@ namespace icinga
 class I2_BASE_API StreamLogger : public ObjectImpl<StreamLogger>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(StreamLogger);
+       DECLARE_OBJECT(StreamLogger);
 
        virtual void Start(void);
        virtual void Stop(void);
index 694e44b01377cbf7f1fa424c50884c0651079a0a..d29d2627d253f81a473a708c7eefe28d901f6d34 100644 (file)
@@ -35,8 +35,8 @@ namespace icinga
 class I2_BASE_API SyslogLogger : public ObjectImpl<SyslogLogger>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(SyslogLogger);
-       DECLARE_TYPENAME(SyslogLogger);
+       DECLARE_OBJECT(SyslogLogger);
+       DECLARE_OBJECTNAME(SyslogLogger);
 
        static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata);
 
index 902874eafb48e34eeb4cde3cd7d7db2ffded7b2c..c250e53c991329c5feaa075fe785f4d9415935d6 100644 (file)
@@ -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);
index 8c855071578a8618cd801f92ddc2fd604ccdd382..bb70d517351b4734f2ee1bd4dd3d32fca261fcb1 100644 (file)
@@ -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);
index 00b24ce3b2f0779f90af037493660ddeffef0298..6303a17f6be6dab2a115ba257578ee163070c35d 100644 (file)
@@ -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<SSL_CTX>& sslContext);
 
index 4e191c5df7a7e0dc77211e8648768d89f7e10787..f14102a686f03ff27b5040fdbfa458392d93771e 100644 (file)
@@ -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<String, const Type *>::const_iterator it;
+       std::map<String, Type::Ptr>::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;
        }
 
index 67ffceee93f892b09ca9439aa145e0cfb8ef45f8..b4ab7b6ff1f16997be759ed19a27a12fc79ec609 100644 (file)
@@ -42,11 +42,11 @@ class Type;
 struct Field
 {
        int ID;
-       const Type *FType;
+       shared_ptr<Type> FType;
        const char *Name;
        int Attributes;
 
-       Field(int id, const Type *type, const char *name, int attributes)
+       Field(int id, const shared_ptr<Type>& 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<Object::Ptr (void)> 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<String, const Type *> TypeMap;
+       typedef std::map<String, Type::Ptr> 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<type>(); \
+                       icinga::Type::Ptr t = make_shared<TypeImpl<type> >(); \
                        t->SetFactory(FactoryHelper<type>().GetFactory()); \
                        icinga::Type::Register(t); \
                } \
index f72ac9a93d766cc6b1bcfb1dca44acfa81c3b8be..1d120133a9c1f1b8f3ca9931f68fcd1be6973cc1 100644 (file)
@@ -29,7 +29,7 @@ namespace icinga
 class I2_BASE_API UnixSocket : public Socket
 {
 public:
-       DECLARE_PTR_TYPEDEFS(UnixSocket);
+       DECLARE_OBJECT(UnixSocket);
 
        UnixSocket(void);
 
index 9dff7cee23ec76ee4896427469c8cdd30bbca52f..0f68ef799de6fc58d78091d2346fca9b64e4369c 100644 (file)
@@ -148,7 +148,7 @@ ValueType Value::GetType(void) const
 
 String Value::GetTypeName(void) const
 {
-       const Type *t;
+       Type::Ptr t;
 
        switch (GetType()) {
                case ValueEmpty:
index ad83ad980821db38ffd5572de46d8f43b8318302..53b6b4aede7485749bd94f4ff0cd742315e98957 100644 (file)
@@ -57,8 +57,8 @@ struct CheckableNextCheckExtractor
 class CheckerComponent : public ObjectImpl<CheckerComponent>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CheckerComponent);
-       DECLARE_TYPENAME(CheckerComponent);
+       DECLARE_OBJECT(CheckerComponent);
+       DECLARE_OBJECTNAME(CheckerComponent);
 
        typedef boost::multi_index_container<
                Checkable::Ptr,
index 159f9d7e5fd2079937055936361539ff83fa1fe0..62e899bd2e4fba7b34cd440762d58710d62c207d 100644 (file)
@@ -68,7 +68,7 @@ std::vector<String> icinga::GetBashCompletionSuggestions(const String& type, con
        return result;
 }
 
-std::vector<String> icinga::GetFieldCompletionSuggestions(const Type *type, const String& word)
+std::vector<String> icinga::GetFieldCompletionSuggestions(const Type::Ptr& type, const String& word)
 {
        std::vector<String> result;
 
index 20ad1f80d9911b2ed56366121591ea21d2d3c219..a4362f48d5b801621fd0475ae0cc2766eadf607b 100644 (file)
@@ -23,6 +23,7 @@
 #include "cli/i2-cli.hpp"
 #include "base/value.hpp"
 #include "base/utility.hpp"
+#include "base/type.hpp"
 #include <vector>
 #include <boost/program_options.hpp>
 
@@ -30,7 +31,7 @@ namespace icinga
 {
 
 std::vector<String> I2_CLI_API GetBashCompletionSuggestions(const String& type, const String& word);
-std::vector<String> I2_CLI_API GetFieldCompletionSuggestions(const Type *type, const String& word);
+std::vector<String> 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<String>(*ArgumentCompletionCallback)(const String&, const String&);
 
index 5a95d218ddea9eec3903eda3a2c6c7388e82e900..8674a5546c8e224c404998bef64b9d238fb49f7e 100644 (file)
@@ -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;
index 722d89abbe62ee452370df86b01d300891c71e5d..21960fa7e3fc349056c5a4873fddfc097f619f69 100644 (file)
@@ -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;
index 4a94aa019a087a77851fa53458d364b7ce329945..b0a0d16f63ca82f29f53db480e866ca9baa4d312 100644 (file)
@@ -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;
index df9f8d3a3edb5f06834ecd2e6355b0da2ae30427..0894dc2d1073cc2e6a105ef6ea4499228bc26968 100644 (file)
@@ -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;
index d791fe24ea2ffd585b227fbb593aef5f37f5aa4a..504f1b5223d197da1ce0bd720257027ae02023a7 100644 (file)
@@ -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;
index cd103660e25957eaef30eafcd0e959512c074490..b061353e6f5c37d131a3cc66e13f75f0ffb031ab 100644 (file)
@@ -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);
 
index e194c78244a66e96a7d5608794da139758af7a97..fb30ad3eef4ba39ad13281adec8a50714cd22edf 100644 (file)
@@ -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;
index b41a6244fb076d118f8cc06ba7244289c550418c..3f183eb7c23722a06a8554f94dc4903f1a7aa9aa 100644 (file)
@@ -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;
index a8c2434fa669d36e16d151282732c9d9a835a502..d13634a00c3d052de56599b83872903314d9bf60 100644 (file)
@@ -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;
index 47d094e31dd1a8b99bba85ba9e2eeeea176e7f16..cf7c1323807c81922055366634d2837c5f2018ea 100644 (file)
@@ -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;
index b35f252d3bc574c4db1c2026011259104004faf4..1ff2ba85267aaf808cf3637132b08eb304c1828b 100644 (file)
@@ -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;
index daf257dc240defc539c3bded4b4db8f08c658485..077425714b44f2e4b2e985364358c1ef4bf42224 100644 (file)
@@ -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;
index 324cdbe8d91289be73d26fc2ffb83fb7420c62f6..e3cfc7fe78d900cf842f67f3a8ea4ae36a0a84cd 100644 (file)
@@ -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;
index e1a3ff57cc80eb601bb5623f851f781dfd7f7d03..7c5c411e85a265f08144fff5ab3cd90013b270fd 100644 (file)
@@ -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;
index 770f19c5a61cf48009d98daa628d42037a539e24..c1ee23efc7d9e799dfeb2af1e79bca287b74fb16 100644 (file)
@@ -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;
index 225237725d8b515ef3ce69b2af8f70e219e06eaa..c61cb8de793c9829318c65924eb1254722682273 100644 (file)
@@ -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;
index 9ed935abb8a6ffd279ba39f2d060da19b431ab9e..a12fbca026804037293d0d813ccbcda8813456a3 100644 (file)
@@ -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;
index 8a2789f12ccbbab502ceda8863a592f47034a65a..77d165eecaab605bda02bc3cd457ff93d1bb1a32 100644 (file)
@@ -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;
index d8009030a094ce3da29d2404fdc75f930fd9d075..92bee25cd527e8a517e9fc05577a554a932a9a70 100644 (file)
@@ -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;
index ac4332e48d4b0bb727c4059aec65aaff1d8a8a2c..4e64e1219cae3e8879a0ce7c450be794110f9c54 100644 (file)
@@ -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;
index d853d25e1af9a1642263ce3b2ddc0a68eb9f162f..d63c9e9bd6069b480374c05b058ee42da99a73bc 100644 (file)
@@ -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;
index 7ce0ae9d0358a3e72f51ee3675a3bcf9f9806858..a3bbba435812183bd93822e3345b59b5a53bcceb 100644 (file)
@@ -129,7 +129,7 @@ std::vector<String> 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) {
index 9472f5e8648b60882bf780e6230d31fc946f8ee1..9aafad5f33d8a65f96e910f1b2df62fb0c129b0e 100644 (file)
@@ -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);
 
index da72618e2f1cbc1a36b0115e8bdd766143799224..3273c8f858414c482bd0287673a74953b38472c9 100644 (file)
@@ -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;
index 566f2e49cc886ce15a8a4a94234e9b2967200842..825bac9efc1bc654eccf01e695c54bd9303bd0c1 100644 (file)
@@ -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;
index 84d3d23bdc62beeabc7dee743ce4bb99353bbc9b..e8c94c74cbc61595e2d5d6124f3028b200951c55 100644 (file)
@@ -35,8 +35,8 @@ namespace icinga
 class CheckResultReader : public ObjectImpl<CheckResultReader>
 {
 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);
 
index ebd8e1209596225095b9d007a556524ccbf9088d..82f5c36eabd1bc66a76e723caeea8e68f3562444 100644 (file)
@@ -36,8 +36,8 @@ namespace icinga
 class CompatLogger : public ObjectImpl<CompatLogger>
 {
 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);
 
index 49494c890f7592584372a895c5b299fab753f412..486711d5f6e6b88c0356c3e191faafc34adc6c5a 100644 (file)
@@ -36,8 +36,8 @@ namespace icinga
 class ExternalCommandListener : public ObjectImpl<ExternalCommandListener>
 {
 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);
 
index 3024bb101746d5ec5d449cd5ba976a40e0dcf601..37e04d375d9bd239f5d73e1206086e7bafc14d93 100644 (file)
@@ -41,8 +41,8 @@ namespace icinga
 class StatusDataWriter : public ObjectImpl<StatusDataWriter>
 {
 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);
 
index 1ccec6ce36145670cd3593fbcd8d20eb94a4ae5d..45cd19ced4c18770fc3d325f225ac398af9ceb1a 100644 (file)
@@ -143,7 +143,7 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
                String name = m_Name;
 
                if (!m_Abstract) {
-                       const NameComposer *nc = dynamic_cast<const NameComposer *>(Type::GetByName(m_Type));
+                       shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(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<const NameComposer *>(Type::GetByName(m_Type));
+               shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(Type::GetByName(m_Type));
 
                if (nc) {
                        name = nc->MakeName(m_Name, Dictionary::Ptr());
index 1c7d23820b4bc861edd55efcf30c2c804a6ef2b6..7d905247ec0b17a81715d8b28492440a0fc65d5e 100644 (file)
@@ -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,
index 30b16f0c901adfc9bbcaa235745ca52770997e7f..53a5970f80058a2d3cbb9cad06ff3d67106fd227 100644 (file)
@@ -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);
index aa8b770adf4dc8ef438bfabf0f7b041072f2b36b..5c8332c9e78a63d308120a6a8b4bd6433238319b 100644 (file)
@@ -37,7 +37,7 @@ namespace icinga
  */\r
 class I2_CONFIG_API ConfigType : public Object {\r
 public:\r
-       DECLARE_PTR_TYPEDEFS(ConfigType);\r
+       DECLARE_OBJECT(ConfigType);\r
 \r
        ConfigType(const String& name, const DebugInfo& debuginfo);\r
 \r
index 234a045265cd8dccd74cc14753870f250924429e..538aad6a188aea0870ff642e0301d867145a598e 100644 (file)
@@ -480,7 +480,7 @@ Value Expression::OpIndexer(const Expression *expr, const Dictionary::Ptr& local
                return arr->Get(index);
        } else if (value.IsObjectType<Object>()) {
                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<const NameComposer *>(Type::GetByName(type));
+               shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(Type::GetByName(type));
 
                if (nc)
                        checkName = nc->MakeName(name, Dictionary::Ptr());
index 430c75f0c360e0ec3b735ee095ac2c3caff7e4f1..874f6ff738d5091865e48a9d3bbb49526a5469ab 100644 (file)
@@ -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);
 
index a131b4960e79e3896b086872ee7d30066cafc46b..4e5f9c68ce4701df057ea4caa04e889bb708563b 100644 (file)
@@ -48,7 +48,7 @@ enum TypeValidationResult
 class I2_CONFIG_API TypeRuleList : public Object\r
 {\r
 public:\r
-       DECLARE_PTR_TYPEDEFS(TypeRuleList);\r
+       DECLARE_OBJECT(TypeRuleList);\r
 \r
        void SetValidator(const String& validator);\r
        String GetValidator(void) const;\r
index c414b6cd73e12af203664a4b7550bb27d11832fc..58d601350a08ffc614eeb0f5cb9f48b877d2119a 100644 (file)
@@ -34,7 +34,7 @@ namespace icinga
 class CommandDbObject : public DbObject
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CommandDbObject);
+       DECLARE_OBJECT(CommandDbObject);
 
        CommandDbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
 
index b0812250d4ed28f342dcfc161d9f8e6620afa92d..cac7f210d4a84261909544054b3d9507a42235d5 100644 (file)
@@ -37,7 +37,7 @@ namespace icinga
 class I2_DB_IDO_API DbConnection : public ObjectImpl<DbConnection>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(DbConnection);
+       DECLARE_OBJECT(DbConnection);
 
        static void StaticInitialize(void);
 
index 80f85bbd2d0abc20a26b2888be33a908a9503c65..32eb567bf5832614bfaf09a652db3898c9140168 100644 (file)
@@ -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);
 
index 199a04b2c3fae1722cc907b2c4b2a0be1ed6cc58..4a5a6655817a64f83619369c7fba45f92af51a33 100644 (file)
@@ -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<shared_ptr<DbObject> (const shared_ptr<DbType>&, const String&, const String&)> ObjectFactory;
        typedef std::map<String, DbType::Ptr> TypeMap;
index 1c7e184abea66ad0a029e21eb28f9f1a7ca072db..89a0a97048bca5f1e1400a6ddbda78acda9bbb46 100644 (file)
@@ -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);
 
index e11fe1b85cd97b9770f910f73b35e1dccca79597..6598b1b241edbfa1e41c7f187ca6c5e5b5fd99ee 100644 (file)
@@ -35,7 +35,7 @@ namespace icinga
 class EndpointDbObject : public DbObject
 {
 public:
-       DECLARE_PTR_TYPEDEFS(EndpointDbObject);
+       DECLARE_OBJECT(EndpointDbObject);
 
        EndpointDbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
 
index aabf4540119074598fcb371cb5cf1e809f29a947..cb2449aa3c153f6b2c8ae3dec630c8076730a93b 100644 (file)
@@ -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);
 
index d9f4c6a2dc93bd4f888e51a31105174a3bb3745c..2fa717fee34a1877652d79fc5c837df83fad8dff 100644 (file)
@@ -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);
 
index c99d4a8247975309a10ff0f742c7506b6c388abb..43e3f338b75bf063c6a13e4c95380d93efd9d688 100644 (file)
@@ -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);
 
index dc79ef766e6ce70e31782f6e97b30fdf09d826cc..a91f5a8675ff8edf008b4276e3cab5595f4dfd92 100644 (file)
@@ -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);
 
index b68eebe43a1ee0123ab764bbfe1ea3e43542626c..b568b0e6357780eb5923aff9d8306a4c74f4939a 100644 (file)
@@ -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);
 
index 6ad2225a49db7a40de81e2370d8f985d64eed2f7..2f4da9a2baebb84d9078b05962aa7faa296f9ed8 100644 (file)
@@ -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);
 
index 05e9ef2baae420a2ff73e1c42cf2b3234bbea29d..ee9d36b013076881e2c27f5b9085b5203bac5c7e 100644 (file)
@@ -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);
 
index aa9c11dcd911da2337c1a8bd38445b943722e6d8..5e383921eacd07cd3c4bc65b82597ba9cbaceacd 100644 (file)
@@ -39,8 +39,8 @@ typedef shared_ptr<MYSQL_RES> IdoMysqlResult;
 class IdoMysqlConnection : public ObjectImpl<IdoMysqlConnection>
 {
 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);
 
index c2da9647c04bc851eafc9598a482e598145aad79..00ed97198ea10d90a3cfb8b6ae0fd5c2ac4b8f0f 100644 (file)
@@ -39,8 +39,8 @@ typedef shared_ptr<PGresult> IdoPgsqlResult;
 class IdoPgsqlConnection : public ObjectImpl<IdoPgsqlConnection>
 {
 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);
 
index 7f4762e6947bac095b3ef1169fd18211b1808d32..ae0d0e919278df4c0c4f2b343afa29f7303b0c4a 100644 (file)
@@ -33,8 +33,8 @@ namespace icinga
 class Demo : public ObjectImpl<Demo>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Demo);
-       DECLARE_TYPENAME(Demo);
+       DECLARE_OBJECT(Demo);
+       DECLARE_OBJECTNAME(Demo);
 
        virtual void Start(void);
 
index 2283fe77f24fe39abb1160feefb60ec7f41f166f..ce027b8fad6bd5a6ba788c77a68516f3918a8520 100644 (file)
@@ -33,8 +33,8 @@ namespace icinga
 class Hello : public ObjectImpl<Hello>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Hello);
-       DECLARE_TYPENAME(Hello);
+       DECLARE_OBJECT(Hello);
+       DECLARE_OBJECTNAME(Hello);
 
        int Main(void);
 };
index 27468f94dc9cafa94a7131b6a588f3f7db495a19..cc36c4331ce64badc54d7e6a577de86b2dc3d50b 100644 (file)
@@ -77,8 +77,8 @@ class Dependency;
 class I2_ICINGA_API Checkable : public ObjectImpl<Checkable>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Checkable);
-       DECLARE_TYPENAME(Checkable);
+       DECLARE_OBJECT(Checkable);
+       DECLARE_OBJECTNAME(Checkable);
 
        Checkable(void);
 
index 9b977ce154d3e51fe3922c001330437fb5ac37ea..dde46ec580d8cda067539f0b0d81c4c0bb983047 100644 (file)
@@ -34,8 +34,8 @@ namespace icinga
 class I2_ICINGA_API CheckCommand : public ObjectImpl<CheckCommand>
 {
 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);
 };
index 87f366260f256094b2662c811b1f6d49b646b520..5717c88059dbd730508dee493484520ddb68160d 100644 (file)
@@ -34,7 +34,7 @@ namespace icinga
 class I2_ICINGA_API CheckResult : public ObjectImpl<CheckResult>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CheckResult);
+       DECLARE_OBJECT(CheckResult);
 };
 
 }
index b1f05c68ead80a6fe9ad6aa7646afc75c5bfa249..ad21659b2f52666fa3e3c4c1b37be2f8aefc454a 100644 (file)
@@ -35,7 +35,7 @@ namespace icinga
 class I2_ICINGA_API Command : public ObjectImpl<Command>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Command);
+       DECLARE_OBJECT(Command);
 
        //virtual Dictionary::Ptr Execute(const Object::Ptr& context) = 0;
 
index 0b64d5ded63068d8be864ed9fafbc4a181f4a629..dd25e593125eee5d2621b562f51490610d4b9f1f 100644 (file)
@@ -34,7 +34,7 @@ namespace icinga
 class I2_ICINGA_API Comment : public ObjectImpl<Comment>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Comment);
+       DECLARE_OBJECT(Comment);
 
        bool IsExpired(void) const;
 };
index c8929d8d2c1cec67f9dd061dd66424d45d34bf7f..8a3f3fd2bdd352d136a1bf325ed5be6c1083d750 100644 (file)
@@ -57,7 +57,7 @@ enum ModifiedAttributeType
 class I2_ICINGA_API CustomVarObject : public ObjectImpl<CustomVarObject>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CustomVarObject);
+       DECLARE_OBJECT(CustomVarObject);
 
        static boost::signals2::signal<void (const CustomVarObject::Ptr&, const Dictionary::Ptr& vars, const MessageOrigin&)> OnVarsChanged;
 
index 08e04e81365c49544fb6a3649a1dbf6b115bf46c..b6a8e21e6052bd7c688915baa3a822e4dbf3260c 100644 (file)
@@ -37,8 +37,8 @@ class ApplyRule;
 class I2_ICINGA_API Dependency : public ObjectImpl<Dependency>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Dependency);
-       DECLARE_TYPENAME(Dependency);
+       DECLARE_OBJECT(Dependency);
+       DECLARE_OBJECTNAME(Dependency);
 
        shared_ptr<Checkable> GetParent(void) const;
        shared_ptr<Checkable> GetChild(void) const;
index 73fffd3105e458e9818c98e9a91a0caf46750e0b..439d764292ed4d31cba767bee1b8e21272ec3894 100644 (file)
@@ -34,7 +34,7 @@ namespace icinga
 class I2_ICINGA_API Downtime : public ObjectImpl<Downtime>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Downtime);
+       DECLARE_OBJECT(Downtime);
 
        bool IsActive(void) const;
        bool IsTriggered(void) const;
index 6717928da46771447261b9d1ae2abf2a895afb4b..6054775266df6de68529987d5889afb8806d068b 100644 (file)
@@ -34,8 +34,8 @@ namespace icinga
 class I2_ICINGA_API EventCommand : public ObjectImpl<EventCommand>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(EventCommand);
-       DECLARE_TYPENAME(EventCommand);
+       DECLARE_OBJECT(EventCommand);
+       DECLARE_OBJECTNAME(EventCommand);
 
        virtual void Execute(const Checkable::Ptr& checkable);
 };
index 1101cae3d995073e302f1e2f00e8059637017b8f..1754debe6f60bf97a9d0f2ecf931edee79841149 100644 (file)
@@ -38,8 +38,8 @@ class Service;
 class I2_ICINGA_API Host : public ObjectImpl<Host>, public MacroResolver
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Host);
-       DECLARE_TYPENAME(Host);
+       DECLARE_OBJECT(Host);
+       DECLARE_OBJECTNAME(Host);
 
        shared_ptr<Service> GetServiceByShortName(const Value& name);
 
index 69c39a789267d7156b586631c5db3e79192c74f0..1aa667a0e79f69e33af2ce953b3cd06dc02f040c 100644 (file)
@@ -37,8 +37,8 @@ class ObjectRule;
 class I2_ICINGA_API HostGroup : public ObjectImpl<HostGroup>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(HostGroup);
-       DECLARE_TYPENAME(HostGroup);
+       DECLARE_OBJECT(HostGroup);
+       DECLARE_OBJECTNAME(HostGroup);
 
        std::set<Host::Ptr> GetMembers(void) const;
        void AddMember(const Host::Ptr& host);
index 4f159a8bfbb6acebde14d6baf4ec5fef953af102..a644ce87144ed952b8be2e0a03f4ecde47060fa0 100644 (file)
@@ -35,8 +35,8 @@ namespace icinga
 class I2_ICINGA_API IcingaApplication : public ObjectImpl<IcingaApplication>, public MacroResolver
 {
 public:
-       DECLARE_PTR_TYPEDEFS(IcingaApplication);
-       DECLARE_TYPENAME(IcingaApplication);
+       DECLARE_OBJECT(IcingaApplication);
+       DECLARE_OBJECTNAME(IcingaApplication);
 
        static void StaticInitialize(void);
 
index 738abbcf6fd65855c052e402ba42bcde23df7713..652d7431cac1dfe16816dc65d1307bb38bb0da18 100644 (file)
@@ -32,8 +32,8 @@ namespace icinga
 class IcingaStatusWriter : public ObjectImpl<IcingaStatusWriter>
 {
 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);
index 74108f9ea35c5603ab8a6bb130804be05ff5f8b4..8d0be46d8495ad6d62937dec444dd35b5ff3f43c 100644 (file)
@@ -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;
index 300145f2b4e2fb99c92c4b108837a6370512b66a..91631d4d73faecc712c92fe646f28163bc3a6ecd 100644 (file)
@@ -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;
 };
index 354f9d38b61f6afd9fcdd27b276464f0d047c59d..9202c074c661c3ec84b59e440baff7247a43c8d9 100644 (file)
@@ -76,8 +76,8 @@ class ApplyRule;
 class I2_ICINGA_API Notification : public ObjectImpl<Notification>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Notification);
-       DECLARE_TYPENAME(Notification);
+       DECLARE_OBJECT(Notification);
+       DECLARE_OBJECTNAME(Notification);
 
        static void StaticInitialize(void);
 
index 361541f18c66389d1c72f298c724e5bf30167ef9..2ab58e6518e347ce68923cd38aa4f479f882d4a8 100644 (file)
@@ -36,8 +36,8 @@ class Notification;
 class I2_ICINGA_API NotificationCommand : public ObjectImpl<NotificationCommand>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(NotificationCommand);
-       DECLARE_TYPENAME(NotificationCommand);
+       DECLARE_OBJECT(NotificationCommand);
+       DECLARE_OBJECTNAME(NotificationCommand);
 
        virtual Dictionary::Ptr Execute(const shared_ptr<Notification>& notification,
                const User::Ptr& user, const CheckResult::Ptr& cr, const NotificationType& type,
index 019f590aa5a1b311932da9e8bef1cb7a7a077f45..0b413c005529dfaf577e9ba52fea6507f0d13dd9 100644 (file)
@@ -29,7 +29,7 @@ namespace icinga
 class I2_ICINGA_API PerfdataValue : public ObjectImpl<PerfdataValue>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(PerfdataValue);
+       DECLARE_OBJECT(PerfdataValue);
 
        PerfdataValue(void);
 
index f34246a32258672797b3ebde3f531778484d4db8..abc90f0781526fe85e07ca61f9dc2883e73e1335 100644 (file)
@@ -38,8 +38,8 @@ class ApplyRule;
 class I2_ICINGA_API ScheduledDowntime : public ObjectImpl<ScheduledDowntime>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ScheduledDowntime);
-       DECLARE_TYPENAME(ScheduledDowntime);
+       DECLARE_OBJECT(ScheduledDowntime);
+       DECLARE_OBJECTNAME(ScheduledDowntime);
 
        static void StaticInitialize(void);
 
index 8219af06744129d311a391cc5a61414d56d9b696..2b51e9406c5056a60ec5c2ffea2afec8fb8b7583 100644 (file)
@@ -36,8 +36,8 @@ namespace icinga
 class I2_ICINGA_API Service : public ObjectImpl<Service>, 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);
 
index 8bffe6de4a756fc7254de252cf85382b2b350f8c..016dc38a36f7d9fbcc87d6b3fde9d072ae615d7e 100644 (file)
@@ -37,8 +37,8 @@ class ObjectRule;
 class I2_ICINGA_API ServiceGroup : public ObjectImpl<ServiceGroup>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ServiceGroup);
-       DECLARE_TYPENAME(ServiceGroup);
+       DECLARE_OBJECT(ServiceGroup);
+       DECLARE_OBJECTNAME(ServiceGroup);
 
        std::set<Service::Ptr> GetMembers(void) const;
        void AddMember(const Service::Ptr& service);
index 3e6d2a5dab1d402c03f0094a7e22aa74ec021af9..4dd1de2357e809e7ad920833fe5e233d071b6fd0 100644 (file)
@@ -34,8 +34,8 @@ namespace icinga
 class I2_ICINGA_API TimePeriod : public ObjectImpl<TimePeriod>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(TimePeriod);
-       DECLARE_TYPENAME(TimePeriod);
+       DECLARE_OBJECT(TimePeriod);
+       DECLARE_OBJECTNAME(TimePeriod);
 
        static void StaticInitialize(void);
 
index e001ad38efc677d203fb4c3899ffbc37d2867ccd..304d8b9952236d1fe22d026885725fb5e0657e89 100644 (file)
@@ -36,8 +36,8 @@ namespace icinga
 class I2_ICINGA_API User : public ObjectImpl<User>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(User);
-       DECLARE_TYPENAME(User);
+       DECLARE_OBJECT(User);
+       DECLARE_OBJECTNAME(User);
 
        void AddGroup(const String& name);
 
index 9570161d0a392a8f872351e81e5fc35febc346c3..981e385b2119b9e9b3e8348f79357df0c536aa4c 100644 (file)
@@ -37,8 +37,8 @@ class ObjectRule;
 class I2_ICINGA_API UserGroup : public ObjectImpl<UserGroup>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(UserGroup);
-       DECLARE_TYPENAME(UserGroup);
+       DECLARE_OBJECT(UserGroup);
+       DECLARE_OBJECTNAME(UserGroup);
 
        std::set<User::Ptr> GetMembers(void) const;
        void AddMember(const User::Ptr& user);
index 7c933b82411ec676f0cdade62a5b338882770a26..9e4a05c854a5f8d1a9f5db07e9e597480b4bb3d5 100644 (file)
@@ -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;
index 5b8a6b76fe82b68d7084cdebee918af5eb226fc4..9d36e4cfc44f1be92d3ee90125a285152126153e 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class AndFilter : public CombinerFilter
 {
 public:
-       DECLARE_PTR_TYPEDEFS(AndFilter);
+       DECLARE_OBJECT(AndFilter);
 
        AndFilter(void);
 
index 43d750bb396de58651943f8d257727e290b90e76..08a9aed67b06b7d3e7addc7222f02932204cdd39 100644 (file)
@@ -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);
 
index 851a0179674de9eff21b701f68f8f224681f1fcf..4906dc5fe0c86856352037cc0844b04f6e876c7c 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class AvgAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(AvgAggregator);
+       DECLARE_OBJECT(AvgAggregator);
 
        AvgAggregator(const String& attr);
 
index d962c36f2bfae274ac544879236066195d35b969..ecfefee6c858832c695cc7e7d4477edef7d8c81c 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class CombinerFilter : public Filter
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CombinerFilter);
+       DECLARE_OBJECT(CombinerFilter);
 
        CombinerFilter(void);
 
index 44bcf917aced3dcc4228b8089edd2bd777ee2157..36794b4a65e89a5d0d6555af8867e40cbdab8aa3 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class CommandsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CommandsTable);
+       DECLARE_OBJECT(CommandsTable);
 
        CommandsTable(void);
 
index 0918c59f946f979488cfbe672491604edb91c306..a42a4b9c7830cd3f1e812632584ae91a4122966f 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class CommentsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CommentsTable);
+       DECLARE_OBJECT(CommentsTable);
 
        CommentsTable(void);
 
index 26f41b5e2bdf046139218db62a6d5f5678435862..dd34ee38778d2d091f658e1e59c9c9a47da23ffd 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class ContactGroupsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ContactGroupsTable);
+       DECLARE_OBJECT(ContactGroupsTable);
 
        ContactGroupsTable(void);
 
index dfabb9ef2f0667ac0154b9e284e29125fe23e651..e8997bc0fd1b8d9bf1c802cf9c56a5a091cd427b 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class ContactsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ContactsTable);
+       DECLARE_OBJECT(ContactsTable);
 
        ContactsTable(void);
 
index 61860962e0fff64353a14b73f12493789d81957f..5e927934a12dc04a97b8f9a87c4b808dbe8f4b0c 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class CountAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(CountAggregator);
+       DECLARE_OBJECT(CountAggregator);
 
        CountAggregator(void);
 
index 29435346dbf15e111430d9704ddccfc2cbd66f2f..b45d3940bddddf3dcbbc27fd4804e90dd4366bc9 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class DowntimesTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(DowntimesTable);
+       DECLARE_OBJECT(DowntimesTable);
 
        DowntimesTable(void);
 
index 9ccc9f2304e8bd9a0edf0b7996a6a5241ca3f412..5d43e6dc2b94babaed5ca9f22150dcc5b40fe1ce 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class EndpointsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(EndpointsTable);
+       DECLARE_OBJECT(EndpointsTable);
 
        EndpointsTable(void);
 
index f8d9d1ed5d65a52adefd5513ac6651ff3ccce424..3ee1e7c77cdbeed76e8981d1e4367b423e5566fe 100644 (file)
@@ -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;
 
index 01872b4aea063108375cd5c776e9ff10f2652474..68cd341d591b5df1bedc332029f454067a55a697 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class HostGroupsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(HostGroupsTable);
+       DECLARE_OBJECT(HostGroupsTable);
 
        HostGroupsTable(void);
 
index 9896615e0e8f8a42337d8c1713743a940ed6e5d6..57f260483948c3b3d8f195ce7fa5b87e82e770d0 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class HostsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(HostsTable);
+       DECLARE_OBJECT(HostsTable);
 
        HostsTable(void);
 
index d85898483ab9ef691d068cd23bf098df96ebbc13..adcfedc3bbd5ca8377f7cec773a3b28bc83e9e8b 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class InvAvgAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(InvAvgAggregator);
+       DECLARE_OBJECT(InvAvgAggregator);
 
        InvAvgAggregator(const String& attr);
 
index b15648bdc3f8691442121dd08bc8b097cad0aed0..e288813c7057ea75e573fe5b67803ddac97ed1c0 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class InvSumAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(InvSumAggregator);
+       DECLARE_OBJECT(InvSumAggregator);
 
        InvSumAggregator(const String& attr);
 
index 56672721a023bdc975b974556c1aad7ff8bdbb61..14cf5527d53975717ad937999196d07ccf0b5f2f 100644 (file)
@@ -36,8 +36,8 @@ namespace icinga
 class LivestatusListener : public ObjectImpl<LivestatusListener>
 {
 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);
 
index 65af9fc38a9edd884f3e974e34ef326fee2ba988..da9a6d42910a54ba7f943b34fb958d5eefa1dfe9 100644 (file)
@@ -45,7 +45,7 @@ enum LivestatusError
 class LivestatusQuery : public Object
 {
 public:
-       DECLARE_PTR_TYPEDEFS(LivestatusQuery);
+       DECLARE_OBJECT(LivestatusQuery);
 
        LivestatusQuery(const std::vector<String>& lines, const String& compat_log_path);
 
index 44c3e1dc78b818bbbc8c99eff7564c2f3b69ea67..6f1c22cbeebda0892e1793b2d2f1edb1b3589ffe 100644 (file)
@@ -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);
 
index 315874803bfa4a4de5454016c1c012a7d49eeb29..9f2a9b062d7bc3ea8e07b87d249e923ca023f32d 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class MaxAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(MaxAggregator);
+       DECLARE_OBJECT(MaxAggregator);
 
        MaxAggregator(const String& attr);
 
index d1280e3c718ee04336494c2dc2dd70fd114589fb..7e36c71d3eb0d1007f8b1d30fab36a875439dfab 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class MinAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(MinAggregator);
+       DECLARE_OBJECT(MinAggregator);
 
        MinAggregator(const String& attr);
 
index 742902bf8492c15eae1a4d045ecc21d6387af5dd..742a0bbcd6ea300de27ecf6a4de5317f5e8e8cef 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class NegateFilter : public Filter
 {
 public:
-       DECLARE_PTR_TYPEDEFS(NegateFilter);
+       DECLARE_OBJECT(NegateFilter);
 
        NegateFilter(const Filter::Ptr& inner);
 
index 6f5fcf3c0c465109ec8cee353c9f782a675b4994..f1a4794dfd422762eaddecae8d34711c0859bf52 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class OrFilter : public CombinerFilter
 {
 public:
-       DECLARE_PTR_TYPEDEFS(OrFilter);
+       DECLARE_OBJECT(OrFilter);
 
        OrFilter(void);
 
index bad828410a46448a91cb1f431b30d93c6d296073..4f01b6ebe65d50f4ee385af6c9802b2787aff2ff 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class ServiceGroupsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ServiceGroupsTable);
+       DECLARE_OBJECT(ServiceGroupsTable);
 
        ServiceGroupsTable(void);
 
index 105d6d0be36f0232ace25aa3572899e697200e78..8446a58194153c7dce5b96aac012691e314adbd5 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class ServicesTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ServicesTable);
+       DECLARE_OBJECT(ServicesTable);
 
        ServicesTable(void);
 
index fa01cdca770a2de482c1f7e36dc705f853bfe313..18b9595c3ad6ec9839f30f305a8ec8c37bdc8a5f 100644 (file)
@@ -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);
 
index 43a694bde0582b46d2d5862ebb5eee1a6d26a4de..97da5097550cb10b81d2d0fb25e26c0cab5b06fb 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class StatusTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(StatusTable);
+       DECLARE_OBJECT(StatusTable);
 
        StatusTable(void);
 
index 070bcca700bd3edccd5a39e1141e03625f6333ca..dfd0557e1463f79d931c06945411a62900f0a4b7 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class StdAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(StdAggregator);
+       DECLARE_OBJECT(StdAggregator);
 
        StdAggregator(const String& attr);
 
index b5693a776efe19641cceb7758c4112c8d676dec0..811c62b4fb1c45f02c449b1ff641d2a858d08e26 100644 (file)
@@ -32,7 +32,7 @@ namespace icinga
 class SumAggregator : public Aggregator
 {
 public:
-       DECLARE_PTR_TYPEDEFS(SumAggregator);
+       DECLARE_OBJECT(SumAggregator);
 
        SumAggregator(const String& attr);
 
index 5844f4acfb785647648d87dad314e60c2c7ac45f..c04133fb5c4a9533d782c5db9d4c6e5558424d7b 100644 (file)
@@ -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);
 
index f473b1674a108a577bcc585433938d9ef0296056..bbf13617f6bf48ce4b507808708707a885cdbdf2 100644 (file)
@@ -33,7 +33,7 @@ namespace icinga
 class TimePeriodsTable : public Table
 {
 public:
-       DECLARE_PTR_TYPEDEFS(TimePeriodsTable);
+       DECLARE_OBJECT(TimePeriodsTable);
 
        TimePeriodsTable(void);
 
index babca98970c1cd24d6dd9d750597ea3287836831..ea1bcdfdb0413284ef71709773a016b3cffec074 100644 (file)
@@ -34,8 +34,8 @@ namespace icinga
 class NotificationComponent : public ObjectImpl<NotificationComponent>
 {
 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);
 
index 6e9520b5bd05d99ed60a45cde7c099f5483dfc91..f0128266a716f68678dbd3dd552b73c67e75087f 100644 (file)
@@ -38,8 +38,8 @@ namespace icinga
 class GraphiteWriter : public ObjectImpl<GraphiteWriter>
 {
 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);
 
index b7d48e560490398184c174b9f43667c53bf90e73..0e3caf0ab83d062af39e917edf57a7b9ed7d3464 100644 (file)
@@ -37,8 +37,8 @@ namespace icinga
 class PerfdataWriter : public ObjectImpl<PerfdataWriter>
 {
 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);
 
index 9c05a4f1ea323fa1baa4bd2b86077c9d134b54d4..eca972f2bb8401400fe2a34d5df963f87566d334 100644 (file)
@@ -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);
 
index 72da522d4d26e2b5cfcfc047085188c2730e9ebd..30abb9e838d1a432d8afca03b880e40d1fc7f656 100644 (file)
@@ -39,7 +39,7 @@ namespace icinga
 class I2_REMOTE_API ApiFunction : public Object
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ApiFunction);
+       DECLARE_OBJECT(ApiFunction);
 
        typedef boost::function<Value(const MessageOrigin& origin, const Dictionary::Ptr&)> Callback;
 
index a02eb619f3d9d677ba088f20261094ffef44f243..deea3e74686d48d31b43eaee5c22c933c6621c08 100644 (file)
@@ -42,8 +42,8 @@ class ApiClient;
 class I2_REMOTE_API ApiListener : public ObjectImpl<ApiListener>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(ApiListener);
-       DECLARE_TYPENAME(ApiListener);
+       DECLARE_OBJECT(ApiListener);
+       DECLARE_OBJECTNAME(ApiListener);
 
        static boost::signals2::signal<void(bool)> OnMasterChanged;
 
index d732600ba68730fe6980bb98866bb0e4371a0f71..ee92088c7533daf7d727cd8836d20a1f28763a7e 100644 (file)
@@ -38,8 +38,8 @@ class Zone;
 class I2_REMOTE_API Endpoint : public ObjectImpl<Endpoint>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Endpoint);
-       DECLARE_TYPENAME(Endpoint);
+       DECLARE_OBJECT(Endpoint);
+       DECLARE_OBJECTNAME(Endpoint);
 
        static boost::signals2::signal<void(const Endpoint::Ptr&, const shared_ptr<ApiClient>&)> OnConnected;
        static boost::signals2::signal<void(const Endpoint::Ptr&, const shared_ptr<ApiClient>&)> OnDisconnected;
index 1a17c5c1800b370adc344e4c6a3c40c395b5ed22..ea1ab7464617be50b3abcb943c2b1e49b3b450aa 100644 (file)
@@ -33,8 +33,8 @@ namespace icinga
 class I2_REMOTE_API Zone : public ObjectImpl<Zone>
 {
 public:
-       DECLARE_PTR_TYPEDEFS(Zone);
-       DECLARE_TYPENAME(Zone);
+       DECLARE_OBJECT(Zone);
+       DECLARE_OBJECTNAME(Zone);
 
        Zone::Ptr GetParent(void) const;
        std::set<Endpoint::Ptr> GetEndpoints(void) const;
index 8be052703201e5eb63c41fe0188f423e9df97e5a..985ae0dcd66ef85e721cc3e72bd6b3d24a45dc05 100644 (file)
@@ -26,7 +26,7 @@ using namespace icinga;
 class TestObject : public Object
 {
 public:
-       DECLARE_PTR_TYPEDEFS(TestObject);
+       DECLARE_OBJECT(TestObject);
 
        TestObject::Ptr GetTestRef(void)
        {
index 8a4ee5e310f941bfce4327e9182eccb48dd4926c..e03a68e0c2e32f8129921ca6d1797fb4212ceeff 100644 (file)
@@ -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();
 
index 4795fecff5615eb3eec0ce2e503334e644197441..808b7a329835ab03b03b9100b4398740956f3f42 100644 (file)
@@ -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 */