Stub implementation of LV2 persist extension.
[ardour.git] / libs / ardour / ardour / bundle.h
index 662c3799a5292f569a282c055546cc734dfc34cc..369b12ec9ba68c02581026cfa2690df9769efc34 100644 (file)
 #include <glibmm/thread.h>
 #include <boost/shared_ptr.hpp>
 
-#include "pbd/scoped_connections.h"
+#include "pbd/signals.h"
 
 #include "ardour/data_type.h"
+#include "ardour/chan_count.h"
 
 namespace ARDOUR {
 
 class AudioEngine;
 
 /** A set of `channels', each of which is associated with 0 or more ports.
- *  Each channel has a name which can be anything useful.
+ *  Each channel has a name which can be anything useful, and a data type.
  *  Intended for grouping things like, for example, a buss' outputs.
  *  `Channel' is a rather overloaded term but I can't think of a better
  *  one right now.
@@ -49,33 +50,40 @@ class Bundle : public PBD::ScopedConnectionList
        typedef std::vector<std::string> PortList;
 
        struct Channel {
-               Channel (std::string n) : name (n) {}
+               Channel (std::string n, DataType t) : name (n), type (t) {}
+               Channel (std::string n, DataType t, PortList p) : name (n), type (t), ports (p) {}
+               Channel (std::string n, DataType t, std::string const & p) : name (n), type (t) {
+                       ports.push_back (p);
+               }
 
                bool operator== (Channel const &o) const {
-                       return name == o.name && ports == o.ports;
+                       return name == o.name && type == o.type && ports == o.ports;
                }
 
                std::string name;
+               DataType type;
                PortList ports;
        };
 
        Bundle (bool i = true);
        Bundle (std::string const &, bool i = true);
-       Bundle (std::string const &, DataType, bool i = true);
        Bundle (boost::shared_ptr<Bundle>);
 
        virtual ~Bundle() {}
 
        /** @return Number of channels that this Bundle has */
-       uint32_t nchannels () const;
+       ChanCount nchannels () const;
 
        /** @param Channel index.
         *  @return Ports associated with this channel.
         */
        PortList const & channel_ports (uint32_t) const;
 
-       void add_channel (std::string const &);
+       void add_channel (std::string const &, DataType);
+       void add_channel (std::string const &, DataType, std::string const &);
+       void add_channel (std::string const &, DataType, PortList);
        std::string channel_name (uint32_t) const;
+       DataType channel_type (uint32_t) const;
        void set_channel_name (uint32_t, std::string const &);
        void add_port_to_channel (uint32_t, std::string);
        void set_port (uint32_t, std::string);
@@ -83,7 +91,7 @@ class Bundle : public PBD::ScopedConnectionList
        void remove_ports_from_channel (uint32_t);
        void remove_ports_from_channels ();
        bool port_attached_to_channel (uint32_t, std::string);
-       bool uses_port (std::string) const;
+       bool offers_port (std::string) const;
        bool offers_port_alone (std::string) const;
        void remove_channel (uint32_t);
        void remove_channels ();
@@ -98,11 +106,6 @@ class Bundle : public PBD::ScopedConnectionList
        /** @return Bundle name */
        std::string name () const { return _name; }
 
-       void set_type (DataType);
-
-       /** @return Type of the ports in this Bundle. */
-       DataType type () const { return _type; }
-
        void set_ports_are_inputs ();
        void set_ports_are_outputs ();
        bool ports_are_inputs () const { return _ports_are_inputs; }
@@ -120,7 +123,7 @@ class Bundle : public PBD::ScopedConnectionList
                DirectionChanged = 0x10 ///< the direction (whether ports are inputs or outputs) has changed
        };
 
-       boost::signals2::signal<void(Change)> Changed;
+       PBD::Signal1<void,Change> Changed;
 
   protected:
 
@@ -135,7 +138,6 @@ class Bundle : public PBD::ScopedConnectionList
        void emit_changed (Change);
 
        std::string _name;
-       DataType _type;
        bool _ports_are_inputs;
 
        bool _signals_suspended;