From 13cba7a7997e318fbba01a36912219355e387d52 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 18:34:34 +0000 Subject: rewrote most stuff using templates svn path=/trunk/externals/tb/; revision=5105 --- chaos/src/chaos_msg.hpp | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'chaos/src/chaos_msg.hpp') 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 chaos_msg - : public flext_base +template +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##_msg(int argc, t_atom* argv ) \ +SYSTEM##_msg(int argc, t_atom* argv ): \ +chaos_msg(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); \ } -- cgit v1.2.1