tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OPClass.h
Go to the documentation of this file.
1 // License: GPL3
2 //
3 // OOPD.h
4 //
5 //
6 // Created by Alex Nadzharov on 26/03/17.
7 //
8 //
9 
10 #ifndef OPCLASS_H
11 #define OPCLASS_H
12 
13 //#include "m_pd.h"
14 #include <map>
15 #include <set>
16 
17 
18 //
19 #include <QStringList>
20 
21 #include <QDebug>
22 
23 using namespace std;
24 //using namespace ceammc;
25 
26 #include "OOPDClassBase.h"
27 
28 namespace tilde {
29 
30 //typedef vector<t_outlet*> OPOutputs; ///< vector of method boxes outputs
31 typedef vector<t_object*> OPProperties;
32 
33 // ------------------------------------------------------------
34 
38 class OPClass : public OOPDClassBase {
39 
40 private:
41  map<string, t_outlet*> _methodOutlets; //todo OPOutputs
42  map<string, t_outlet*> _methodPointerOutlets; //todo OPOutputs
43 
44  OPClass* _parent;
45 
46 public:
47  // for dynamic (change arguments?)
49  {
50  _canvas = 0;
51  _symbol = gensym("");
52  _parent = 0;
53  }
54 
55  // for canvas-based (change arguments?)
56  OPClass(string className);
57 
58 // ------------------------------------------------
59 #pragma mark window
60 
61  void showWindow();
62 
63 // ------------------------------------------------
64 #pragma mark file io
65 
66  void readFile();
67  void writeFile();
68 
69 // ------------------------------------------------
70 
71 #pragma mark dynamic: methods
72  // addMethod in base
73 
74  void addMethodOutlet(string referenceName, t_outlet* outlet)
75  {
76  //todo multiple
77  _methodOutlets[referenceName] = outlet;
78  }
79 
80  void addMethodPointerOutlet(string referenceName, t_outlet* outlet)
81  {
82  //todo multiple
83  _methodPointerOutlets[referenceName] = outlet;
84  }
85 
86  // XPD-TODO
87  /*
88  t_outlet* getMethodOutletForReferenceName(string referenceName)
89  {
90  t_outlet* ret = 0;
91  if (_methodOutlets.count(referenceName)) {
92  //todo multiple
93  ret = _methodOutlets[referenceName];
94  }
95 
96  return ret;
97  }
98 
99  t_outlet* getMethodPointerOutletForReferenceName(string referenceName)
100  {
101  t_outlet* ret=0;
102  if (_methodPointerOutlets.count(referenceName)) {
103  //todo multiple
104  ret = _methodPointerOutlets[referenceName];
105  }
106 
107  return ret;
108  }
109  */
110 
111  // properties
112 
113  void freeMethodOutlet(string referenceName)
114  {
115  _methodOutlets.erase(referenceName);
116  }
117 
118  void freeMethodPointerOutlet(string referenceName)
119  {
120  _methodPointerOutlets.erase(referenceName);
121  }
122 
123  map<string, t_outlet*> getMethodOutlets()
124  {
125  return _methodOutlets;
126  }
127 
128 // ------------------------------------------------
129 #pragma mark parent
130 
131  void setParentClass(OPClass* p_class)
132  {
133  _parent = p_class;
134  }
135 
137  {
138  return _parent;
139  }
140 // -------
141  string getClassName()
142  {
143  return _className;
144  }
145 };
146 
147 
148 
149 // -----------------------------------
150 }
151 
152 #endif /* OOPD_h */
void addMethodOutlet(string referenceName, t_outlet *outlet)
Definition: OPClass.h:74
string getClassName()
Definition: OPClass.h:141
OPClass()
Definition: OPClass.h:48
void setParentClass(OPClass *p_class)
Definition: OPClass.h:131
void freeMethodPointerOutlet(string referenceName)
Definition: OPClass.h:118
EXTERN t_symbol * gensym(const char *s)
void addMethodPointerOutlet(string referenceName, t_outlet *outlet)
Definition: OPClass.h:80
void freeMethodOutlet(string referenceName)
Definition: OPClass.h:113
map< string, t_outlet * > getMethodOutlets()
Definition: OPClass.h:123
#define t_outlet
Definition: m_pd.h:189
base data structure for class and instance: name, canvas, symbol
Definition: OOPDClassBase.h:77
OOPD class structure.
Definition: OPClass.h:38
Definition: m_pd.h:110
OPClass * getParentClass()
Definition: OPClass.h:136
vector< t_object * > OPProperties
vector of property boxes
Definition: oop_common.h:72