]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Object.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / Object.h
index b15d1f0824ccfb87e9c5542642d681918ce77205..ef8cab82dfedf6c96feaa84174cd9ef86462c1ca 100644 (file)
@@ -3,13 +3,15 @@
 
 #include <string>
 #include <Pluma/Pluma.hpp>
+#include <cpPlugins/cpPlugins_Export.h>
+
+#define ITK_MANUAL_INSTANTIATION
 #include <itkObject.h>
 #include <itkObjectFactory.h>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 
 // -------------------------------------------------------------------------
-#define PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( TYPE )           \
-  class cpPlugins_Interface_EXPORT TYPE##Provider               \
+#define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE )                 \
+  class cpPlugins_EXPORT TYPE##Provider               \
     : public pluma::Provider                                    \
   {                                                             \
   private:                                                      \
     { return( PLUMA_INTERFACE_VERSION ); }
 
 // -------------------------------------------------------------------------
-#define PLUMA_PROVIDER_HEADER_END_CPPLUGINS };
+#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 PLUMA_PROVIDER_HEADER_CPPLUGINS( TYPE )         \
-  PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( TYPE )         \
-  virtual TYPE::Pointer create( ) const = 0;            \
-  PLUMA_PROVIDER_HEADER_END_CPPLUGINS
+#define CPPLUGINS_PROVIDER_SOURCE( TYPE, Version, LowestVersion )       \
+  PLUMA_PROVIDER_SOURCE( TYPE, Version, LowestVersion )
 
 // -------------------------------------------------------------------------
-#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_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
@@ -52,7 +58,7 @@ namespace cpPlugins
   {
     /**
      */
-    class cpPlugins_Interface_EXPORT Object
+    class cpPlugins_EXPORT Object
       : public itk::Object
     {
     public:
@@ -66,8 +72,8 @@ namespace cpPlugins
       itkTypeMacro( Object, itkObject );
 
     public:
-      virtual std::string GetClassName( ) const;
-      virtual std::string GetClassType( ) const;
+      itkGetConstMacro( ClassName, std::string );
+      itkGetConstMacro( ClassCategory, std::string );
 
     protected:
       Object( );
@@ -77,10 +83,16 @@ namespace cpPlugins
       // Purposely not implemented
       Object( const Self& );
       Self& operator=( const Self& );
+
+    protected:
+      std::string m_ClassName;
+      std::string m_ClassCategory;
     };
 
-    // TODO: doc
-    PLUMA_PROVIDER_HEADER_CPPLUGINS( Object );
+    /**
+     * Plugin provider
+     */
+    CPPLUGINS_PROVIDER_HEADER( Object );
 
   } // ecapseman