summaryrefslogtreecommitdiffstats
path: root/ingen/Store.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ingen/Store.hpp')
-rw-r--r--ingen/Store.hpp40
1 files changed, 30 insertions, 10 deletions
diff --git a/ingen/Store.hpp b/ingen/Store.hpp
index f35c8368..87f6f7e0 100644
--- a/ingen/Store.hpp
+++ b/ingen/Store.hpp
@@ -17,32 +17,52 @@
#ifndef INGEN_STORE_HPP
#define INGEN_STORE_HPP
-#include <string>
+#include <map>
#undef nil
#include <glibmm/thread.h>
-#include "raul/PathTable.hpp"
-
#include "ingen/GraphObject.hpp"
+#include "raul/Deletable.hpp"
+#include "raul/Noncopyable.hpp"
namespace Ingen {
/** Store of objects in the patch hierarchy.
* @ingroup IngenShared
*/
-class Store : public Raul::PathTable< SharedPtr<GraphObject> > {
+class Store : public Raul::Noncopyable
+ , public Raul::Deletable
+ , public std::map< const Raul::Path, SharedPtr<GraphObject> > {
public:
- virtual ~Store() {}
-
- virtual void add(GraphObject* o);
+ void add(GraphObject* o);
- typedef Raul::Table< Raul::Path, SharedPtr<GraphObject> > Objects;
+ GraphObject* get(const Raul::Path& path) {
+ const iterator i = find(path);
+ return (i == end()) ? NULL : i->second.get();
+ }
typedef std::pair<const_iterator, const_iterator> const_range;
- const_range
- children_range(SharedPtr<const GraphObject> o) const;
+ typedef std::map< Raul::Path, SharedPtr<GraphObject> > Objects;
+
+ iterator find_descendants_end(Store::iterator parent);
+ const_iterator find_descendants_end(Store::const_iterator parent) const;
+
+ const_range children_range(SharedPtr<const GraphObject> o) const;
+
+ /** Remove the object at @p top and all its children from the store.
+ *
+ * @param removed Filled with all the removed objects. Note this may be
+ * many objects since any children will be removed as well.
+ */
+ void remove(iterator top, Objects& removed);
+
+ /** Rename (move) the object at @p top to @p new_path.
+ *
+ * Note this invalidates @p i.
+ */
+ void rename(iterator i, const Raul::Path& new_path);
unsigned child_name_offset(const Raul::Path& parent,
const Raul::Symbol& symbol,