1fca4971433de20c77fc747f86d0f9ed74287669
[ardour.git] / libs / ardour / ardour / session_playlists.h
1 #ifndef __ardour_session_playlists_h__
2 #define __ardour_session_playlists_h__
3
4 #include <set>
5 #include <vector>
6 #include <string>
7 #include <glibmm/thread.h>
8 #include <boost/shared_ptr.hpp>
9 #include <sigc++/trackable.h>
10
11 class XMLNode;
12
13 namespace ARDOUR {
14
15 class Playlist;
16 class Region;
17 class Source;
18 class Session;
19         
20 class SessionPlaylists : public sigc::trackable
21 {
22 public:
23         ~SessionPlaylists ();
24         
25         boost::shared_ptr<Playlist> by_name (std::string name);
26         uint32_t source_use_count (boost::shared_ptr<const Source> src) const;
27         template<class T> void foreach (T *obj, void (T::*func)(boost::shared_ptr<Playlist>));
28         void get (std::vector<boost::shared_ptr<Playlist> >&);
29         void unassigned (std::list<boost::shared_ptr<Playlist> > & list);
30
31 private:
32         friend class Session;
33         
34         bool add (boost::shared_ptr<Playlist>);
35         void remove (boost::shared_ptr<Playlist>);
36         void track (bool, boost::weak_ptr<Playlist>);
37         
38         uint32_t n_playlists() const;
39         void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result);
40         void update_after_tempo_map_change ();
41         void add_state (XMLNode *, bool);
42         bool maybe_delete_unused (sigc::signal<int, boost::shared_ptr<Playlist> >);
43         int load (Session &, const XMLNode&);
44         int load_unused (Session &, const XMLNode&);
45         boost::shared_ptr<Playlist> XMLPlaylistFactory (Session &, const XMLNode&);
46
47         mutable Glib::Mutex lock;
48         typedef std::set<boost::shared_ptr<Playlist> > List;
49         List playlists;
50         List unused_playlists;
51 };
52
53 }
54
55 #endif