[Clam-devel] Commit #11195: templated plugins generator

Hernán Ordiales h at ordia.com.ar
Mon Mar 3 16:25:02 PST 2008


I have added a new script in the same line: TemplateGenerator.py

Usage: ./TemplateGenerator TEMPLATEFILE

Example of input file:
Name:TestTemplate
BaseClass:Processing
i:AudioInPort
i:AudioInPort
i:AudioInPort
i:AudioInPort
o:AudioOutPort
o:AudioOutPort
ic:i,0,100
ic:i,0,100
ic:i,0,100
ic:i,0,100

Convention:
i (input) | o (output): type
ic (input control) | oc (output control): integer/float, range

Then these two commands:
./TemplateGenerator.py exampleinputfile
./TemplatedPluginsGenerator.py TestProcessing TestTemplate "Fundació
Barcelona Media Universitat Pompeu Fabra" GPL 2007

Generates:

"TestProcessing.hxx"

/*
 * Copyright (c) 2007 Fundació Barcelona Media Universitat Pompeu Fabra
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef _TestProcessing_
#define _TestProcessing_

#include <CLAM/Processing.hxx>
#include <CLAM/AudioInPort.hxx>
#include <CLAM/AudioOutPort.hxx>
#include <CLAM/InControl.hxx>

namespace CLAM {

	/**	\brief Short description
	 *
	 *	Description
	 */
	class TestProcessing: public Processing
	{	
		/** This method returns the name of the object
		 *  @return Char pointer with the name of object
		 */
		const char *GetClassName() const { return "TestProcessing"; }

		/** Ports **/
		AudioInPort mInputAudiooutport0;
		AudioInPort mInputAudiooutport1;
		AudioInPort mInputAudiooutport2;
		AudioInPort mInputAudiooutport3;
		AudioOutPort mOutputAudiooutport0;
		AudioOutPort mOutputAudiooutport1;

		/** Controls **/
		InControl mInputControl0;
		InControl mInputControl1;
		InControl mInputControl2;
		InControl mInputControl3;

	public:
		TestProcessing(const Config & config=Config())
			:
			mInputAudiooutport0("Input 0", this),
			mInputAudiooutport1("Input 1", this),
			mInputAudiooutport2("Input 2", this),
			mInputAudiooutport3("Input 3", this),
			mOutputAudiooutport0("Output 0", this),
			mOutputAudiooutport1("Output 1", this),
			mInputControl0("Control 0", this),
			mInputControl1("Control 1", this),
			mInputControl2("Control 2", this),
			mInputControl3("Control 3", this)
		{
			Configure( config );
		}

		~TestProcessing() {}

		bool Do()
		{
			return true;
		}

	private:

	/** Child processings **/

	};

};//namespace CLAM

#endif // _TestProcessing_


and "TestProcessing.cxx":

/*
 * Copyright (c) 2007 Fundació Barcelona Media Universitat Pompeu Fabra
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "TestProcessing.hxx"
#include <CLAM/ProcessingFactory.hxx>

namespace CLAM
{

namespace Hidden
{
	static const char * metadata[] = {
		"key", "TestProcessing",
		"category", "Plugins",
		"description", "TestProcessing",
		0
	};
	static FactoryRegistrator<ProcessingFactory, TestProcessing> reg = metadata;
}

}


-- 
Hernán
http://h.ordia.com.ar
GnuPG: 0xEE8A3FE9




More information about the clam-devel mailing list