]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Object.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / Object.h
index 33cfdd7079cd61ab1e361369a3af305c271d3872..fe86f1bc7efbb140e4b0e4f571bcc72e811bfd54 100644 (file)
@@ -8,23 +8,46 @@
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 
 // -------------------------------------------------------------------------
-#define PLUMA_PROVIDER_HEADER_CPPLUGINS( TYPE )         \
-  PLUMA_PROVIDER_HEADER_BEGIN( TYPE )                   \
-  virtual TYPE::Pointer create( ) const = 0;            \
-  PLUMA_PROVIDER_HEADER_END
+#define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE )                 \
+  class cpPlugins_Interface_EXPORT TYPE##Provider               \
+    : public pluma::Provider                                    \
+  {                                                             \
+  private:                                                      \
+    friend class pluma::Pluma;                                  \
+    static const unsigned int PLUMA_INTERFACE_VERSION;          \
+    static const unsigned int PLUMA_INTERFACE_LOWEST_VERSION;   \
+    static const std::string PLUMA_PROVIDER_TYPE;               \
+    std::string plumaGetType( ) const                           \
+    { return( PLUMA_PROVIDER_TYPE ); }                          \
+  public:                                                       \
+    unsigned int getVersion( ) const                            \
+    { return( PLUMA_INTERFACE_VERSION ); }
 
 // -------------------------------------------------------------------------
-#define PLUMA_INHERIT_PROVIDER_CPPLUGINS( TYPE, SUPER ) \
-  class TYPE##Provider                                  \
-    : public SUPER##Provider                            \
-  {                                                     \
-  public:                                               \
-    SUPER::Pointer create( ) const                      \
-    {                                                   \
-      TYPE::Pointer a = TYPE::New( );                   \
-      SUPER::Pointer b = a.GetPointer( );               \
-      return( b );                                      \
-    }                                                   \
+#define CPPLUGINS_PROVIDER_HEADER_END };
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_PROVIDER_HEADER( TYPE )               \
+  CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE )               \
+    virtual TYPE::Pointer create( ) const = 0;          \
+  CPPLUGINS_PROVIDER_HEADER_END
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_PROVIDER_SOURCE( TYPE, Version, LowestVersion )       \
+  PLUMA_PROVIDER_SOURCE( TYPE, Version, LowestVersion )
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_INHERIT_PROVIDER( TYPE )                              \
+  class TYPE##Provider                                                  \
+    : public cpPlugins::Interface::ObjectProvider                       \
+  {                                                                     \
+  public:                                                               \
+    cpPlugins::Interface::Object::Pointer create( ) const               \
+    {                                                                   \
+      TYPE::Pointer a = TYPE::New( );                                   \
+      cpPlugins::Interface::Object::Pointer b = a.GetPointer( );        \
+      return( b );                                                      \
+    }                                                                   \
   };
 
 namespace cpPlugins
@@ -60,8 +83,10 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // TODO: doc
-    PLUMA_PROVIDER_HEADER_CPPLUGINS( Object );
+    /**
+     * Plugin provider
+     */
+    CPPLUGINS_PROVIDER_HEADER( Object );
 
   } // ecapseman