Changeset 8fb8427 in ingen


Ignore:
Timestamp:
Oct 26, 2015, 10:05:10 AM (2 years ago)
Author:
David Robillard <d@…>
Branches:
groups, master, nodeless, parallel, parameters, sequencefix, tasks
Children:
019bd36
Parents:
1477371
Message:

Use a set for providers and dependants

git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5790 a436a847-0d15-0410-975c-d299462d15a1

Location:
src/server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/server/BlockImpl.hpp

    r1477371 r8fb8427  
    1818#define INGEN_ENGINE_BLOCKIMPL_HPP
    1919
    20 #include <list>
     20#include <set>
    2121
    2222#include <boost/intrusive/slist.hpp>
     
    139139
    140140    /** Blocks that are connected to this Block's inputs. */
    141     std::list<BlockImpl*>& providers() { return _providers; }
     141    std::set<BlockImpl*>& providers() { return _providers; }
    142142
    143143    /** Blocks that are connected to this Block's outputs. */
    144     std::list<BlockImpl*>& dependants() { return _dependants; }
     144    std::set<BlockImpl*>& dependants() { return _dependants; }
    145145
    146146    /** Flag block as polyphonic.
     
    191191    Context::ID             _context; ///< Context this block runs in
    192192    uint32_t                _polyphony;
    193     std::list<BlockImpl*>   _providers; ///< Blocks connected to this one's input ports
    194     std::list<BlockImpl*>   _dependants; ///< Blocks this one's output ports are connected to
     193    std::set<BlockImpl*>    _providers; ///< Blocks connected to this one's input ports
     194    std::set<BlockImpl*>    _dependants; ///< Blocks this one's output ports are connected to
    195195    bool                    _polyphonic;
    196196    bool                    _activated;
  • src/server/events/Connect.cpp

    r1477371 r8fb8427  
    112112    */
    113113    if (tail_block != head_block && tail_block->parent() == head_block->parent()) {
    114         head_block->providers().push_back(tail_block);
    115         tail_block->dependants().push_back(head_block);
     114        head_block->providers().insert(tail_block);
     115        tail_block->dependants().insert(head_block);
    116116    }
    117117
  • src/server/events/Disconnect.cpp

    r1477371 r8fb8427  
    7373    BlockImpl* const head_block = _head->parent_block();
    7474
    75     for (std::list<BlockImpl*>::iterator i = head_block->providers().begin();
    76          i != head_block->providers().end(); ++i) {
    77         if ((*i) == tail_block) {
    78             head_block->providers().erase(i);
    79             break;
    80         }
    81     }
    82 
    83     for (std::list<BlockImpl*>::iterator i = tail_block->dependants().begin();
    84          i != tail_block->dependants().end(); ++i) {
    85         if ((*i) == head_block) {
    86             tail_block->dependants().erase(i);
    87             break;
    88         }
     75    std::set<BlockImpl*>::iterator hp = head_block->providers().find(tail_block);
     76    if (hp != head_block->providers().end()) {
     77        head_block->providers().erase(hp);
     78    }
     79
     80    std::set<BlockImpl*>::iterator td = tail_block->dependants().find(head_block);
     81    if (td != tail_block->dependants().end()) {
     82        tail_block->dependants().erase(td);
    8983    }
    9084
Note: See TracChangeset for help on using the changeset viewer.