libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ModuleTemplate.hpp
Go to the documentation of this file.
1 #ifndef MODULE_TEMPLATE
2 #define MODULE_TEMPLATE
3 /*
4 This file is part of AlgAudio.
5 
6 AlgAudio, Copyright (C) 2015 CeTA - Audiovisual Technology Center
7 
8 AlgAudio is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
12 
13 AlgAudio is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with AlgAudio. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include <string>
22 #include <memory>
23 #include <list>
24 
25 #include "Utilities.hpp"
26 
27 // Forward declaration, to aviod rapidxml becoming a dependency for
28 // external modules
29 namespace rapidxml{
30  template <class T> class xml_node;
31 }
32 
33 namespace AlgAudio{
34 
35 class ModuleCollection;
36 class Module;
37 
38 namespace Exceptions{
39 struct ModuleParse : public Exception{
40  ModuleParse(std::string i, std::string t) : Exception(t), id(i) {};
41  ModuleParse(std::string t) : Exception(t) {};
42  virtual std::string what() override {
43  if(id == "") return "While loading an unknown module: " + text;
44  else return "While loading module '" + id + "': " + text;
45  };
46  std::string id = "";
47 };
48 } // namespace Exceptions
49 
55 public:
56  std::string id;
57  std::string name;
58  enum class ParamAction{
59  SC,
60  Custom,
61  None,
62  };
64  enum class ParamMode{
65  Input,
66  Output,
67  None,
68  };
70  enum class ParamScale{
71  Linear,
73  };
76  float default_val;
77  float step = 0.0;
78 };
79 
81 public:
82  std::string id;
83  std::string name;
84 };
85 
93 public:
95  // Create a module template by parsing data from an XML module node.
97  std::string GetFullID() const;
98  std::string id;
99  std::string name;
100  std::string description = "";
101  std::string guitype = "";
102  std::string guitree = "";
103  bool has_sc_code = false;
104  std::string sc_code;
105  bool has_class = false;
106  std::string class_name;
108  std::list<IOLetTemplate> inlets;
109  std::list<IOLetTemplate> outlets;
110  std::list<std::shared_ptr<ParamTemplate>> params;
111  std::list<std::pair<std::string, std::string>> replies;
112 };
113 
114 } // namespace AlgAudio
115 #endif //MODULE_TEMPLATE
ModuleCollection & collection
Definition: ModuleTemplate.hpp:107
Definition: ModuleTemplate.hpp:92
ParamAction
Definition: ModuleTemplate.hpp:58
std::string description
Definition: ModuleTemplate.hpp:100
std::string name
Definition: ModuleTemplate.hpp:83
ParamScale scale
Definition: ModuleTemplate.hpp:74
std::list< std::pair< std::string, std::string > > replies
Definition: ModuleTemplate.hpp:111
std::string id
Definition: ModuleTemplate.hpp:46
std::string name
Definition: ModuleTemplate.hpp:57
Definition: ModuleTemplate.hpp:54
ParamMode
Definition: ModuleTemplate.hpp:64
std::list< IOLetTemplate > inlets
Definition: ModuleTemplate.hpp:108
float step
Definition: ModuleTemplate.hpp:77
float default_max
Definition: ModuleTemplate.hpp:75
std::string sc_code
Definition: ModuleTemplate.hpp:104
std::string GetFullID() const
Definition: Module.hpp:37
ModuleTemplate(ModuleCollection &collection)
std::string id
Definition: ModuleTemplate.hpp:82
Definition: ModuleCollection.hpp:54
virtual std::string what() override
Definition: ModuleTemplate.hpp:42
Definition: Alertable.hpp:26
std::string id
Definition: ModuleTemplate.hpp:56
std::string class_name
Definition: ModuleTemplate.hpp:106
Definition: ModuleTemplate.hpp:39
std::string guitype
Definition: ModuleTemplate.hpp:101
bool has_class
Definition: ModuleTemplate.hpp:105
std::list< IOLetTemplate > outlets
Definition: ModuleTemplate.hpp:109
std::list< std::shared_ptr< ParamTemplate > > params
Definition: ModuleTemplate.hpp:110
std::string text
Definition: Exception.hpp:42
std::string name
Definition: ModuleTemplate.hpp:99
std::string id
Definition: ModuleTemplate.hpp:98
ModuleParse(std::string t)
Definition: ModuleTemplate.hpp:41
float default_min
Definition: ModuleTemplate.hpp:75
ModuleParse(std::string i, std::string t)
Definition: ModuleTemplate.hpp:40
Definition: Module.hpp:35
ParamAction action
Definition: ModuleTemplate.hpp:63
Definition: Exception.hpp:29
ParamScale
Definition: ModuleTemplate.hpp:70
bool has_sc_code
Definition: ModuleTemplate.hpp:103
std::string guitree
Definition: ModuleTemplate.hpp:102
Definition: ModuleTemplate.hpp:80
ParamMode mode
Definition: ModuleTemplate.hpp:69
float default_val
Definition: ModuleTemplate.hpp:76