X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FObject.h;h=6e273f174264f5fe3ea7f822c5254a76102557e8;hb=94a44f4cdf4747eccc933df0a9c75ec86e825d2e;hp=a51f657add190bd983f23b0975109292ae84c90f;hpb=351f2e4ce6e3b11e77ba27998d41ff4310b806ad;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Object.h b/lib/cpPlugins/Interface/Object.h index a51f657..6e273f1 100644 --- a/lib/cpPlugins/Interface/Object.h +++ b/lib/cpPlugins/Interface/Object.h @@ -3,47 +3,52 @@ #include #include -#include -#include #include +#include +#include // ------------------------------------------------------------------------- -#define PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( 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_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_PROVIDER_HEADER_END_CPPLUGINS }; +#define CPPLUGINS_PROVIDER_HEADER_END }; // ------------------------------------------------------------------------- -#define PLUMA_PROVIDER_HEADER_CPPLUGINS( TYPE ) \ - PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( TYPE ) \ +#define CPPLUGINS_PROVIDER_HEADER( TYPE ) \ + CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \ virtual TYPE::Pointer create( ) const = 0; \ - PLUMA_PROVIDER_HEADER_END_CPPLUGINS + CPPLUGINS_PROVIDER_HEADER_END + +// ------------------------------------------------------------------------- +#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 @@ -66,8 +71,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 +82,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