switch Route::fed_by from shared_ptr to weak_ptr and thus begin to allow Route destru...
[ardour.git] / libs / ardour / ardour / bundle.h
index 77d5e231960bfdb0cda7385094b3e99d2df1748b..1af7a3bad0e979bf07ae1fc0442317e9667ba7d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2002-2007 Paul Davis 
+    Copyright (C) 2002-2007 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -29,8 +29,8 @@
 
 namespace ARDOUR {
 
-class AudioEngine;     
-  
+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.
  *  Intended for grouping things like, for example, a buss' outputs.
@@ -52,7 +52,7 @@ class Bundle : public sigc::trackable
                bool operator== (Channel const &o) const {
                        return name == o.name && ports == o.ports;
                }
-               
+
                std::string name;
                PortList ports;
        };
@@ -61,7 +61,7 @@ class Bundle : public sigc::trackable
        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 */
@@ -88,28 +88,21 @@ class Bundle : public sigc::trackable
        void add_channels_from_bundle (boost::shared_ptr<Bundle>);
        void connect (boost::shared_ptr<Bundle>, AudioEngine &);
        void disconnect (boost::shared_ptr<Bundle>, AudioEngine &);
+       bool connected_to (boost::shared_ptr<Bundle>, AudioEngine &);
+       bool has_same_ports (boost::shared_ptr<Bundle>) const;
 
-       /** Set the name.
-        *  @param n New name.
-        */
-       void set_name (std::string const & n) {
-               _name = n;
-               Changed (NameChanged);
-       }
+       void set_name (std::string const &);
 
        /** @return Bundle name */
        std::string name () const { return _name; }
 
-       /** Set the type of the ports in this Bundle.
-        *  @param t New type.
-        */
-       void set_type (DataType t) { _type = t; }
+       void set_type (DataType);
 
        /** @return Type of the ports in this Bundle. */
        DataType type () const { return _type; }
 
-       void set_ports_are_inputs () { _ports_are_inputs = true; }
-       void set_ports_are_outputs () { _ports_are_inputs = false; }
+       void set_ports_are_inputs ();
+       void set_ports_are_outputs ();
        bool ports_are_inputs () const { return _ports_are_inputs; }
        bool ports_are_outputs () const { return !_ports_are_inputs; }
 
@@ -120,13 +113,15 @@ class Bundle : public sigc::trackable
        enum Change {
                NameChanged = 0x1, ///< the bundle name or a channel name has changed
                ConfigurationChanged = 0x2, ///< the number of channels has changed
-               PortsChanged = 0x4 ///< the port list associated with one of our channels has changed
+               PortsChanged = 0x4, ///< the port list associated with one of our channels has changed
+               TypeChanged = 0x8, ///< the data type has changed
+               DirectionChanged = 0x10 ///< the direction (whether ports are inputs or outputs) has changed
        };
 
        sigc::signal<void, Change> Changed;
 
   protected:
-       
+
        /// mutex for _channel_ports and _channel_names
        /// XXX: is this necessary?
        mutable Glib::Mutex _channel_mutex;
@@ -136,7 +131,7 @@ class Bundle : public sigc::trackable
        int set_channels (std::string const &);
        int parse_io_string (std::string const &, std::vector<std::string> &);
        void emit_changed (Change);
-       
+
        std::string _name;
        DataType _type;
        bool _ports_are_inputs;
@@ -150,14 +145,14 @@ class Bundle : public sigc::trackable
 struct BundleChannel
 {
        BundleChannel () : channel (0) {}
-       
+
        BundleChannel (boost::shared_ptr<Bundle> b, uint32_t c)
                : bundle (b), channel (c) {}
-       
+
        bool operator== (BundleChannel const& other) const {
                return bundle == other.bundle && channel == other.channel;
        }
-       
+
        bool operator!= (BundleChannel const& other) const {
                return bundle != other.bundle || channel != other.channel;
        }
@@ -165,7 +160,7 @@ struct BundleChannel
        boost::shared_ptr<Bundle> bundle;
        uint32_t channel;
 };
-       
+
 }
 
 #endif /* __ardour_bundle_h__ */