1 /* 2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 19 #ifndef __ardour_io_vector_h__ 20 #define __ardour_io_vector_h__ 21 22 #include <vector> 23 #include <boost/shared_ptr.hpp> 24 #include "ardour/io.h" 25 26 namespace ARDOUR { 27 28 class IOVector : public std::vector<boost::weak_ptr<ARDOUR::IO> > 29 { 30 public: 31 #if 0 // unused -- for future reference 32 bool connected_to (const IOVector& other) const { 33 for (IOVector::const_iterator i = other.begin(); i != other.end(); ++i) { 34 boost::shared_ptr<const IO> io = i->lock(); 35 if (!io) continue; 36 if (connected_to (io)) { 37 return true; 38 } 39 } 40 return false; 41 } 42 43 bool connected_to (boost::shared_ptr<const IO> other) const { 44 for (IOVector::const_iterator i = begin(); i != end(); ++i) { 45 boost::shared_ptr<const IO> io = i->lock(); 46 if (!io) continue; 47 if (io->connected_to (other)) { 48 return true; 49 } 50 } 51 return false; 52 } 53 #endif 54 fed_by(boost::shared_ptr<const IO> other)55 bool fed_by (boost::shared_ptr<const IO> other) const { 56 for (IOVector::const_iterator i = begin(); i != end(); ++i) { 57 boost::shared_ptr<const IO> io = i->lock(); 58 if (!io) continue; 59 if (other->connected_to (io)) { 60 return true; 61 } 62 } 63 return false; 64 } 65 }; 66 67 } // namespace ARDOUR 68 69 70 #endif 71