remove getter for Amp::_apply_automation_gain; reset member to false after use, and...
[ardour.git] / libs / ardour / ardour / port_set.h
index a6a0593946680a221cde74cadaf7e752891369c0..fce36279674c1784bda063cbbe52f7a4d79a4c9e 100644 (file)
@@ -34,8 +34,12 @@ class MidiPort;
  * This allows access to all the ports as a list, ignoring type, or accessing
  * the nth port of a given type.  Note that port(n) and nth_audio_port(n) may
  * NOT return the same port.
+ *
+ * Each port is held twice; once in a per-type vector of vectors (_ports)
+ * and once in a vector of all port (_all_ports).  This is to speed up the
+ * fairly common case of iterating over all ports.
  */
-class PortSet : public boost::noncopyable {
+class LIBARDOUR_API PortSet : public boost::noncopyable {
 public:
        PortSet();
 
@@ -45,10 +49,15 @@ public:
        void add (boost::shared_ptr<Port> port);
        bool remove (boost::shared_ptr<Port> port);
 
-       /** nth port */
+       /** nth port
+        * @param index port index
+        */
        boost::shared_ptr<Port> port(size_t index) const;
 
-       /** nth port of type @a t, or nth port if t = NIL */
+       /** nth port of type @a t, or nth port if t = NIL
+        * @param t data type
+        * @param index port index
+        */
        boost::shared_ptr<Port> port(DataType t, size_t index) const;
 
        boost::shared_ptr<AudioPort> nth_audio_port(size_t n) const;
@@ -60,7 +69,7 @@ public:
        /** Remove all ports from the PortSet.  Ports are not deregistered with
         * the engine, it's the caller's responsibility to not leak here!
         */
-       void clear() { _ports.clear(); }
+       void clear();
 
        const ChanCount& count() const { return _count; }
 
@@ -132,6 +141,8 @@ private:
 
        // Vector of vectors, indexed by DataType::to_index()
        std::vector<PortVec> _ports;
+       // All ports in _ports in one vector, to speed some operations
+       PortVec _all_ports;
 
        ChanCount _count;
 };