diff options
author | David Robillard <d@drobilla.net> | 2017-03-26 19:10:45 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-03-26 19:10:45 +0200 |
commit | 3c3feab0d385a927e77e75485a6f9c0320c954d3 (patch) | |
tree | c100549a434755400cfaeb753d492a697dc9a042 /ingen | |
parent | d5eb49e1e468377fea4c5f13840d0435714d34c4 (diff) | |
download | ingen-3c3feab0d385a927e77e75485a6f9c0320c954d3.tar.gz ingen-3c3feab0d385a927e77e75485a6f9c0320c954d3.tar.bz2 ingen-3c3feab0d385a927e77e75485a6f9c0320c954d3.zip |
Make Store keyed by URI instead of Path
Diffstat (limited to 'ingen')
-rw-r--r-- | ingen/Store.hpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/ingen/Store.hpp b/ingen/Store.hpp index d9a52102..1f0ca1c8 100644 --- a/ingen/Store.hpp +++ b/ingen/Store.hpp @@ -33,23 +33,38 @@ namespace Ingen { */ class INGEN_API Store : public Raul::Noncopyable , public Raul::Deletable - , public std::map< const Raul::Path, SPtr<Node> > { + , public std::map< const Raul::URI, SPtr<Node> > { public: void add(Node* o); - Node* get(const Raul::Path& path) { - const iterator i = find(path); + Node* get(const Raul::URI& uri) { + const iterator i = find(uri); return (i == end()) ? NULL : i->second.get(); } - typedef std::pair<const_iterator, const_iterator> const_range; + Node* get(const Raul::Path& path) { return get(path_to_uri(path)); } + + const_iterator find(const Raul::Path& path) const { + return find(path_to_uri(path)); + } - typedef std::map< Raul::Path, SPtr<Node> > Objects; + iterator find(const Raul::Path& path) { + return find(path_to_uri(path)); + } - iterator find_descendants_end(Store::iterator parent); - const_iterator find_descendants_end(Store::const_iterator parent) const; + const_iterator find(const Raul::URI& uri) const { + return std::map< const Raul::URI, SPtr<Node> >::find(uri); + } - const_range children_range(SPtr<const Node> o) const; + iterator find(const Raul::URI& uri) { + return std::map< const Raul::URI, SPtr<Node> >::find(uri); + } + + const_iterator find_first_child(SPtr<const Node> o) const; + + typedef std::pair<const_iterator, const_iterator> const_range; + + typedef std::map< Raul::URI, SPtr<Node> > Objects; /** Remove the object at `top` and all its children from the store. * @@ -75,6 +90,8 @@ public: Mutex& mutex() { return _mutex; } private: + iterator find_descendants_end(iterator parent); + Mutex _mutex; }; |