Exemple #1
0
MLProcPtr MLProcFactory::create(const ml::Symbol className, MLDSPContext* context)
{
	MLProcCreateFnT fn;
	MLProcPtr resultProc;
	
	// get named entry from registry
	FnRegistryT::const_iterator regEntry = procRegistry.find(className);
	
	if (regEntry != procRegistry.end()) 
	{
		// get creator fn from entry
		fn = regEntry->second;
		// call creator fn returning new MLProc subclass instance
		resultProc = fn();
		resultProc->setContext(context);
		
		// give root context pointer to new containers
		if(resultProc->isContainer())
		{
			MLProcContainer& resultContainer = static_cast<MLProcContainer&>(*resultProc);
			resultContainer.setRootContext(context->getRootContext());
		}
	}
	else
	{
		// TODO anything? 
		debug() << "MLProcFactory::create: class " << className << " not found!!";
	}
	
	return resultProc;
}
// make a new instance of a named subclass of MLProc. 
//
MLProcPtr MLMultiContainer::newProc(const MLSymbol className, const MLSymbol procName) 
{
	MLProcPtr pNew;
	
	// call factory to get instance of processor class
	// sets context of new proc to this.
	pNew = theProcFactory.create(className, this);	
	if (!pNew)
	{
		debug() << "MLMultiContainer: newProc: couldn't create!\n";
	}
	else
	{
		pNew->setName(procName);
		pNew->setContext(this);
	}
	return pNew;
}
Exemple #3
0
MLProcPtr MLProcFactory::create(const MLSymbol className, MLDSPContext* context)
{
	MLProcCreateFnT fn;
    MLProcPtr resultProc;
	
	// get named entry from registry
    FnRegistryT::const_iterator regEntry = procRegistry.find(className);
	
    if (regEntry != procRegistry.end()) 
    {
		// get creator fn from entry
		fn = regEntry->second;
		// call creator fn returning new MLProc subclass instance
        resultProc = fn();
		resultProc->setContext(context);
    }
	else
	{
		 // TODO anything? 
		debug() << "MLProcFactory::create: class " << className << " not found!!";
	}

    return resultProc;
}