Просмотр исходного кода

Added isNull method to ctkEvent

Sascha Zelzer лет назад: 14
Родитель
Сommit
c1d2e5179f

+ 5 - 0
Libs/PluginFramework/service/event/ctkEvent.cpp

@@ -96,6 +96,11 @@ ctkEvent::~ctkEvent()
 {
 }
 
+bool ctkEvent::isNull() const
+{
+  return !d;
+}
+
 ctkEvent& ctkEvent::operator=(const ctkEvent& other)
 {
   d = other.d;

+ 9 - 0
Libs/PluginFramework/service/event/ctkEvent.h

@@ -54,6 +54,15 @@ public:
   ~ctkEvent();
 
   /**
+   * Can be used to check if this ctkEvent instance is valid,
+   * or if it has been constructed using the default constructor.
+   *
+   * @return <code>true</code> if this event object is valid,
+   *         <code>false</code> otherwise.
+   */
+  bool isNull() const;
+
+  /**
    * Constructs an event.
    *
    * @param topic The topic of the event.