view PyPlugScanner.h @ 86:9d1df2348e11

Remove older OSX makefiles
author Chris Cannam
date Thu, 10 Jan 2019 15:41:22 +0000
parents 62dcaa5fe6f8
children
line wrap: on
line source
/*

 * Vampy : This plugin is a wrapper around the Vamp plugin API.
 * It allows for writing Vamp plugins in Python.

 * Centre for Digital Music, Queen Mary University of London.
 * Copyright (C) 2008-2009 Gyorgy Fazekas, QMUL. (See Vamp sources 
 * for licence information.)

*/

/*
    Vamp

    An API for audio analysis and feature extraction plugins.

    Centre for Digital Music, Queen Mary, University of London.
    Copyright 2006-2007 Chris Cannam and QMUL.
  
    Permission is hereby granted, free of charge, to any person
    obtaining a copy of this software and associated documentation
    files (the "Software"), to deal in the Software without
    restriction, including without limitation the rights to use, copy,
    modify, merge, publish, distribute, sublicense, and/or sell copies
    of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
    ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
    CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Except as contained in this notice, the names of the Centre for
    Digital Music; Queen Mary, University of London; and Chris Cannam
    shall not be used in advertising or otherwise to promote the sale,
    use or other dealings in this Software without prior written
    authorization.
*/

#ifndef _VAMP_PYPLUG_SCANNER_H_
#define _VAMP_PYPLUG_SCANNER_H_

#include <Python.h>
#include <iostream>
#include <vector>
#include <string>
#include <map>
//#include <fstream>
	
class PyPlugScanner
{
public:
	~PyPlugScanner() { m_hasInstance = false; }
	static PyPlugScanner *getInstance();	
	std::vector<std::string> getPyPlugs();
	std::vector<PyObject*> getPyClasses();
	void setPath(std::vector<std::string> path);
	std::vector<std::string> getAllValidPath();
	
protected:
	PyPlugScanner();
	PyObject *getScriptClass(std::string path, std::string classname);
	std::vector<std::string> listFiles(std::string dir, std::string ext);
	void mergeFileLists(std::vector<std::string> &src, std::vector<std::string> &tg, std::string target_ext);
	
	static bool m_hasInstance;
	static PyPlugScanner *m_instance;
	std::string m_dir;
	std::vector<std::string> m_path; 
	std::vector<PyObject*> m_pyClasses;
};

#endif