Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
20 
21 #include <memory>
22 #include <vector>
23 
24 #include "ardour/io.h"
25 
26 namespace ARDOUR {
27 
28 class IOVector : public std::vector<std::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  std::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 (std::shared_ptr<const IO> other) const {
44  for (IOVector::const_iterator i = begin(); i != end(); ++i) {
45  std::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 
55  bool fed_by (std::shared_ptr<const IO> other) const {
56  for (IOVector::const_iterator i = begin(); i != end(); ++i) {
57  std::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 
bool fed_by(std::shared_ptr< const IO > other) const
Definition: io_vector.h:55