X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/1059e1cc0c2ecfa237406949aa26155b6a5b9154..66f23d4fabf89ad09adbd4dfc15ac6b5b2b7da83:/interpretor/preprocessor/faust-0.9.47mr3/compiler/tlib/property.hh diff --git a/interpretor/preprocessor/faust-0.9.47mr3/compiler/tlib/property.hh b/interpretor/preprocessor/faust-0.9.47mr3/compiler/tlib/property.hh deleted file mode 100644 index eef723c..0000000 --- a/interpretor/preprocessor/faust-0.9.47mr3/compiler/tlib/property.hh +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef __PROPERTY__ -#define __PROPERTY__ - -#include "tree.hh" - -template class property -{ - Tree fKey; - - P* access(Tree t) - { - Tree d = t->getProperty(fKey); - return d ? (P*)(d->node().getPointer()) : 0; - } - -public: - - property () : fKey(tree(Node(unique("property_")))) {} - - property (const char* keyname) : fKey(tree(Node(keyname))) {} - - void set(Tree t, const P& data) - { - P* p = access(t); - if (p) { - *p = data; - } else { - t->setProperty(fKey, tree(Node(new P(data)))); - } - } - - bool get(Tree t, P& data) - { - P* p = access(t); - if (p) { - data = *p; - return true; - } else { - return false; - } - } - - void clear(Tree t) - { - P* p = access(t); - if (p) { delete p; } - t->clearProperty(fKey); - } -}; - - -template<> class property -{ - Tree fKey; - -public: - - property () : fKey(tree(Node(unique("property_")))) {} - - property (const char* keyname) : fKey(tree(Node(keyname))) {} - - void set(Tree t, Tree data) - { - t->setProperty(fKey, data); - } - - bool get(Tree t, Tree& data) - { - Tree d = t->getProperty(fKey); - if (d) { - data = d; - return true; - } else { - return false; - } - } - - void clear(Tree t) - { - t->clearProperty(fKey); - } -}; - - -template<> class property -{ - Tree fKey; - -public: - - property () : fKey(tree(Node(unique("property_")))) {} - - property (const char* keyname) : fKey(tree(Node(keyname))) {} - - void set(Tree t, int i) - { - t->setProperty(fKey, tree(Node(i))); - } - - bool get(Tree t, int& i) - { - Tree d = t->getProperty(fKey); - if (d) { - i = d->node().getInt(); - return true; - } else { - return false; - } - } - - void clear(Tree t) - { - t->clearProperty(fKey); - } -}; - - -template<> class property -{ - Tree fKey; - -public: - - property () : fKey(tree(Node(unique("property_")))) {} - - property (const char* keyname) : fKey(tree(Node(keyname))) {} - - void set(Tree t, double x) - { - t->setProperty(fKey, tree(Node(x))); - } - - bool get(Tree t, double& x) - { - Tree d = t->getProperty(fKey); - if (d) { - x = d->node().getDouble(); - return true; - } else { - return false; - } - } - - void clear(Tree t) - { - t->clearProperty(fKey); - } -}; - - - -#endif