summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/engine/GraphObjectImpl.cpp (renamed from src/libs/engine/GraphObject.cpp)4
-rw-r--r--src/libs/engine/GraphObjectImpl.hpp (renamed from src/libs/engine/GraphObject.hpp)23
-rw-r--r--src/libs/engine/Makefile.am9
-rw-r--r--src/libs/engine/Node.hpp8
-rw-r--r--src/libs/engine/ObjectSender.cpp12
-rw-r--r--src/libs/engine/ObjectStore.cpp24
-rw-r--r--src/libs/engine/ObjectStore.hpp22
-rw-r--r--src/libs/engine/Port.cpp2
-rw-r--r--src/libs/engine/Port.hpp4
-rw-r--r--src/libs/engine/Tree.hpp141
-rw-r--r--src/libs/engine/TreeImplementation.hpp395
-rw-r--r--src/libs/engine/events/CreateNodeEvent.cpp1
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp5
-rw-r--r--src/libs/engine/events/CreatePortEvent.cpp1
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp5
-rw-r--r--src/libs/engine/events/DestroyEvent.hpp4
-rw-r--r--src/libs/engine/events/RenameEvent.cpp5
-rw-r--r--src/libs/engine/events/RenameEvent.hpp4
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.hpp4
-rw-r--r--src/libs/engine/events/RequestObjectEvent.hpp6
-rw-r--r--src/libs/engine/events/SetMetadataEvent.cpp2
-rw-r--r--src/libs/engine/events/SetMetadataEvent.hpp6
-rw-r--r--src/libs/engine/events/SetPolyphonicEvent.hpp8
-rw-r--r--src/libs/engine/instantiations.cpp30
-rw-r--r--src/libs/engine/tests/Makefile.am12
-rw-r--r--src/libs/engine/tests/node_tree_test.cpp94
-rw-r--r--src/libs/engine/tests/old_node_tree_test.cpp72
28 files changed, 77 insertions, 828 deletions
diff --git a/src/libs/engine/GraphObject.cpp b/src/libs/engine/GraphObjectImpl.cpp
index b18e9687..966f8238 100644
--- a/src/libs/engine/GraphObject.cpp
+++ b/src/libs/engine/GraphObjectImpl.cpp
@@ -15,7 +15,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "GraphObject.hpp"
+#include "GraphObjectImpl.hpp"
#include "Patch.hpp"
#include "ObjectStore.hpp"
@@ -23,7 +23,7 @@ namespace Ingen {
Patch*
-GraphObject::parent_patch() const
+GraphObjectImpl::parent_patch() const
{
return dynamic_cast<Patch*>((Node*)_parent);
}
diff --git a/src/libs/engine/GraphObject.hpp b/src/libs/engine/GraphObjectImpl.hpp
index f2089f42..1fa6ad06 100644
--- a/src/libs/engine/GraphObject.hpp
+++ b/src/libs/engine/GraphObjectImpl.hpp
@@ -15,8 +15,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef GRAPHOBJECT_H
-#define GRAPHOBJECT_H
+#ifndef GRAPHOBJECTIMPL_H
+#define GRAPHOBJECTIMPL_H
#include <string>
#include <map>
@@ -25,6 +25,7 @@
#include <raul/Deletable.hpp>
#include <raul/Path.hpp>
#include <raul/Atom.hpp>
+#include "interface/GraphObject.hpp"
#include "types.hpp"
using Raul::Atom;
@@ -46,12 +47,12 @@ class ProcessContext;
*
* \ingroup engine
*/
-class GraphObject : public Raul::Deletable
+class GraphObjectImpl : public Ingen::Shared::GraphObject
{
public:
typedef std::map<string, Atom> MetadataMap;
- GraphObject(GraphObject* parent, const string& name, bool polyphonic=false)
+ GraphObjectImpl(GraphObjectImpl* parent, const string& name, bool polyphonic=false)
: _parent(parent), _name(name), _polyphonic(polyphonic)
{
assert(parent == NULL || _name.length() > 0);
@@ -59,13 +60,13 @@ public:
assert(path().find("//") == string::npos);
}
- virtual ~GraphObject() {}
+ virtual ~GraphObjectImpl() {}
bool polyphonic() const { return _polyphonic; }
virtual void set_polyphonic(Raul::Maid& maid, bool p) { _polyphonic = p; }
- inline GraphObject* parent() const { return _parent; }
- inline const string& name() const { return _name; }
+ inline GraphObjectImpl* parent() const { return _parent; }
+ inline const string& name() const { return _name; }
virtual void process(ProcessContext& context) = 0;
@@ -101,9 +102,9 @@ public:
}
protected:
- GraphObject* _parent;
- std::string _name;
- bool _polyphonic;
+ GraphObjectImpl* _parent;
+ std::string _name;
+ bool _polyphonic;
private:
MetadataMap _metadata;
@@ -112,4 +113,4 @@ private:
} // namespace Ingen
-#endif // GRAPHOBJECT_H
+#endif // GRAPHOBJECTIMPL_H
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index b5c910f8..224bba24 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = tests events
+SUBDIRS = events
MAINTAINERCLEANFILES = Makefile.in
@@ -42,8 +42,8 @@ libingen_engine_la_SOURCES = \
EventSink.cpp \
EventSink.hpp \
EventSource.hpp \
- GraphObject.cpp \
- GraphObject.hpp \
+ GraphObjectImpl.cpp \
+ GraphObjectImpl.hpp \
InputPort.cpp \
InputPort.hpp \
JackAudioDriver.cpp \
@@ -99,8 +99,6 @@ libingen_engine_la_SOURCES = \
ThreadManager.hpp \
TransportNode.cpp \
TransportNode.hpp \
- Tree.hpp \
- TreeImplementation.hpp \
engine.cpp \
engine.hpp \
events.hpp \
@@ -169,7 +167,6 @@ libingen_engine_la_SOURCES = \
events/SetPortValueQueuedEvent.hpp \
events/UnregisterClientEvent.cpp \
events/UnregisterClientEvent.hpp \
- instantiations.cpp \
jack_compat.h \
tuning.hpp \
types.hpp \
diff --git a/src/libs/engine/Node.hpp b/src/libs/engine/Node.hpp
index b1cefe65..083ceea2 100644
--- a/src/libs/engine/Node.hpp
+++ b/src/libs/engine/Node.hpp
@@ -21,7 +21,7 @@
#include <string>
#include <raul/Array.hpp>
#include "types.hpp"
-#include "GraphObject.hpp"
+#include "GraphObjectImpl.hpp"
namespace Raul { template <typename T> class List; class Maid; }
@@ -46,11 +46,11 @@ namespace Shared { class ClientInterface; }
*
* \ingroup engine
*/
-class Node : public GraphObject
+class Node : public GraphObjectImpl
{
public:
- Node(GraphObject* parent, const std::string& name, bool poly)
- : GraphObject(parent, name, poly)
+ Node(GraphObjectImpl* parent, const std::string& name, bool poly)
+ : GraphObjectImpl(parent, name, poly)
{}
virtual ~Node() {}
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 97a03bce..07cb0f01 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -64,8 +64,8 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur
}
// Send metadata
- const GraphObject::MetadataMap& data = patch->metadata();
- for (GraphObject::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j)
+ const GraphObjectImpl::MetadataMap& data = patch->metadata();
+ for (GraphObjectImpl::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j)
client->metadata_update(patch->path(), (*j).first, (*j).second);
if (patch->enabled())
@@ -96,8 +96,8 @@ ObjectSender::send_node(ClientInterface* client, const Node* node, bool recursiv
client->new_node(node->plugin()->uri(), node->path(), node->polyphonic(), node->ports().size());
// Send metadata
- const GraphObject::MetadataMap& data = node->metadata();
- for (GraphObject::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j)
+ const GraphObjectImpl::MetadataMap& data = node->metadata();
+ for (GraphObjectImpl::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j)
client->metadata_update(node->path(), (*j).first, (*j).second);
client->bundle_end();
@@ -137,8 +137,8 @@ ObjectSender::send_port(ClientInterface* client, const Port* port)
client->new_port(port->path(), type, port->is_output());
// Send metadata
- const GraphObject::MetadataMap& data = port->metadata();
- for (GraphObject::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j)
+ const GraphObjectImpl::MetadataMap& data = port->metadata();
+ for (GraphObjectImpl::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j)
client->metadata_update(port->path(), (*j).first, (*j).second);
// Send control value
diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp
index 4dbe9f0e..27e7565b 100644
--- a/src/libs/engine/ObjectStore.cpp
+++ b/src/libs/engine/ObjectStore.cpp
@@ -37,7 +37,7 @@ namespace Ingen {
Patch*
ObjectStore::find_patch(const Path& path)
{
- GraphObject* const object = find_object(path);
+ GraphObjectImpl* const object = find_object(path);
return dynamic_cast<Patch*>(object);
}
@@ -47,7 +47,7 @@ ObjectStore::find_patch(const Path& path)
Node*
ObjectStore::find_node(const Path& path)
{
- GraphObject* const object = find_object(path);
+ GraphObjectImpl* const object = find_object(path);
return dynamic_cast<Node*>(object);
}
@@ -57,14 +57,14 @@ ObjectStore::find_node(const Path& path)
Port*
ObjectStore::find_port(const Path& path)
{
- GraphObject* const object = find_object(path);
+ GraphObjectImpl* const object = find_object(path);
return dynamic_cast<Port*>(object);
}
/** Find the Object at the given path.
*/
-GraphObject*
+GraphObjectImpl*
ObjectStore::find_object(const Path& path)
{
Objects::iterator i = _objects.find(path);
@@ -75,7 +75,7 @@ ObjectStore::find_object(const Path& path)
/** Add an object to the store. Not realtime safe.
*/
void
-ObjectStore::add(GraphObject* o)
+ObjectStore::add(GraphObjectImpl* o)
{
assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS);
@@ -94,7 +94,7 @@ ObjectStore::add(GraphObject* o)
/** Add a family of objects to the store. Not realtime safe.
*/
void
-ObjectStore::add(const Table<Path,GraphObject*>& table)
+ObjectStore::add(const Table<Path,GraphObjectImpl*>& table)
{
assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS);
@@ -102,7 +102,7 @@ ObjectStore::add(const Table<Path,GraphObject*>& table)
_objects.cram(table);
cerr << "[ObjectStore] Adding Table:" << endl;
- for (Table<Path,GraphObject*>::const_iterator i = table.begin(); i != table.end(); ++i) {
+ for (Table<Path,GraphObjectImpl*>::const_iterator i = table.begin(); i != table.end(); ++i) {
cerr << i->first << " = " << i->second->path() << endl;
}
}
@@ -113,7 +113,7 @@ ObjectStore::add(const Table<Path,GraphObject*>& table)
* Returned is a vector containing all descendants of the object removed
* including the object itself, in lexicographically sorted order by Path.
*/
-Table<Path,GraphObject*>
+Table<Path,GraphObjectImpl*>
ObjectStore::remove(const Path& path)
{
return remove(_objects.find(path));
@@ -125,7 +125,7 @@ ObjectStore::remove(const Path& path)
* Returned is a vector containing all descendants of the object removed
* including the object itself, in lexicographically sorted order by Path.
*/
-Table<Path,GraphObject*>
+Table<Path,GraphObjectImpl*>
ObjectStore::remove(Objects::iterator object)
{
assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS);
@@ -133,8 +133,8 @@ ObjectStore::remove(Objects::iterator object)
if (object != _objects.end()) {
Objects::iterator descendants_end = _objects.find_descendants_end(object);
cout << "[ObjectStore] Removing " << object->first << " {" << endl;
- Table<Path,GraphObject*> removed = _objects.yank(object, descendants_end);
- for (Table<Path,GraphObject*>::iterator i = removed.begin(); i != removed.end(); ++i) {
+ Table<Path,GraphObjectImpl*> removed = _objects.yank(object, descendants_end);
+ for (Table<Path,GraphObjectImpl*>::iterator i = removed.begin(); i != removed.end(); ++i) {
cout << "\t" << i->first << endl;
}
cout << "}" << endl;
@@ -143,7 +143,7 @@ ObjectStore::remove(Objects::iterator object)
} else {
cerr << "[ObjectStore] WARNING: Removing " << object->first << " failed." << endl;
- return Table<Path,GraphObject*>();
+ return Table<Path,GraphObjectImpl*>();
}
}
diff --git a/src/libs/engine/ObjectStore.hpp b/src/libs/engine/ObjectStore.hpp
index c61d4130..d0504d70 100644
--- a/src/libs/engine/ObjectStore.hpp
+++ b/src/libs/engine/ObjectStore.hpp
@@ -29,7 +29,7 @@ namespace Ingen {
class Patch;
class Node;
class Port;
-class GraphObject;
+class GraphObjectImpl;
/** Storage for all GraphObjects (tree of GraphObject's sorted by path).
@@ -44,21 +44,21 @@ class GraphObject;
class ObjectStore
{
public:
- typedef Raul::PathTable<GraphObject*> Objects;
+ typedef Raul::PathTable<GraphObjectImpl*> Objects;
- Patch* find_patch(const Path& path);
- Node* find_node(const Path& path);
- Port* find_port(const Path& path);
- GraphObject* find_object(const Path& path);
+ Patch* find_patch(const Path& path);
+ Node* find_node(const Path& path);
+ Port* find_port(const Path& path);
+ GraphObjectImpl* find_object(const Path& path);
Objects::iterator find(const Path& path) { return _objects.find(path); }
- void add(GraphObject* o);
- void add(const Table<Path,GraphObject*>& family);
- //void add(TreeNode<GraphObject*>* o);
+ void add(GraphObjectImpl* o);
+ void add(const Table<Path,GraphObjectImpl*>& family);
+ //void add(TreeNode<GraphObjectImpl*>* o);
- Table<Path,GraphObject*> remove(const Path& path);
- Table<Path,GraphObject*> remove(Objects::iterator i);
+ Table<Path,GraphObjectImpl*> remove(const Path& path);
+ Table<Path,GraphObjectImpl*> remove(Objects::iterator i);
const Objects& objects() const { return _objects; }
Objects& objects() { return _objects; }
diff --git a/src/libs/engine/Port.cpp b/src/libs/engine/Port.cpp
index d85c1790..880b2c46 100644
--- a/src/libs/engine/Port.cpp
+++ b/src/libs/engine/Port.cpp
@@ -37,7 +37,7 @@ const char* const DataType::type_uris[4] = { "UNKNOWN", "FLOAT", "MIDI", "OSC" }
Port::Port(Node* const node, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size)
- : GraphObject(node, name, true)
+ : GraphObjectImpl(node, name, true)
, _index(index)
, _poly(poly)
, _buffer_size(buffer_size)
diff --git a/src/libs/engine/Port.hpp b/src/libs/engine/Port.hpp
index e504507c..fa9c454f 100644
--- a/src/libs/engine/Port.hpp
+++ b/src/libs/engine/Port.hpp
@@ -22,7 +22,7 @@
#include <string>
#include <raul/Array.hpp>
#include "types.hpp"
-#include "GraphObject.hpp"
+#include "GraphObjectImpl.hpp"
#include "DataType.hpp"
namespace Raul { class Maid; }
@@ -42,7 +42,7 @@ class ProcessContext;
*
* \ingroup engine
*/
-class Port : public GraphObject
+class Port : public GraphObjectImpl
{
public:
virtual ~Port();
diff --git a/src/libs/engine/Tree.hpp b/src/libs/engine/Tree.hpp
deleted file mode 100644
index c6e36926..00000000
--- a/src/libs/engine/Tree.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TREE_H
-#define TREE_H
-
-#include <string>
-#include <cassert>
-#include <boost/utility.hpp>
-#include <raul/Deletable.hpp>
-using std::string;
-
-template<typename T> class Tree;
-
-
-/** A node in a Tree.
- */
-template <typename T>
-class TreeNode : public Raul::Deletable
-{
-public:
- TreeNode(const string& key)
- : _parent(NULL), _left_child(NULL), _right_child(NULL),
- _key(key), _node(NULL) {}
-
- TreeNode(const string& key, T n)
- : _parent(NULL), _left_child(NULL), _right_child(NULL),
- _key(key), _node(n) {}
-
- ~TreeNode() {
- assert(_parent == NULL || _parent->left_child() != this);
- assert(_parent == NULL || _parent->right_child() != this);
- assert(_left_child == NULL || _left_child->parent() != this);
- assert(_right_child == NULL || _right_child->parent() != this);
- _parent = _left_child = _right_child = NULL;
- }
-
- string key() const { return _key; }
- void key(const string& key) { _key = key; }
- TreeNode<T>* parent() const { return _parent; }
- void parent(TreeNode<T>* n) { _parent = n; }
- TreeNode<T>* left_child() const { return _left_child; }
- void left_child(TreeNode<T>* n) { _left_child = n; }
- TreeNode<T>* right_child() const { return _right_child; }
- void right_child(TreeNode<T>* n) { _right_child = n; }
-
- bool is_leaf() { return (_left_child == NULL && _right_child == NULL); }
- bool is_left_child() { return (_parent != NULL && _parent->left_child() == this); }
- bool is_right_child() { return (_parent != NULL && _parent->right_child() == this); }
-
- T node() { return _node; }
-
- friend class Tree<T>;
-
-protected:
- TreeNode<T>* _parent;
- TreeNode<T>* _left_child;
- TreeNode<T>* _right_child;
- string _key;
- T _node;
-};
-
-
-/** The tree all objects are stored in.
- *
- * Textbook naive (unbalanced) Binary Search Tree. Slightly different
- * from a usual BST implementation in that the "Node" classes (TreeNode) are
- * exposed to the user. This is so QueuedEvent's can create the TreeNode in
- * another thread, and the realtime jack thread can insert them (without having
- * to allocating a TreeNode which is a no-no).
- *
- * It's also a more annoying implementation because there's no leaf type (since
- * a leaf object would have to be deleted on insert).
- *
- * Tree<T>::iterator is not realtime safe, but the insert/remove/find methods
- * of Tree<T> do not use them.
- */
-template <typename T>
-class Tree : boost::noncopyable
-{
-public:
- Tree() : _root(0), _size(0) {}
- ~Tree();
-
- void insert(TreeNode<T>* const n);
- TreeNode<T>* remove(const string& key);
- T find(const string& key) const;
- TreeNode<T>* find_treenode(const string& key) const;
-
- size_t size() const { return _size; }
-
- /** NON realtime safe iterator for a Tree<T>. */
- class iterator
- {
- public:
- iterator(const Tree<T>* tree, size_t size);
- ~iterator();
-
- T operator*() const;
- iterator& operator++();
- bool operator!=(const iterator& iter) const;
-
- friend class Tree<T>;
-
- iterator(const iterator& copy);
- iterator& operator=(const iterator& copy);
-
- private:
- int _depth;
- size_t _size;
- TreeNode<T>** _stack;
- const Tree<T>* _tree;
- };
-
- iterator begin() const;
- iterator end() const;
-
-private:
- TreeNode<T>* _find_smallest(TreeNode<T>* root);
- TreeNode<T>* _find_largest(TreeNode<T>* root);
-
- TreeNode<T>* _root;
- size_t _size;
-};
-
-
-#endif // TREE_H
diff --git a/src/libs/engine/TreeImplementation.hpp b/src/libs/engine/TreeImplementation.hpp
deleted file mode 100644
index 681079ac..00000000
--- a/src/libs/engine/TreeImplementation.hpp
+++ /dev/null
@@ -1,395 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "Tree.hpp"
-#include <cstdlib>
-#include <iostream>
-#include <cassert>
-using std::cerr; using std::endl;
-
-
-/* FIXME: this is all in horrible need of a rewrite. */
-
-
-/** Destroy the tree.
- *
- * Note that this does not delete any TreeNodes still inside the tree,
- * that is the user's responsibility.
- */
-template <typename T>
-Tree<T>::~Tree()
-{
-}
-
-
-/** Insert a node into the tree. Realtime safe.
- *
- * @a n will be inserted using the key() field for searches.
- * n->key() must not be the empty string.
- */
-template<typename T>
-void
-Tree<T>::insert(TreeNode<T>* const n)
-{
- assert(n != NULL);
- assert(n->left_child() == NULL);
- assert(n->right_child() == NULL);
- assert(n->parent() == NULL);
- assert(n->key().length() > 0);
- assert(find_treenode(n->key()) == NULL);
-
- if (_root == NULL) {
- _root = n;
- } else {
- bool left = false; // which child to insert at
- bool right = false;
- TreeNode<T>* i = _root;
- while (true) {
- assert(i != NULL);
- if (n->key() <= i->key()) {
- if (i->left_child() == NULL) {
- left = true;
- break;
- } else {
- i = i->left_child();
- }
- } else {
- if (i->right_child() == NULL) {
- right = true;
- break;
- } else {
- i = i->right_child();
- }
- }
- }
-
- assert(i != NULL);
- assert(left || right);
- assert( ! (left && right) );
-
- if (left) {
- assert(i->left_child() == NULL);
- i->left_child(n);
- } else if (right) {
- assert(i->right_child() == NULL);
- i->right_child(n);
- }
- n->parent(i);
- }
- ++_size;
-}
-
-
-/** Remove a node from the tree.
- *
- * Realtime safe, caller is responsible to delete returned value.
- *
- * @return NULL if object with @a key is not in tree.
- */
-template<typename T>
-TreeNode<T>*
-Tree<T>::remove(const string& key)
-{
- TreeNode<T>* node = find_treenode(key);
- TreeNode<T>* n = node;
- TreeNode<T>* swap = NULL;
- T temp_node;
- string temp_key;
-
- if (node == NULL)
- return NULL;
-
- // Node is not even in tree
- if (node->parent() == NULL && _root != node)
- return NULL;
- // FIXME: What if the node is in a different tree? Check for this?
-
-#ifndef NDEBUG
- const T& remove_node = node->node(); // for error checking
-#endif // NDEBUG
-
- // n has two children
- if (n->left_child() != NULL && n->right_child() != NULL) {
- if (rand()%2)
- swap = _find_largest(n->left_child());
- else
- swap = _find_smallest(n->right_child());
-
- // Swap node's elements
- temp_node = swap->_node;
- swap->_node = n->_node;
- n->_node = temp_node;
-
- // Swap node's keys
- temp_key = swap->_key;
- swap->_key = n->_key;
- n->_key = temp_key;
-
- n = swap;
- assert(n != NULL);
- }
-
- // be sure we swapped correctly (ie right node is getting removed)
- assert(n->node() == remove_node);
-
- // n now has at most one child
- assert(n->left_child() == NULL || n->right_child() == NULL);
-
- if (n->is_leaf()) {
- if (n->is_left_child())
- n->parent()->left_child(NULL);
- else if (n->is_right_child())
- n->parent()->right_child(NULL);
-
- if (_root == n) _root = NULL;
- } else { // has a single child
- TreeNode<T>* child = NULL;
- if (n->left_child() != NULL)
- child = n->left_child();
- else if (n->right_child() != NULL)
- child = n->right_child();
- else
- exit(EXIT_FAILURE);
-
- assert(child != n);
- assert(child != NULL);
- assert(n->parent() != n);
-
- if (n->is_left_child()) {
- assert(n->parent() != child);
- n->parent()->left_child(child);
- child->parent(n->parent());
- } else if (n->is_right_child()) {
- assert(n->parent() != child);
- n->parent()->right_child(child);
- child->parent(n->parent());
- } else {
- child->parent(NULL);
- }
- if (_root == n) _root = child;
- }
-
- // Be sure node is cut off completely
- assert(n != NULL);
- assert(n->parent() == NULL || n->parent()->left_child() != n);
- assert(n->parent() == NULL || n->parent()->right_child() != n);
- assert(n->left_child() == NULL || n->left_child()->parent() != n);
- assert(n->right_child() == NULL || n->right_child()->parent() != n);
- assert(_root != n);
-
- n->parent(NULL);
- n->left_child(NULL);
- n->right_child(NULL);
-
- --_size;
-
- if (_size == 0) _root = NULL;
-
- // Be sure right node is being removed
- assert(n->node() == remove_node);
-
- return n;
-}
-
-
-template<typename T>
-T
-Tree<T>::find(const string& name) const
-{
- TreeNode<T>* tn = find_treenode(name);
-
- return (tn == NULL) ? NULL : tn->node();
-}
-
-
-template<typename T>
-TreeNode<T>*
-Tree<T>::find_treenode(const string& name) const
-{
- TreeNode<T>* i = _root;
- int cmp = 0;
-
- while (i != NULL) {
- cmp = name.compare(i->key());
- if (cmp < 0)
- i = i->left_child();
- else if (cmp > 0)
- i = i->right_child();
- else
- break;
- }
-
- return i;
-}
-
-
-/** Finds the smallest (key) node in the subtree rooted at "root"
- */
-template<typename T>
-TreeNode<T>*
-Tree<T>::_find_smallest(TreeNode<T>* root)
-{
- TreeNode<T>* r = root;
-
- while (r->left_child() != NULL)
- r = r->left_child();
-
- return r;
-}
-
-
-/** Finds the largest (key) node in the subtree rooted at "root".
- */
-template<typename T>
-TreeNode<T>*
-Tree<T>::_find_largest(TreeNode<T>* root)
-{
- TreeNode<T>* r = root;
-
- while (r->right_child() != NULL)
- r = r->right_child();
-
- return r;
-
-}
-
-
-
-//// Iterator Stuff ////
-
-
-
-template<typename T>
-Tree<T>::iterator::iterator(const Tree *tree, size_t size)
-: _depth(-1),
- _size(size),
- _stack(NULL),
- _tree(tree)
-{
- if (size > 0)
- _stack = new TreeNode<T>*[size];
-}
-
-
-template<typename T>
-Tree<T>::iterator::~iterator()
-{
- delete[] _stack;
-}
-
-
-/* FIXME: Make these next two not memcpy (possibly have to force a single
- * iterator existing at any given time) for speed.
- */
-
-// Copy constructor (for the typical for loop usage)
-template<typename T>
-Tree<T>::iterator::iterator(const Tree<T>::iterator& copy)
-: _depth(copy._depth),
- _size(copy._size),
- _tree(copy._tree)
-{
- if (_size > 0) {
- _stack = new TreeNode<T>*[_size];
- memcpy(_stack, copy._stack, _size * sizeof(TreeNode<T>*));
- }
-}
-
-
-// Assignment operator
-template<typename T>
-typename Tree<T>::iterator&
-Tree<T>::iterator::operator=(const Tree<T>::iterator& copy) {
- _depth = copy._depth;
- _size = copy._size;
- _tree = copy._tree;
-
- if (_size > 0) {
- _stack = new TreeNode<T>*[_size];
- memcpy(_stack, copy._stack, _size * sizeof(TreeNode<T>*));
- }
- return *this;
-}
-
-
-template<typename T>
-T
-Tree<T>::iterator::operator*() const
-{
- assert(_depth >= 0);
- return _stack[_depth]->node();
-}
-
-
-template<typename T>
-typename Tree<T>::iterator&
-Tree<T>::iterator::operator++()
-{
- assert(_depth >= 0);
-
- TreeNode<T>* tn = _stack[_depth];
- --_depth;
-
- tn = tn->right_child();
- while (tn != NULL) {
- ++_depth;
- _stack[_depth] = tn;
- tn = tn->left_child();
- }
-
- return *this;
-}
-
-
-template<typename T>
-bool
-Tree<T>::iterator::operator!=(const Tree<T>::iterator& iter) const
-{
- // (DeMorgan's Law)
- return (_tree != iter._tree || _depth != iter._depth);
-}
-
-
-template<typename T>
-typename Tree<T>::iterator
-Tree<T>::begin() const
-{
- typename Tree<T>::iterator iter(this, _size);
- iter._depth = -1;
-
- TreeNode<T> *ptr = _root;
- while (ptr != NULL) {
- iter._depth++;
- iter._stack[iter._depth] = ptr;
- ptr = ptr->left_child();
- }
-
- return iter;
-}
-
-
-template<typename T>
-typename Tree<T>::iterator
-Tree<T>::end() const
-{
- typename Tree<T>::iterator iter(this, 0);
- iter._depth = -1;
-
- return iter;
-}
-
-
diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp
index 65296de6..6ed860dd 100644
--- a/src/libs/engine/events/CreateNodeEvent.cpp
+++ b/src/libs/engine/events/CreateNodeEvent.cpp
@@ -22,7 +22,6 @@
#include "Responder.hpp"
#include "Patch.hpp"
#include "Node.hpp"
-#include "Tree.hpp"
#include "Plugin.hpp"
#include "Engine.hpp"
#include "Patch.hpp"
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index 288eaee3..748d44dc 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -15,17 +15,16 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
#include "CreatePatchEvent.hpp"
#include "Responder.hpp"
#include "Patch.hpp"
#include "Node.hpp"
-#include "Tree.hpp"
#include "Plugin.hpp"
#include "Engine.hpp"
-#include <raul/Maid.hpp>
#include "ClientBroadcaster.hpp"
#include "AudioDriver.hpp"
-#include <raul/Path.hpp>
#include "ObjectStore.hpp"
namespace Ingen {
diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp
index b8bc75e6..6163d4ab 100644
--- a/src/libs/engine/events/CreatePortEvent.cpp
+++ b/src/libs/engine/events/CreatePortEvent.cpp
@@ -22,7 +22,6 @@
#include "Responder.hpp"
#include "CreatePortEvent.hpp"
#include "Patch.hpp"
-#include "Tree.hpp"
#include "Plugin.hpp"
#include "Engine.hpp"
#include "Patch.hpp"
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index a3d96ede..2ccad693 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -15,11 +15,12 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
#include "DestroyEvent.hpp"
#include "Responder.hpp"
#include "Engine.hpp"
#include "Patch.hpp"
-#include "Tree.hpp"
#include "NodeBase.hpp"
#include "Plugin.hpp"
#include "AudioDriver.hpp"
@@ -27,9 +28,7 @@
#include "DisconnectNodeEvent.hpp"
#include "DisconnectPortEvent.hpp"
#include "ClientBroadcaster.hpp"
-#include <raul/Maid.hpp>
#include "ObjectStore.hpp"
-#include <raul/Path.hpp>
#include "QueuedEventSource.hpp"
#include "Port.hpp"
diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp
index 5ab3b01f..77167598 100644
--- a/src/libs/engine/events/DestroyEvent.hpp
+++ b/src/libs/engine/events/DestroyEvent.hpp
@@ -33,7 +33,7 @@ template<typename T> class TreeNode;
namespace Ingen {
-class GraphObject;
+class GraphObjectImpl;
class Patch;
class Node;
class Port;
@@ -61,7 +61,7 @@ public:
private:
Path _path;
ObjectStore::Objects::iterator _store_iterator;
- Table<Path,GraphObject*> _removed_table;
+ Table<Path,GraphObjectImpl*> _removed_table;
Node* _node; ///< Same as _object if it is a Node, otherwise NULL
Port* _port; ///< Same as _object if it is a Port, otherwise NULL
DriverPort* _driver_port;
diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp
index 9e5ef543..c643e456 100644
--- a/src/libs/engine/events/RenameEvent.cpp
+++ b/src/libs/engine/events/RenameEvent.cpp
@@ -23,7 +23,6 @@
#include "Patch.hpp"
#include "RenameEvent.hpp"
#include "Responder.hpp"
-#include "Tree.hpp"
#include "AudioDriver.hpp"
#include "MidiDriver.hpp"
@@ -78,10 +77,10 @@ RenameEvent::pre_process()
return;
}
- Table<Path,GraphObject*> removed = _engine.object_store()->remove(_store_iterator);
+ Table<Path,GraphObjectImpl*> removed = _engine.object_store()->remove(_store_iterator);
assert(removed.size() > 0);
- for (Table<Path,GraphObject*>::iterator i = removed.begin(); i != removed.end(); ++i) {
+ for (Table<Path,GraphObjectImpl*>::iterator i = removed.begin(); i != removed.end(); ++i) {
const Path& child_old_path = i->first;
assert(Path::descendant_comparator(_old_path, child_old_path));
diff --git a/src/libs/engine/events/RenameEvent.hpp b/src/libs/engine/events/RenameEvent.hpp
index ec3a0cec..e01f4409 100644
--- a/src/libs/engine/events/RenameEvent.hpp
+++ b/src/libs/engine/events/RenameEvent.hpp
@@ -30,7 +30,7 @@ template<typename T> class ListNode;
namespace Ingen {
-class GraphObject;
+class GraphObjectImpl;
class Patch;
class Node;
class Plugin;
@@ -38,7 +38,7 @@ class DisconnectNodeEvent;
class DisconnectPortEvent;
-/** An event to change the name of an GraphObject.
+/** An event to change the name of an GraphObjectImpl.
*
* \ingroup engine
*/
diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp
index fdd0ded3..0567d94d 100644
--- a/src/libs/engine/events/RequestMetadataEvent.cpp
+++ b/src/libs/engine/events/RequestMetadataEvent.cpp
@@ -19,7 +19,7 @@
#include <string>
#include "Responder.hpp"
#include "Engine.hpp"
-#include "GraphObject.hpp"
+#include "GraphObjectImpl.hpp"
#include "ObjectStore.hpp"
#include "interface/ClientInterface.hpp"
#include "ClientBroadcaster.hpp"
diff --git a/src/libs/engine/events/RequestMetadataEvent.hpp b/src/libs/engine/events/RequestMetadataEvent.hpp
index 714b1ec3..bbc2c871 100644
--- a/src/libs/engine/events/RequestMetadataEvent.hpp
+++ b/src/libs/engine/events/RequestMetadataEvent.hpp
@@ -25,7 +25,7 @@ using std::string;
namespace Ingen {
-class GraphObject;
+class GraphObjectImpl;
namespace Shared {
class ClientInterface;
} using Shared::ClientInterface;
@@ -47,7 +47,7 @@ private:
string _path;
string _key;
Raul::Atom _value;
- GraphObject* _object;
+ GraphObjectImpl* _object;
};
diff --git a/src/libs/engine/events/RequestObjectEvent.hpp b/src/libs/engine/events/RequestObjectEvent.hpp
index 263ea627..52459ada 100644
--- a/src/libs/engine/events/RequestObjectEvent.hpp
+++ b/src/libs/engine/events/RequestObjectEvent.hpp
@@ -26,7 +26,7 @@ using std::string;
namespace Ingen {
-class GraphObject;
+class GraphObjectImpl;
namespace Shared { class ClientInterface; }
using Shared::ClientInterface;
@@ -45,8 +45,8 @@ public:
void post_process();
private:
- string _path;
- GraphObject* _object;
+ const string _path;
+ GraphObjectImpl* _object;
};
diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp
index 8e9163f0..ee0a62dc 100644
--- a/src/libs/engine/events/SetMetadataEvent.cpp
+++ b/src/libs/engine/events/SetMetadataEvent.cpp
@@ -20,7 +20,7 @@
#include "Responder.hpp"
#include "Engine.hpp"
#include "ClientBroadcaster.hpp"
-#include "GraphObject.hpp"
+#include "GraphObjectImpl.hpp"
#include "ObjectStore.hpp"
using std::string;
diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp
index 363a63eb..e65763c4 100644
--- a/src/libs/engine/events/SetMetadataEvent.hpp
+++ b/src/libs/engine/events/SetMetadataEvent.hpp
@@ -26,10 +26,10 @@ using std::string;
namespace Ingen {
-class GraphObject;
+class GraphObjectImpl;
-/** An event to set a piece of metadata for an GraphObject.
+/** An event to set a piece of metadata for an GraphObjectImpl.
*
* \ingroup engine
*/
@@ -46,7 +46,7 @@ private:
string _path;
string _key;
Raul::Atom _value;
- GraphObject* _object;
+ GraphObjectImpl* _object;
};
diff --git a/src/libs/engine/events/SetPolyphonicEvent.hpp b/src/libs/engine/events/SetPolyphonicEvent.hpp
index 4d0084c9..5922d443 100644
--- a/src/libs/engine/events/SetPolyphonicEvent.hpp
+++ b/src/libs/engine/events/SetPolyphonicEvent.hpp
@@ -26,7 +26,7 @@ using std::string;
namespace Ingen {
-class GraphObject;
+class GraphObjectImpl;
/** Delete all nodes from a patch.
@@ -43,9 +43,9 @@ public:
void post_process();
private:
- string _path;
- GraphObject* _object;
- bool _poly;
+ const string _path;
+ GraphObjectImpl* _object;
+ bool _poly;
};
diff --git a/src/libs/engine/instantiations.cpp b/src/libs/engine/instantiations.cpp
deleted file mode 100644
index 6dd80445..00000000
--- a/src/libs/engine/instantiations.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/** @file
- * Explicit template instantiations.
- *
- * Needed to avoid undefined references, because GCC doesn't automatically
- * instantiate templates (at least not well/completely).
- */
-
-#include "Tree.hpp"
-#include "TreeImplementation.hpp"
-#include "GraphObject.hpp"
-
-template class Tree<Ingen::GraphObject*>;
-
diff --git a/src/libs/engine/tests/Makefile.am b/src/libs/engine/tests/Makefile.am
deleted file mode 100644
index bb5e8a56..00000000
--- a/src/libs/engine/tests/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-if BUILD_UNIT_TESTS
-
-AM_CXXFLAGS = @JACK_CFLAGS@ @LIBLO_CFLAGS@ @ALSA_CFLAGS@ @RAUL_CFLAGS@ -I../../common
-common_ldadd = @JACK_LIBS@ @RAUL_LIBS@ @LIBLO_LIBS@ @ALSA_LIBS@ -lrt
-node_tree_test_LDADD = $(common_ldadd)
-
-noinst_PROGRAMS = node_tree_test
-
-node_tree_test_SOURCES = \
- node_tree_test.cpp
-
-endif # BUILD_UNIT_TESTS
diff --git a/src/libs/engine/tests/node_tree_test.cpp b/src/libs/engine/tests/node_tree_test.cpp
deleted file mode 100644
index 923cb0ba..00000000
--- a/src/libs/engine/tests/node_tree_test.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-#include "../Tree.hpp"
-#include "../TreeImplementation.hpp"
-
-using std::vector;
-using std::cout; using std::cerr; using std::endl;
-
-static const uint NUM_NODES = 20;
-
-int
-main()
-{
- cout << "\n\n\n\n";
-
- Tree<string> tree;
- vector<string> names;
- vector<bool> in_tree; // arrays
- uint num_in_tree = 0;
-
-
- string name;
-
- for (uint i=0; i < NUM_NODES; ++i) {
- name = (char)(i+'A');
- TreeNode<string>* n = new TreeNode<string>(name, name);
- tree.insert(n);
- names.push_back(name);
- in_tree.push_back(true);
- ++num_in_tree;
- }
-
- cout << "Added " << NUM_NODES << " nodes." << endl;
- cout << "Tree size: " << tree.size() << endl << endl;
-
- cout << "Tree contents: " << endl;
- for (Tree<string>::iterator i = tree.begin(); i != tree.end(); ++i) {
- cout << (*i) << ", ";
- }
- cout << endl;
-
-
- while (true) {
- bool insert;
- int num = rand() % NUM_NODES;
-
- if (num_in_tree == 0)
- insert = true;
- else if (num_in_tree == NUM_NODES)
- insert = false;
- else {
- while (true) {
- insert = rand() % 2;
- num = rand() % NUM_NODES;
- if ((insert && !in_tree[num]) || (!insert && in_tree[num]))
- break;
- }
- }
-
- string name = names[num];
-
- if (insert) {
- assert(in_tree[num] == false);
- cout << "\nInserting '" << name << "'" << endl;
- tree.insert(new TreeNode<string>(name, name));
- in_tree[num] = true;
- ++num_in_tree;
- cout << "Tree size: " << tree.size() << endl;
- assert(num_in_tree == tree.size());
- } else {
- assert(in_tree[num] == true);
- cout << "\nRemoving '" << name << "'" << endl;
- TreeNode<string>* removed = tree.remove(name);
- assert(removed != NULL);
- assert(removed->node() == name);
- assert(removed->key() == name);
- delete removed;
- in_tree[num] = false;
- assert(names[num] == name);
- --num_in_tree;
- cout << "Tree size: " << tree.size() << endl;
- assert(num_in_tree == tree.size());
- }
- assert(num_in_tree == tree.size());
- cout << "Tree contents: " << endl;
- for (Tree<string>::iterator i = tree.begin(); i != tree.end(); ++i) {
- cout << (*i) << ", ";
- }
- cout << endl;
- }
-
- return 0;
-}
diff --git a/src/libs/engine/tests/old_node_tree_test.cpp b/src/libs/engine/tests/old_node_tree_test.cpp
deleted file mode 100644
index 3b5ed485..00000000
--- a/src/libs/engine/tests/old_node_tree_test.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <iostream>
-#include "../NodeTree.h"
-#include "../NodeBase.h"
-
-using std::cout; using std::cerr; using std::endl;
-
-int main()
-{
- cout << "\n\n\n\n";
-
- NodeBase* n = NULL;
- TreeNode* tn = NULL;
- TreeNode* baz = NULL;
- TreeNode* quuux = NULL;
- TreeNode* bar = NULL;
-
- NodeTree tree;
- n = new NodeBase("foo", 0, 0, 0);
- tn = new TreeNode(n);
- tree.insert(tn);
- n = new NodeBase("bar", 0, 0, 0);
- bar = new TreeNode(n);
- tree.insert(bar);
- n = new NodeBase("baz", 0, 0, 0);
- baz = new TreeNode(n);
- tree.insert(baz);
- n = new NodeBase("quux", 0, 0, 0);
- tn = new TreeNode(n);
- tree.insert(tn);
- n = new NodeBase("quuux", 0, 0, 0);
- quuux = new TreeNode(n);
- tree.insert(quuux);
- n = new NodeBase("quuuux", 0, 0, 0);
- tn = new TreeNode(n);
- tree.insert(tn);
-
-
- cout << "Added 6 nodes." << endl;
- cout << "Tree size: " << tree.size() << endl << endl;
-
- cout << "Iterating: " << endl;
- for (NodeTree::iterator i = tree.begin(); i != tree.end(); ++i) {
- cout << (*i)->name() << endl;
- }
-
- cout << endl << "Search 'foo' - " << tree.find("foo")->name() << endl;
- cout << endl << "Search 'bar' - " << tree.find("bar")->name() << endl;
- cout << endl << "Search 'baz' - " << tree.find("baz")->name() << endl;
- cout << endl << "Search 'quux' - " << tree.find("quux")->name() << endl;
- cout << endl << "Search 'quuux' - " << tree.find("quuux")->name() << endl;
- cout << endl << "Search 'quuuux' - " << tree.find("quuuux")->name() << endl;
- cout << endl << "Search 'dave' - " << tree.find("dave") << endl;
- cout << endl << "Search 'fo' - " << tree.find("fo") << endl << endl;
-
- cout << "Removing 'baz'." << endl;
- tree.remove(baz);
-
- cout << "Iterating: " << endl;
- for (NodeTree::iterator i = tree.begin(); i != tree.end(); ++i) {
- cout << (*i)->name() << endl;
- }
-
- cout << "Removing 'bar' (the root): " << endl;
- tree.remove(bar);
-
- cout << "Iterating: " << endl;
- for (NodeTree::iterator i = tree.begin(); i != tree.end(); ++i) {
- cout << (*i)->name() << endl;
- }
-
- return 0;
-}