From: Gunnar Beutner Date: Tue, 9 Jul 2013 06:42:08 +0000 (+0200) Subject: Add DECLARE_PTR_TYPEDEFS macro for Ptr/WeakPtr typedefs. X-Git-Tag: v0.0.3~878 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4961523e912a145ce5abedc3363b5738fec9f303;p=icinga2 Add DECLARE_PTR_TYPEDEFS macro for Ptr/WeakPtr typedefs. --- diff --git a/components/checker/checkercomponent.h b/components/checker/checkercomponent.h index 65d56a723..dfcc83967 100644 --- a/components/checker/checkercomponent.h +++ b/components/checker/checkercomponent.h @@ -63,8 +63,7 @@ struct ServiceNextCheckExtractor class CheckerComponent : public DynamicObject { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(CheckerComponent); typedef boost::multi_index_container< Service::Ptr, diff --git a/components/compat/checkresultreader.h b/components/compat/checkresultreader.h index 2b6695f6d..3820103d2 100644 --- a/components/compat/checkresultreader.h +++ b/components/compat/checkresultreader.h @@ -36,8 +36,7 @@ namespace icinga class CheckResultReader : public DynamicObject { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(CheckResultReader); CheckResultReader(const Dictionary::Ptr& properties); diff --git a/components/compat/compatcomponent.h b/components/compat/compatcomponent.h index e36ec079b..e42052b64 100644 --- a/components/compat/compatcomponent.h +++ b/components/compat/compatcomponent.h @@ -45,6 +45,8 @@ enum CompatObjectType class CompatComponent : public DynamicObject { public: + DECLARE_PTR_TYPEDEFS(CompatComponent); + CompatComponent(const Dictionary::Ptr& serializedUpdate); virtual void Start(void); diff --git a/components/compat/compatlog.h b/components/compat/compatlog.h index 5e739c136..b45ef13f3 100644 --- a/components/compat/compatlog.h +++ b/components/compat/compatlog.h @@ -37,8 +37,7 @@ namespace icinga class CompatLog : public DynamicObject { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(CompatLog); CompatLog(const Dictionary::Ptr& serializedUpdate); diff --git a/components/delegation/delegationcomponent.h b/components/delegation/delegationcomponent.h index fe8a5cba7..362bf834f 100644 --- a/components/delegation/delegationcomponent.h +++ b/components/delegation/delegationcomponent.h @@ -34,6 +34,8 @@ namespace icinga class DelegationComponent : public DynamicObject { public: + DECLARE_PTR_TYPEDEFS(DelegationComponent); + DelegationComponent(const Dictionary::Ptr& serializedUpdate); virtual void Start(void); diff --git a/components/demo/democomponent.h b/components/demo/democomponent.h index 43f8cc16e..a1bcba871 100644 --- a/components/demo/democomponent.h +++ b/components/demo/democomponent.h @@ -33,6 +33,8 @@ namespace icinga class DemoComponent : public DynamicObject { public: + DECLARE_PTR_TYPEDEFS(DemoComponent); + DemoComponent(const Dictionary::Ptr& serializedUpdate); virtual void Start(void); diff --git a/components/livestatus/andfilter.h b/components/livestatus/andfilter.h index 520606058..aafe5bf98 100644 --- a/components/livestatus/andfilter.h +++ b/components/livestatus/andfilter.h @@ -33,8 +33,7 @@ namespace livestatus class AndFilter : public CombinerFilter { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(AndFilter); AndFilter(void); diff --git a/components/livestatus/attributefilter.h b/components/livestatus/attributefilter.h index 0e3f3b71f..939f030d6 100644 --- a/components/livestatus/attributefilter.h +++ b/components/livestatus/attributefilter.h @@ -33,8 +33,7 @@ namespace livestatus class AttributeFilter : public Filter { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(AttributeFilter); AttributeFilter(const String& column, const String& op, const String& operand); diff --git a/components/livestatus/combinerfilter.h b/components/livestatus/combinerfilter.h index 70538172d..01a372cfe 100644 --- a/components/livestatus/combinerfilter.h +++ b/components/livestatus/combinerfilter.h @@ -33,8 +33,7 @@ namespace livestatus class CombinerFilter : public Filter { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(CombinerFilter); CombinerFilter(void); diff --git a/components/livestatus/commentstable.h b/components/livestatus/commentstable.h index 56197e56d..b47d36493 100644 --- a/components/livestatus/commentstable.h +++ b/components/livestatus/commentstable.h @@ -33,8 +33,7 @@ namespace livestatus class CommentsTable : public Table { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(CommentsTable); CommentsTable(void); diff --git a/components/livestatus/contactgroupstable.h b/components/livestatus/contactgroupstable.h index 6710ffab2..247a68942 100644 --- a/components/livestatus/contactgroupstable.h +++ b/components/livestatus/contactgroupstable.h @@ -33,8 +33,7 @@ namespace livestatus class ContactGroupsTable : public Table { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(ContactGroupsTable); ContactGroupsTable(void); diff --git a/components/livestatus/contactstable.h b/components/livestatus/contactstable.h index 744f7f178..673a61d38 100644 --- a/components/livestatus/contactstable.h +++ b/components/livestatus/contactstable.h @@ -33,8 +33,7 @@ namespace livestatus class ContactsTable : public Table { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(ContactsTable); ContactsTable(void); diff --git a/components/livestatus/downtimestable.h b/components/livestatus/downtimestable.h index ee38f9bf1..e14bb29e0 100644 --- a/components/livestatus/downtimestable.h +++ b/components/livestatus/downtimestable.h @@ -33,8 +33,7 @@ namespace livestatus class DowntimesTable : public Table { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(DowntimesTable); DowntimesTable(void); diff --git a/components/livestatus/filter.h b/components/livestatus/filter.h index 68dfef619..1038da9cc 100644 --- a/components/livestatus/filter.h +++ b/components/livestatus/filter.h @@ -31,8 +31,7 @@ namespace livestatus class Filter : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Filter); virtual bool Apply(const Table::Ptr& table, const Object::Ptr& object) = 0; diff --git a/components/livestatus/hoststable.h b/components/livestatus/hoststable.h index 6c8fdd692..24bc21334 100644 --- a/components/livestatus/hoststable.h +++ b/components/livestatus/hoststable.h @@ -33,8 +33,7 @@ namespace livestatus class HostsTable : public Table { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(HostsTable); HostsTable(void); diff --git a/components/livestatus/negatefilter.h b/components/livestatus/negatefilter.h index 18759345c..3461c0f8b 100644 --- a/components/livestatus/negatefilter.h +++ b/components/livestatus/negatefilter.h @@ -33,8 +33,7 @@ namespace livestatus class NegateFilter : public Filter { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(NegateFilter); NegateFilter(const Filter::Ptr& inner); diff --git a/components/livestatus/orfilter.h b/components/livestatus/orfilter.h index 2d323f1b3..207207575 100644 --- a/components/livestatus/orfilter.h +++ b/components/livestatus/orfilter.h @@ -33,8 +33,7 @@ namespace livestatus class OrFilter : public CombinerFilter { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(OrFilter); OrFilter(void); diff --git a/components/livestatus/query.h b/components/livestatus/query.h index 2d8362d9b..270aa6abe 100644 --- a/components/livestatus/query.h +++ b/components/livestatus/query.h @@ -37,8 +37,7 @@ namespace livestatus class Query : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Query); Query(const std::vector& lines); diff --git a/components/livestatus/servicestable.h b/components/livestatus/servicestable.h index 33a80248e..e45ee3b14 100644 --- a/components/livestatus/servicestable.h +++ b/components/livestatus/servicestable.h @@ -33,8 +33,7 @@ namespace livestatus class ServicesTable : public Table { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(ServicesTable); ServicesTable(void); diff --git a/components/livestatus/statustable.h b/components/livestatus/statustable.h index 5a891e7e3..dcde0473d 100644 --- a/components/livestatus/statustable.h +++ b/components/livestatus/statustable.h @@ -33,8 +33,7 @@ namespace livestatus class StatusTable : public Table { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(StatusTable); StatusTable(void); diff --git a/components/livestatus/table.h b/components/livestatus/table.h index 78beb1a7a..0614aa95d 100644 --- a/components/livestatus/table.h +++ b/components/livestatus/table.h @@ -36,8 +36,7 @@ class Filter; class Table : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr
WeakPtr; + DECLARE_PTR_TYPEDEFS(Table); typedef boost::function AddRowFunction; diff --git a/components/notification/notificationcomponent.h b/components/notification/notificationcomponent.h index ab56d7d27..5cff72798 100644 --- a/components/notification/notificationcomponent.h +++ b/components/notification/notificationcomponent.h @@ -33,6 +33,8 @@ namespace icinga class NotificationComponent : public DynamicObject { public: + DECLARE_PTR_TYPEDEFS(NotificationComponent); + NotificationComponent(const Dictionary::Ptr& serializedUpdate); virtual void Start(void); diff --git a/components/replication/replicationcomponent.h b/components/replication/replicationcomponent.h index d097e181c..1950ef22c 100644 --- a/components/replication/replicationcomponent.h +++ b/components/replication/replicationcomponent.h @@ -32,6 +32,8 @@ namespace icinga class ReplicationComponent : public DynamicObject { public: + DECLARE_PTR_TYPEDEFS(ReplicationComponent); + ReplicationComponent(const Dictionary::Ptr& serializedUpdate); virtual void Start(void); diff --git a/lib/base/application.h b/lib/base/application.h index c4aaaec13..fdea6a092 100644 --- a/lib/base/application.h +++ b/lib/base/application.h @@ -35,8 +35,7 @@ class Component; */ class I2_BASE_API Application : public DynamicObject { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Application); explicit Application(const Dictionary::Ptr& serializedUpdate); ~Application(void); diff --git a/lib/base/array.h b/lib/base/array.h index cefba286d..fe9609300 100644 --- a/lib/base/array.h +++ b/lib/base/array.h @@ -35,8 +35,7 @@ namespace icinga class I2_BASE_API Array : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Array); /** * An iterator that can be used to iterate over array elements. diff --git a/lib/base/bufferedstream.h b/lib/base/bufferedstream.h index 4176a7754..75934f553 100644 --- a/lib/base/bufferedstream.h +++ b/lib/base/bufferedstream.h @@ -35,8 +35,7 @@ namespace icinga class I2_BASE_API BufferedStream : public Stream { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(BufferedStream); BufferedStream(const Stream::Ptr& innerStream); ~BufferedStream(void); diff --git a/lib/base/consolelogger.h b/lib/base/consolelogger.h index 973d5fd21..f39ef56af 100644 --- a/lib/base/consolelogger.h +++ b/lib/base/consolelogger.h @@ -34,8 +34,7 @@ namespace icinga class I2_BASE_API ConsoleLogger : public StreamLogger { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(ConsoleLogger); explicit ConsoleLogger(const Dictionary::Ptr& serializedUpdate); }; diff --git a/lib/base/dictionary.h b/lib/base/dictionary.h index 2bb9061af..8f8e669c3 100644 --- a/lib/base/dictionary.h +++ b/lib/base/dictionary.h @@ -36,8 +36,7 @@ namespace icinga class I2_BASE_API Dictionary : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Dictionary); /** * An iterator that can be used to iterate over dictionary elements. diff --git a/lib/base/dynamicobject.h b/lib/base/dynamicobject.h index 0ad599c74..1308ab0a2 100644 --- a/lib/base/dynamicobject.h +++ b/lib/base/dynamicobject.h @@ -42,8 +42,7 @@ class DynamicType; class I2_BASE_API DynamicObject : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(DynamicObject); typedef std::map AttributeMap; typedef AttributeMap::iterator AttributeIterator; diff --git a/lib/base/dynamictype.h b/lib/base/dynamictype.h index b4e65670d..7b7c8dd90 100644 --- a/lib/base/dynamictype.h +++ b/lib/base/dynamictype.h @@ -34,8 +34,7 @@ namespace icinga class I2_BASE_API DynamicType : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(DynamicType); typedef boost::function ObjectFactory; diff --git a/lib/base/fifo.h b/lib/base/fifo.h index 97c81e1a1..cab32b160 100644 --- a/lib/base/fifo.h +++ b/lib/base/fifo.h @@ -34,10 +34,9 @@ namespace icinga class I2_BASE_API FIFO : public Stream { public: - static const size_t BlockSize = 16 * 1024; + DECLARE_PTR_TYPEDEFS(FIFO); - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + static const size_t BlockSize = 16 * 1024; FIFO(void); ~FIFO(void); diff --git a/lib/base/filelogger.h b/lib/base/filelogger.h index 9c872b313..5ed0f2df7 100644 --- a/lib/base/filelogger.h +++ b/lib/base/filelogger.h @@ -34,8 +34,7 @@ namespace icinga class I2_BASE_API FileLogger : public StreamLogger { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(FileLogger); explicit FileLogger(const Dictionary::Ptr& serializedUpdate); diff --git a/lib/base/logger.h b/lib/base/logger.h index dc11f8109..085ebbb89 100644 --- a/lib/base/logger.h +++ b/lib/base/logger.h @@ -48,8 +48,7 @@ struct LogEntry { class I2_BASE_API Logger : public DynamicObject { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Logger); explicit Logger(const Dictionary::Ptr& serializedUpdate); diff --git a/lib/base/networkstream.h b/lib/base/networkstream.h index cff765b48..018f02f30 100644 --- a/lib/base/networkstream.h +++ b/lib/base/networkstream.h @@ -35,8 +35,7 @@ namespace icinga class I2_BASE_API NetworkStream : public Stream { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(NetworkStream); NetworkStream(const Socket::Ptr& socket); diff --git a/lib/base/object.h b/lib/base/object.h index 2fcf8d240..2fe2c37be 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -44,6 +44,10 @@ namespace icinga class Value; +#define DECLARE_PTR_TYPEDEFS(klass) \ + typedef shared_ptr Ptr; \ + typedef weak_ptr WeakPtr + /** * Base class for all heap-allocated objects. At least one of its methods * has to be virtual for RTTI to work. @@ -53,8 +57,7 @@ class Value; class I2_BASE_API Object : public boost::enable_shared_from_this { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Object); Object(void); virtual ~Object(void); diff --git a/lib/base/process.h b/lib/base/process.h index 1587752a6..79513122f 100644 --- a/lib/base/process.h +++ b/lib/base/process.h @@ -54,8 +54,7 @@ struct ProcessResult class I2_BASE_API Process : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(Process); static const std::deque::size_type MaxTasksPerThread = 512; diff --git a/lib/base/ringbuffer.h b/lib/base/ringbuffer.h index 200ffecdf..bd0579f1f 100644 --- a/lib/base/ringbuffer.h +++ b/lib/base/ringbuffer.h @@ -35,8 +35,7 @@ namespace icinga class I2_BASE_API RingBuffer : public Object { public: - typedef shared_ptr Ptr; - typedef weak_ptr WeakPtr; + DECLARE_PTR_TYPEDEFS(RingBuffer); typedef std::vector::size_type SizeType; diff --git a/lib/base/script.h b/lib/base/script.h index 7c359c7d0..e34d55d94 100644 --- a/lib/base/script.h +++ b/lib/base/script.h @@ -36,8 +36,7 @@ class ScriptInterpreter; class I2_BASE_API Script : public DynamicObject { public: - typedef shared_ptr