-#ifndef __CPPLUGINS__INTERFACE__PLUGINS__H__
-#define __CPPLUGINS__INTERFACE__PLUGINS__H__
+#ifndef __cpPlugins__Interface__Plugins__h__
+#define __cpPlugins__Interface__Plugins__h__
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-
-#include <map>
-#include <set>
-#include <string>
-
-#include <cpPlugins/Interface/Interface.h>
-#include <cpPlugins/Interface/ProcessObject.h>
-#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/Mesh.h>
-
-class QObject;
-class QMenu;
-class QWidget;
+#include <cpPlugins/Config.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+#include <itkObject.h>
namespace cpPlugins
{
{
/**
*/
- class cpPlugins_Interface_EXPORT Plugins
+ class cpPlugins_EXPORT Plugins
+ : public itk::Object
{
public:
- typedef cpPlugins::Interface::Interface TInterface;
- typedef cpPlugins::Interface::ProcessObject TProcessObject;
- typedef cpPlugins::Interface::DataObject TDataObject;
- typedef cpPlugins::Interface::Image TImage;
- typedef cpPlugins::Interface::Mesh TMesh;
- typedef TProcessObject::TParameters TParameters;
-
- typedef std::set< std::string > TOrderedStringContainer;
- typedef std::map< std::string, std::set< std::string > > TFilters;
+ typedef Plugins Self;
+ typedef itk::Object Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef void* ( *TCreator )( );
+ typedef std::map< std::string, void* > TLibraries;
+ struct TCreatorData
+ {
+ std::string PluginName;
+ void* LibraryHandle;
+ TCreator Creator;
+ };
+ typedef std::map< std::string, TCreatorData > TFilterData;
+ typedef std::map< std::string, TFilterData > TFilters;
+ typedef std::set< std::string > TStrings;
+
+ typedef cpPlugins::BaseObjects::ProcessObject TProcess;
public:
- Plugins( QWidget* widget = NULL );
- virtual ~Plugins( );
-
- QWidget* GetWidget( );
- const QWidget* GetWidget( ) const;
- void SetWidget( QWidget* widget );
- void BlockWidget( );
- void UnblockWidget( );
- void DialogLoadPlugins( );
- void AssociatePluginsToMenu(
- QMenu* menu, QObject* obj, const char* slot
- );
-
- bool LoadPlugins( const std::string& fname );
- bool LoadPluginsConfigurationFile( const std::string& fname );
+ itkTypeMacro( Plugins, itk::Object );
+ itkGetConstMacro( Paths, TStrings );
- TParameters* GetImageReaderParameters( );
- TParameters* GetMeshReaderParameters( );
- TParameters* GetImageWriterParameters( );
- TParameters* GetMeshWriterParameters( );
-
- const TParameters* GetImageReaderParameters( ) const;
- const TParameters* GetMeshReaderParameters( ) const;
- const TParameters* GetImageWriterParameters( ) const;
- const TParameters* GetMeshWriterParameters( ) const;
-
- // Data IO
- bool ReadImage( TImage::Pointer& image, bool exec_qt = false );
- bool ReadDicomSeries( TImage::Pointer& image );
- bool ReadMesh( TMesh::Pointer& mesh, bool exec_qt = false );
-
- bool WriteImage( TImage* image, bool exec_qt = false );
- bool WriteMesh( TMesh* mesh, bool exec_qt = false );
-
- // Filter acces
- bool CreateFilter(
- TProcessObject::Pointer& filter, const std::string& name
+ public:
+ static Pointer New( );
+ virtual itk::LightObject::Pointer CreateAnother( ) const cpPlugins_OVERRIDE;
+ Pointer Clone( ) const;
+
+ TStrings GetLibraries( ) const;
+ TStrings GetPlugins( ) const;
+ TStrings GetCategories( ) const;
+ TStrings GetFilters( const std::string& category ) const;
+
+ void AddEnvironments( const std::string& env );
+ void LoadEnvironments( );
+ void LoadPaths( const std::string& dir );
+ void SavePaths( const std::string& dir ) const;
+
+ void LoadFile( const std::string& fname );
+ void LoadPlugin( const std::string& pname );
+ void LoadDirectory( const std::string& dirname );
+ void GuessPlugins( );
+
+ TProcess::Pointer CreateProcessObject(
+ const std::string& category, const std::string& name
);
protected:
- void _Update( );
+ Plugins( );
+ virtual ~Plugins( );
+ virtual void PrintSelf(
+ std::ostream& os, itk::Indent indent
+ ) const cpPlugins_OVERRIDE;
+
+ private:
+ // Purposely not implemented
+ Plugins( const Self& other );
+ Self& operator=( const Self& other );
protected:
- QWidget* m_Widget;
-
- TInterface m_Interface;
- TOrderedStringContainer m_LoadedPlugins;
- std::string m_LastLoadedPlugin;
-
- TProcessObject::Pointer m_ImageReader;
- TProcessObject::Pointer m_ImageWriter;
- TProcessObject::Pointer m_MeshReader;
- TProcessObject::Pointer m_MeshWriter;
- TProcessObject::Pointer m_DicomSeriesReader;
- TFilters m_Filters;
+ TStrings m_Paths;
+ TLibraries m_Libraries;
+ TLibraries m_Plugins;
+ TFilters m_Filters;
};
} // ecapseman
} // ecapseman
-#endif // __CPPLUGINS__INTERFACE__PLUGINS__H__
+#endif // __cpPlugins__Interface__Plugins__h__
// eof - $RCSfile$