]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/Object.h
First modifications to make this work on MS-Windows
[cpPlugins.git] / lib / cpPlugins / Interface / Object.h
1 #ifndef __CPPLUGINS__INTERFACE__OBJECT__H__
2 #define __CPPLUGINS__INTERFACE__OBJECT__H__
3
4 #include <string>
5 #include <Pluma/Pluma.hpp>
6 #include <itkObject.h>
7 #include <itkObjectFactory.h>
8 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
9
10
11 // -------------------------------------------------------------------------
12 #define PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( TYPE )\
13 class cpPlugins_Interface_EXPORT TYPE##Provider\
14 : public pluma::Provider{\
15 private:\
16     friend class pluma::Pluma;\
17     static const unsigned int PLUMA_INTERFACE_VERSION;\
18     static const unsigned int PLUMA_INTERFACE_LOWEST_VERSION;\
19     static const std::string PLUMA_PROVIDER_TYPE;\
20     std::string plumaGetType( ) const\
21 { return( PLUMA_PROVIDER_TYPE ); }\
22 public:\
23     unsigned int getVersion( ) const\
24 { return( PLUMA_INTERFACE_VERSION ); }
25
26 // -------------------------------------------------------------------------
27 #define PLUMA_PROVIDER_HEADER_END_CPPLUGINS };
28
29 // -------------------------------------------------------------------------
30 #define PLUMA_PROVIDER_HEADER_CPPLUGINS( TYPE )         \
31   PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( TYPE )         \
32   virtual TYPE::Pointer create( ) const = 0;            \
33   PLUMA_PROVIDER_HEADER_END_CPPLUGINS
34
35 // -------------------------------------------------------------------------
36 #define PLUMA_INHERIT_PROVIDER_CPPLUGINS( TYPE, SUPER ) \
37   class TYPE##Provider                                  \
38     : public SUPER##Provider                            \
39   {                                                     \
40   public:                                               \
41     SUPER::Pointer create( ) const                      \
42     {                                                   \
43       TYPE::Pointer a = TYPE::New( );                   \
44       SUPER::Pointer b = a.GetPointer( );               \
45       return( b );                                      \
46     }                                                   \
47   };
48
49 namespace cpPlugins
50 {
51   namespace Interface
52   {
53     /**
54      */
55     class cpPlugins_Interface_EXPORT Object
56       : public itk::Object
57     {
58     public:
59       typedef Object                          Self;
60       typedef itk::Object                     Superclass;
61       typedef itk::SmartPointer< Self >       Pointer;
62       typedef itk::SmartPointer< const Self > ConstPointer;
63
64     public:
65       itkNewMacro( Self );
66       itkTypeMacro( Object, itkObject );
67
68     public:
69       virtual std::string GetClassName( ) const;
70       virtual std::string GetClassType( ) const;
71
72     protected:
73       Object( );
74       virtual ~Object( );
75
76     private:
77       // Purposely not implemented
78       Object( const Self& );
79       Self& operator=( const Self& );
80     };
81
82     // TODO: doc
83     PLUMA_PROVIDER_HEADER_CPPLUGINS( Object );
84
85   } // ecapseman
86
87 } // ecapseman
88
89 #endif // __CPPLUGINS__INTERFACE__OBJECT__H__
90
91 // eof - $RCSfile$