]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/DataObject.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / DataObject.cxx
index 580434548740a34c758e10bb702be2e0705363ba..0bbe13bdeb4973d0d23ee9b11c3f350aabcca5e5 100644 (file)
@@ -1,30 +1,34 @@
 #include <cpPlugins/Interface/DataObject.h>
 
+#include <cpPlugins/Interface/ProcessObject.h>
 #include <itkDataObject.h>
 #include <vtkImageData.h>
 #include <vtkPolyData.h>
 
 // -------------------------------------------------------------------------
-cpPlugins::Interface::Object* cpPlugins::Interface::DataObject::
+cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
 GetSource( )
 {
-  return( this->m_Source );
+  auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+  return( ptr->GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
-const cpPlugins::Interface::Object* cpPlugins::Interface::DataObject::
+const cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
 GetSource( ) const
 {
-  return( this->m_Source );
+  auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+  return( ptr->GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::DataObject::
-SetSource( cpPlugins::Interface::Object* src )
+SetSource( cpPlugins::Interface::ProcessObject* src )
 {
-  if( this->m_Source.GetPointer( ) != src )
+  auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+  if( ptr->GetPointer( ) != src )
   {
-    this->m_Source = src;
+    *ptr = src;
     this->Modified( );
 
   } // fi
@@ -32,7 +36,7 @@ SetSource( cpPlugins::Interface::Object* src )
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::DataObject::
-DisconnectPipeline( )
+DisconnectFromPipeline( )
 {
   // Disconnect input pipelines (ITK)
   itk::DataObject* itk_obj = this->GetITK< itk::DataObject >( );
@@ -59,23 +63,27 @@ DisconnectPipeline( )
   } // fi
 
   // Unbind source
-  this->m_Source = NULL;
+  auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+  *ptr = NULL;
+  this->Modified( );
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::DataObject::
 DataObject( )
-  : Superclass( ),
-    m_ITKObject( NULL ),
-    m_VTKObject( NULL ),
-    m_Source( NULL )
+  : Superclass( )
 {
+  this->m_Source = new ProcessObject::Pointer( );
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::DataObject::
 ~DataObject( )
 {
+  /* TODO
+     auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+     delete ptr;
+  */
 }
 
 // eof - $RCSfile$