comparison PyPlugScanner.h @ 37:27bab3a16c9a vampy2final

new branch Vampy2final
author fazekasgy
date Mon, 05 Oct 2009 11:28:00 +0000
parents
children 62dcaa5fe6f8
comparison
equal deleted inserted replaced
-1:000000000000 37:27bab3a16c9a
1 /*
2
3 * Vampy : This plugin is a wrapper around the Vamp plugin API.
4 * It allows for writing Vamp plugins in Python.
5
6 * Centre for Digital Music, Queen Mary University of London.
7 * Copyright (C) 2008-2009 Gyorgy Fazekas, QMUL. (See Vamp sources
8 * for licence information.)
9
10 */
11
12 /*
13 Vamp
14
15 An API for audio analysis and feature extraction plugins.
16
17 Centre for Digital Music, Queen Mary, University of London.
18 Copyright 2006-2007 Chris Cannam and QMUL.
19
20 Permission is hereby granted, free of charge, to any person
21 obtaining a copy of this software and associated documentation
22 files (the "Software"), to deal in the Software without
23 restriction, including without limitation the rights to use, copy,
24 modify, merge, publish, distribute, sublicense, and/or sell copies
25 of the Software, and to permit persons to whom the Software is
26 furnished to do so, subject to the following conditions:
27
28 The above copyright notice and this permission notice shall be
29 included in all copies or substantial portions of the Software.
30
31 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
35 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
36 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38
39 Except as contained in this notice, the names of the Centre for
40 Digital Music; Queen Mary, University of London; and Chris Cannam
41 shall not be used in advertising or otherwise to promote the sale,
42 use or other dealings in this Software without prior written
43 authorization.
44 */
45
46 #ifndef _VAMP_PYPLUG_SCANNER_H_
47 #define _VAMP_PYPLUG_SCANNER_H_
48
49 #include <Python.h>
50 #include <iostream>
51 #include <vector>
52 #include <string>
53 #include <map>
54 //#include <fstream>
55
56 class PyPlugScanner
57 {
58 public:
59 ~PyPlugScanner() { m_hasInstance = false; }
60 static PyPlugScanner *getInstance();
61 std::vector<std::string> getPyPlugs();
62 std::vector<PyObject*> getPyClasses();
63 void setPath(std::vector<std::string> path);
64 std::vector<std::string> getAllValidPath();
65
66 protected:
67 PyPlugScanner();
68 PyObject *getScriptClass(std::string path, std::string classname);
69 std::vector<std::string> listFiles(std::string dir, std::string ext);
70 void mergeFileLists(std::vector<std::string> &s, std::vector<std::string> &t);
71
72 static bool m_hasInstance;
73 static PyPlugScanner *m_instance;
74 std::string m_dir;
75 std::vector<std::string> m_path;
76 std::vector<PyObject*> m_pyClasses;
77 };
78
79 #endif
80