aboutsummaryrefslogtreecommitdiff
path: root/chaos/src/chaos_msg.hpp
diff options
context:
space:
mode:
authorTim Blechmann <timblech@users.sourceforge.net>2006-05-21 18:34:34 +0000
committerIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 15:12:02 +0200
commit13cba7a7997e318fbba01a36912219355e387d52 (patch)
tree77ec90e15c3a912a480d21958bdf1b57a7d7f14f /chaos/src/chaos_msg.hpp
parentcceea140611ff282d1513937f615abe2b8081ebc (diff)
rewrote most stuff using templates
svn path=/trunk/externals/tb/; revision=5105
Diffstat (limited to 'chaos/src/chaos_msg.hpp')
-rw-r--r--chaos/src/chaos_msg.hpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/chaos/src/chaos_msg.hpp b/chaos/src/chaos_msg.hpp
index 357ff6a..9025273 100644
--- a/chaos/src/chaos_msg.hpp
+++ b/chaos/src/chaos_msg.hpp
@@ -20,29 +20,34 @@
#include "chaos_base.hpp"
-template <class system> class chaos_msg
- : public flext_base
+template <class system>
+class chaos_msg:
+ public flext_base
{
FLEXT_HEADER(chaos_msg, flext_base);
- ~chaos_msg()
- {
- delete m_system;
- }
+protected:
+ chaos_msg(int argc, t_atom* argv)
+ {
+ int size = m_system.get_num_eq();
+
+ for (int i = 0; i != size; ++i)
+ AddOutFloat();
+ FLEXT_ADDBANG(0, m_bang);
+ }
public:
- /* local data for system, output and interpolation */
- system * m_system; /* the system */
+ system m_system; /* the system */
void m_bang()
{
- m_system->m_perform();
- int outlets = m_system->get_num_eq();
+ m_system.m_perform();
+ int outlets = m_system.get_num_eq();
while (outlets--)
{
- ToOutFloat(outlets, m_system->get_data(outlets));
+ ToOutFloat(outlets, m_system.get_data(outlets));
}
}
@@ -54,15 +59,8 @@ public:
#define CHAOS_MSG_INIT(SYSTEM, ATTRIBUTES) \
FLEXT_HEADER(SYSTEM##_msg, chaos_msg<SYSTEM>) \
\
-SYSTEM##_msg(int argc, t_atom* argv ) \
+SYSTEM##_msg(int argc, t_atom* argv ): \
+chaos_msg<SYSTEM>(argc, argv) \
{ \
- m_system = new SYSTEM; \
- \
- int size = m_system->get_num_eq(); \
- \
- for (int i = 0; i != size; ++i) \
- AddOutFloat(); \
- \
ATTRIBUTES; \
- FLEXT_ADDBANG(0, m_bang); \
}