Ardour  8.12
io_vector.h
Go to the documentation of this file.
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 <memory>
23 #include <vector>
24 
25 #include "ardour/io.h"
26 
27 namespace ARDOUR {
28 
29 class IOVector : public std::vector<std::weak_ptr<ARDOUR::IO> >
30 {
31 public:
32 #if 0 // unused -- for future reference
33  bool connected_to (const IOVector& other) const {
34  for (IOVector::const_iterator i = other.begin(); i != other.end(); ++i) {
35  std::shared_ptr<const IO> io = i->lock();
36  if (!io) continue;
37  if (connected_to (io)) {
38  return true;
39  }
40  }
41  return false;
42  }
43 
44  bool connected_to (std::shared_ptr<const IO> other) const {
45  for (IOVector::const_iterator i = begin(); i != end(); ++i) {
46  std::shared_ptr<const IO> io = i->lock();
47  if (!io) continue;
48  if (io->connected_to (other)) {
49  return true;
50  }
51  }
52  return false;
53  }
54 #endif
55 
56  bool fed_by (std::shared_ptr<const IO> other) const {
57  for (IOVector::const_iterator i = begin(); i != end(); ++i) {
58  std::shared_ptr<const IO> io = i->lock();
59  if (!io) continue;
60  if (other->connected_to (io)) {
61  return true;
62  }
63  }
64  return false;
65  }
66 };
67 
68 } // namespace ARDOUR
69 
70 
71 #endif
bool fed_by(std::shared_ptr< const IO > other) const
Definition: io_vector.h:56