Commit 3948e358 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: added AreAllAccepted method SuperElastix/SuperElastix#32

parent 87748c03
......@@ -31,15 +31,17 @@ class Accepting< >
public:
static unsigned int CountMeetsCriteria( const ComponentBase::InterfaceCriteriaType ) { return 0; }
int ConnectFromImpl( ComponentBase::Pointer other, const ComponentBase::InterfaceCriteriaType interfaceCriteria ) { return 0; } //no interface called interfacename ;
//no interface called interfacename ;
int ConnectFromImpl( ComponentBase::Pointer other, const ComponentBase::InterfaceCriteriaType interfaceCriteria ) { return 0; }
InterfaceStatus CanAcceptConnectionFrom( ComponentBase::ConstPointer, const ComponentBase::InterfaceCriteriaType interfaceCriteria )
{
return InterfaceStatus::noaccepter;
}
//Empty RestInterfaces does 0 successful connects ;
int ConnectFromImpl( ComponentBase::Pointer ) { return 0; }
int ConnectFromImpl( ComponentBase::Pointer ) { return 0; } //Empty RestInterfaces does 0 successful connects ;
bool AreAllAccepted() { return true; }
protected:
};
......@@ -56,6 +58,8 @@ public:
int ConnectFromImpl( ComponentBase::Pointer );
// Helper function by which a component can check if all its Accepting interfaces have been set after the handshakes
bool AreAllAccepted();
protected:
};
} //end namespace selx
......
......@@ -108,5 +108,19 @@ Accepting< FirstInterface, RestInterfaces ... >::CountMeetsCriteria( const Compo
{
return Count< FirstInterface, RestInterfaces ... >::MeetsCriteria( interfaceCriteria );
}
template< typename FirstInterface, typename ... RestInterfaces >
bool
Accepting< FirstInterface, RestInterfaces ... >::AreAllAccepted()
{
InterfaceAcceptor< FirstInterface > * acceptIF = (this);
if (acceptIF->isSet == false)
{
return false;
}
return Accepting<RestInterfaces ...>::AreAllAccepted();
}
} //end namespace selx
#endif // Accepting_hxx
......@@ -35,6 +35,7 @@ InterfaceAcceptor< InterfaceT >::Connect( ComponentBase::Pointer providerCompone
}
// connect value interfaces
this->Set( providerInterface ); // due to the input argument being uniquely defined in the multiple inheritance tree, all versions of Set() are accessible at component level
this->isSet = true;
return 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment