LV2 Toolkit  1.1.1
 All Classes Namespaces Functions Typedefs Enumerations Enumerator Groups Pages
feature.hpp
1 /*
2  feature.hpp - Support file for writing LV2 plugins in C++
3 
4  Copyright (C) 2012 Michael Fisher <mfisher31@gmail.com>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA
19 */
26 #ifndef LVTK_LV2_FEATURE_HPP
27 #define LVTK_LV2_FEATURE_HPP
28 
29 #include <map>
30 #include <string>
31 #include <vector>
32 
33 #include <lv2/lv2plug.in/ns/lv2core/lv2.h>
34 
35 namespace lvtk {
36 
37  using std::map;
38  using std::string;
39  using std::vector;
40 
42  typedef LV2_Feature Feature;
43 
45  typedef vector<const Feature*> FeatureVec;
46 
48  typedef void* FeatureData;
49 
55  typedef void(*FeatureHandler)(void* instance, FeatureData data);
56 
58  typedef map<string, FeatureHandler> FeatureHandlerMap;
59 
61  {
62  public:
63  FeatureIter (const Feature* const* features)
64  : m_index (0), p_feats (features) { }
65 
66  inline const Feature*
67  next()
68  {
69  if (NULL == p_feats[m_index])
70  return NULL;
71  return p_feats[m_index++];
72  }
73 
74  private:
75  uint32_t m_index;
76  const Feature* const* p_feats;
77  };
78 } /* namespace lvtk */
79 
80 #endif /* LVTK_LV2_FEATURE_HPP */