#include <cpPlugins/Interface/SimpleMPRWidget.h>
#endif // cpPlugins_Interface_QT4
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+SetITK( itk::LightObject* o )
+{
+ // Polymorphism: do nothing -> this is a filter!!!
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+SetVTK( vtkObjectBase* o )
+{
+ // Polymorphism: do nothing -> this is a filter!!!
+}
+
// -------------------------------------------------------------------------
std::set< std::string > cpPlugins::Interface::ProcessObject::
GetInputsNames( ) const
// -------------------------------------------------------------------------
cpPlugins::Interface::
-ProcessObjectPort& cpPlugins::Interface::ProcessObject::
+OutputProcessObjectPort& cpPlugins::Interface::ProcessObject::
GetOutput( const std::string& id )
{
- static ProcessObjectPort null_port;
+ static OutputProcessObjectPort null_port;
auto i = this->m_Outputs.find( id );
if( i == this->m_Outputs.end( ) )
{
// -------------------------------------------------------------------------
const cpPlugins::Interface::
-ProcessObjectPort& cpPlugins::Interface::ProcessObject::
+OutputProcessObjectPort& cpPlugins::Interface::ProcessObject::
GetOutput( const std::string& id ) const
{
- static const ProcessObjectPort null_port;
+ static const OutputProcessObjectPort null_port;
auto i = this->m_Outputs.find( id );
if( i == this->m_Outputs.end( ) )
return( null_port );
// -------------------------------------------------------------------------
bool cpPlugins::Interface::ProcessObject::
-SetInput( const std::string& id, const ProcessObjectPort& port )
+SetInput( const std::string& id, const OutputProcessObjectPort& port )
{
auto i = this->m_Inputs.find( id );
if( i != this->m_Inputs.end( ) )
auto i = this->m_Outputs.begin( );
for( ; i != this->m_Outputs.end( ); ++i )
if( i->second.IsValid( ) )
- i->second->DisconnectPipeline( );
+ i->second->DisconnectFromPipeline( );
this->Modified( );
}
{
auto params_time = this->m_Parameters->GetMTime( );
auto filter_time = this->Superclass::GetMTime( );
- auto ipobj = this->GetITK< itk::ProcessObject >( );
- if( ipobj == NULL )
- {
- auto vpobj = this->GetVTK< vtkAlgorithm >( );
- if( vpobj != NULL )
- filter_time = ( const_cast< vtkAlgorithm* >( vpobj ) )->GetMTime( );
- }
- else
- filter_time = ipobj->GetMTime( );
- return( ( params_time < filter_time )? filter_time: params_time );
+ return( ( params_time < filter_time )? params_time: filter_time );
}
// -------------------------------------------------------------------------
std::string r = "";
// Force upstream updates
- _TDataContainer::iterator i = this->m_Inputs.begin( );
+ auto i = this->m_Inputs.begin( );
bool need_to_update = false;
for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
{
- if( i->second.IsValid( ) )
+ bool iv = i->second.IsValid( );
+ bool ir = i->second.IsRequired( );
+ if( !iv && ir )
+ r =
+ "ProcessObject: Required input \"" +
+ i->first + "@" + this->GetClassName( ) +
+ "\" is not valid (=NULL).";
+ if( iv && r == "" )
{
Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
if( src != NULL )
r = src->Update( );
} // fi
- }
- else
- r = "cpPlugins::Interface::ProcessObject: No input connected.";
+
+ } // fi
} // rof
// -------------------------------------------------------------------------
void cpPlugins::Interface::ProcessObject::
-_AddInput( const std::string& name )
+_AddInput( const std::string& name, bool required )
{
- typedef typename _TDataContainer::value_type _TValue;
auto i = this->m_Inputs.find( name );
if( i == this->m_Inputs.end( ) )
{
- i = this->m_Inputs.insert( _TValue( name, NULL ) ).first;
+ InputProcessObjectPort new_port( required );
+ this->m_Inputs[ name ] = new_port;
this->Modified( );
} // fi