X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FBaseObjects%2FPort.cxx;h=6236ae1fcd447c702b455df51371e333e3452be0;hb=db0a767418f78b371c1e4fb0db00e6b75df74ff3;hp=06b10ee097a2d6100eecabec1d79bf80539e2dea;hpb=49d2d7db538d60008b9a5701ea8f26bb19997a82;p=cpPlugins.git diff --git a/lib/cpPlugins/BaseObjects/Port.cxx b/lib/cpPlugins/BaseObjects/Port.cxx index 06b10ee..6236ae1 100644 --- a/lib/cpPlugins/BaseObjects/Port.cxx +++ b/lib/cpPlugins/BaseObjects/Port.cxx @@ -149,19 +149,25 @@ cpPlugins::BaseObjects::MultipleInputsPort:: void cpPlugins::BaseObjects::MultipleInputsPort:: Add( cpPlugins::BaseObjects::DataObject* o ) { - /* TODO - if( o == NULL ) - return; - auto otype = std::type_index( typeid( *o ) ); - if( this->m_Type == otype ) - this->m_Data.push_back( o ); - else - throw std::logic_error( - "cpPlugins::MultipleInputsPort: incompatible types \"" + - std::string( otype.name( ) ) + std::string( "\" and \"" ) + - std::string( this->m_Type.name( ) ) + std::string( "\"" ) - ); - */ + if( this->m_Sample.IsNull( ) ) + throw std::logic_error( + "cpPlugins::SingleDataPort: Port not yet configured" + ); + if( o != NULL ) + { + if( this->m_Sample->IsCompatible( o ) ) + { + this->m_Data.push_back( o ); + } + else + throw std::logic_error( + "cpPlugins::SingleDataPort: incompatible types \"" + + std::string( typeid( *o ).name( ) ) + std::string( "\" and \"" ) + + std::string( typeid( *( this->m_Sample.GetPointer( ) ) ).name( ) ) + + std::string( "\"" ) + ); + + } // fi } // -------------------------------------------------------------------------