diff options
author | David Robillard <d@drobilla.net> | 2011-06-07 02:44:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-06-07 02:44:16 +0000 |
commit | 00f2ad0069fe4e51e40e6a3b3d41f125b67f89cf (patch) | |
tree | 1a96d7873a700a05815bde3e3119b7055532d861 /src/PatchageCanvas.hpp | |
parent | 9adc6fb021bcde9720a8afcac9a1a87521691fba (diff) | |
download | patchage-00f2ad0069fe4e51e40e6a3b3d41f125b67f89cf.tar.gz patchage-00f2ad0069fe4e51e40e6a3b3d41f125b67f89cf.tar.bz2 patchage-00f2ad0069fe4e51e40e6a3b3d41f125b67f89cf.zip |
Remove use of smart pointers in FlowCanvas entirely.
Since FlowCanvas's containers own their children, there is no real benefit to using smart pointers for objects, though there is overhead. There are no longer any add or remove methods for containers, simply create (new) and destroy (delete) objects and things should work as expected.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@3366 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PatchageCanvas.hpp')
-rw-r--r-- | src/PatchageCanvas.hpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/PatchageCanvas.hpp b/src/PatchageCanvas.hpp index b7ec3b2..e7e8214 100644 --- a/src/PatchageCanvas.hpp +++ b/src/PatchageCanvas.hpp @@ -42,38 +42,40 @@ class PatchageCanvas : public FlowCanvas::Canvas { public: PatchageCanvas(Patchage* _app, int width, int height); - boost::shared_ptr<PatchageModule> find_module(const std::string& name, ModuleType type); - boost::shared_ptr<PatchagePort> find_port(const PortID& id); + PatchageModule* find_module(const std::string& name, ModuleType type); + PatchagePort* find_port(const PortID& id); - boost::shared_ptr<PatchagePort> find_port_by_name(const std::string& client_name, - const std::string& port_name); + PatchagePort* find_port_by_name(const std::string& client_name, + const std::string& port_name); - void connect(boost::shared_ptr<FlowCanvas::Connectable> port1, - boost::shared_ptr<FlowCanvas::Connectable> port2); + void connect(FlowCanvas::Connectable* port1, + FlowCanvas::Connectable* port2); - void disconnect(boost::shared_ptr<FlowCanvas::Connectable> port1, - boost::shared_ptr<FlowCanvas::Connectable> port2); + void disconnect(FlowCanvas::Connectable* port1, + FlowCanvas::Connectable* port2); void status_message(const std::string& msg); - void index_port(const PortID& id, boost::shared_ptr<PatchagePort> port) { + void index_port(const PortID& id, PatchagePort* port) { _port_index.insert(std::make_pair(id, port)); } - void add_module(const std::string& name, boost::shared_ptr<PatchageModule> module); - bool remove_item(boost::shared_ptr<FlowCanvas::Item> i); + void remove_ports(bool (*pred)(const PatchagePort*)); - boost::shared_ptr<PatchagePort> remove_port(const PortID& id); + void add_module(const std::string& name, PatchageModule* module); + bool remove_item(FlowCanvas::Item* i); + + PatchagePort* remove_port(const PortID& id); void destroy(); private: Patchage* _app; - typedef std::map< const PortID, boost::shared_ptr<PatchagePort> > PortIndex; + typedef std::map<const PortID, PatchagePort*> PortIndex; PortIndex _port_index; - typedef std::multimap< const std::string, boost::shared_ptr<PatchageModule> > ModuleIndex; + typedef std::multimap<const std::string, PatchageModule*> ModuleIndex; ModuleIndex _module_index; }; |