-#include <iostream>
-namespace cpPlugins
-{
- struct PathHelper
- {
- // ---------------------------------------------------------------------
- inline bool operator()( char c ) const
- {
-#ifdef cpPlugins_SYS_WINDOWS
- return( c == '\\' || c == '/' );
-#else // cpPlugins_SYS_WINDOWS
- return( c == '/' );
-#endif // cpPlugins_SYS_WINDOWS
- }
-
- // ---------------------------------------------------------------------
- inline static std::string CanonicalPath( const std::string& path )
- {
- std::string ret = "";
-#ifdef cpPlugins_SYS_WINDOWS
- TCHAR buffer[ 4096 ] = TEXT( "" );
- TCHAR** lppPart = { NULL };
- GetFullPathName( path.c_str( ), 4096, buffer, lppPart );
- ret = std::string( buffer );
-#else // cpPlugins_SYS_WINDOWS
- char* canonical_path = realpath( path.c_str( ), NULL );
- if( canonical_path != NULL )
- {
- ret = canonical_path;
- free( canonical_path );
-
- } // fi
-#endif // cpPlugins_SYS_WINDOWS
- return( ret );
- }
- };
-
-} // ecapseman
-
-#endif // __CPPLUGINS__CONFIG__H__
+
+#define cpPluginsNewMacro( x ) \
+ static Pointer New( ) \
+ { \
+ Pointer smartPtr = new x( ); \
+ smartPtr->UnRegister( ); \
+ return( smartPtr ); \
+ } \
+ virtual itk::LightObject::Pointer \
+ CreateAnother( ) const cpPlugins_OVERRIDE \
+ { \
+ itk::LightObject::Pointer smartPtr; \
+ smartPtr = x::New( ).GetPointer( ); \
+ return( smartPtr ); \
+ } \
+ Pointer Clone( ) const \
+ { \
+ Pointer rval = \
+ dynamic_cast< x* >( this->InternalClone( ).GetPointer( ) ); \
+ return( rval ); \
+ }
+
+#define cpPlugins_Id_Macro( _class, _category ) \
+ public: \
+ virtual const char* GetClassName( ) const cpPlugins_OVERRIDE \
+ { return( #_class ); } \
+ virtual const char* GetClassCategory( ) const cpPlugins_OVERRIDE \
+ { return( #_category ); }
+
+#define cpPluginsObject( _cls, _scls, _cat ) \
+ public: \
+ typedef _cls Self; \
+ typedef _scls Superclass; \
+ typedef itk::SmartPointer< Self > Pointer; \
+ typedef itk::SmartPointer< const Self > ConstPointer; \
+ public: \
+ cpPluginsNewMacro( Self ); \
+ itkTypeMacro( _cls, _scls ); \
+ public: \
+ virtual const char* GetClassName( ) const cpPlugins_OVERRIDE \
+ { return( #_cls ); } \
+ virtual const char* GetClassCategory( ) const cpPlugins_OVERRIDE \
+ { return( #_cat ); } \
+ protected: \
+ _cls( ); \
+ virtual ~_cls( ); \
+ virtual void _GenerateData( ) cpPlugins_OVERRIDE; \
+ private: \
+ _cls( const Self& ); \
+ Self& operator=( const Self& )
+
+#define cpPlugins_Compatibility_Macro \
+ virtual bool IsCompatible( \
+ const DataObject* other \
+ ) const cpPlugins_OVERRIDE \
+ { \
+ return( dynamic_cast< const Self* >( other ) != NULL ); \
+ }
+
+#endif // __cpPlugins__Config__h__