diff --git a/kernel/src/kernel/scenario/ovkCBox.cpp b/kernel/src/kernel/scenario/ovkCBox.cpp index c28b71776a278c8fe4a46853f40fe8d919a833da..2059c084b9c785a9456a5a3313f94a698c798d46 100644 --- a/kernel/src/kernel/scenario/ovkCBox.cpp +++ b/kernel/src/kernel/scenario/ovkCBox.cpp @@ -7,11 +7,47 @@ #include <openvibe/ov_defines.h> + + +namespace{ + class CBoxProtoRestriction : public OpenViBE::Kernel::CBoxProto + { + public: + + CBoxProtoRestriction(const OpenViBE::Kernel::IKernelContext& rKernelContext, OpenViBE::Kernel::IBox& rBox): + CBoxProto(rKernelContext, rBox){} + + virtual OpenViBE::boolean addInput( + const OpenViBE::CString& sName, + const OpenViBE::CIdentifier& rTypeIdentifier){return true;} + + virtual OpenViBE::boolean addMessageInput( + const OpenViBE::CString& sName){return true;} + virtual OpenViBE::boolean addMessageOutput( + const OpenViBE::CString& sName){return true;} + + virtual OpenViBE::boolean addOutput( + const OpenViBE::CString& sName, + const OpenViBE::CIdentifier& rTypeIdentifier){return true;} + + virtual OpenViBE::boolean addSetting( + const OpenViBE::CString& sName, + const OpenViBE::CIdentifier& rTypeIdentifier, + const OpenViBE::CString& sDefaultValue, + const OpenViBE::boolean bModifiable = false){return true;} + + virtual OpenViBE::boolean addFlag( + const OpenViBE::Kernel::EBoxFlag eBoxFlag){return true;} + }; +} + + using namespace std; using namespace OpenViBE; using namespace OpenViBE::Kernel; using namespace OpenViBE::Plugins; + //___________________________________________________________________// // // @@ -125,27 +161,9 @@ boolean CBox::setAlgorithmClassIdentifier( } } - CBox oTemp(this->getKernelContext(), m_rOwnerScenario); - CBoxProto oTempProto(this->getKernelContext(), oTemp); + CBoxProtoRestriction oTempProto(this->getKernelContext(), *this); m_pBoxAlgorithmDescriptor->getBoxPrototype(oTempProto); - CIdentifier l_oStreamTypeIdentifier = OV_UndefinedIdentifier; - while((l_oStreamTypeIdentifier=this->getKernelContext().getTypeManager().getNextTypeIdentifier(l_oStreamTypeIdentifier))!=OV_UndefinedIdentifier) - { - if(this->getKernelContext().getTypeManager().isStream(l_oStreamTypeIdentifier)) - { - //First check if it is a stream - if(oTemp.hasInputSupport(l_oStreamTypeIdentifier)) - { - this->addInputSupport(l_oStreamTypeIdentifier); - } - if(oTemp.hasOutputSupport(l_oStreamTypeIdentifier)) - { - this->addOutputSupport(l_oStreamTypeIdentifier); - } - } - } - this->notify(BoxModification_AlgorithmClassIdentifierChanged); return true;