]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Macros.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / Macros.h
index 0a6bd60553ee5381f475f4de4d8f2a3dca8e4046..790a99765c64d508ebfe0d0c32b97a0965e5d7c7 100644 (file)
@@ -1,12 +1,62 @@
 #ifndef __CPPLUGINS__INTERFACE__MACROS__H__
 #define __CPPLUGINS__INTERFACE__MACROS__H__
 
+#include <Pluma/Pluma.hpp>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Config.h>
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Id_Macro( N, C )                                      \
+  public:                                                               \
+  virtual const char* GetClassName( ) const     { return( #N ); }       \
+  virtual const char* GetClassCategory( ) const { return( #C ); }
+
+// -------------------------------------------------------------------------
+#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 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::ProcessObjectProvider                \
+  {                                                                     \
+  public:                                                               \
+    cpPlugins::Interface::ProcessObject::Pointer create( ) const        \
+    {                                                                   \
+      TYPE::Pointer a = TYPE::New( );                                   \
+      cpPlugins::Interface::ProcessObject::Pointer b = a.GetPointer( ); \
+      return( b );                                                      \
+    }                                                                   \
+  };
 
 /**
  * Based upon: http://www.itk.org/Wiki/Proposals:Explicit_Instantiation
  */
-
 // -------------------------------------------------------------------------
 #define cpPlugins_TEMPLATE_1( X1 )              \
   X1
 #define cpPlugins_TEMPLATE_IMPORT( X )          \
   extern template cpPlugins_TEMPLATE_##X;
 
-/* TODO
-   #define cpPlugins_EXPORT_TEMPLATE( E, c, T )                 \
-   cpPlugins_TEMPLATE_##c( cpPlugins_TEMPLATE_EXPORT, E, T )
-   #define cpPlugins_IMPORT_TEMPLATE( E, c, T )                 \
-   cpPlugins_TEMPLATE_##c( cpPlugins_TEMPLATE_IMPORT, E, T )
-*/
-
 #endif // __CPPLUGINS__INTERFACE__MACROS__H__
 
 // eof - $RCSfile$