Archive / / / / / DbPlaySource.h
2008-10-21 03:52:10 UTC
previous next
/* Echo Media Player * Copyright (C) 2008 Shane O'Connell * * [ The original file includes a copyright header in this location describing * the file as being released under the terms of the GNU General Public * License. It has been removed in order to display the file as part of the * archive. ] */ #ifndef DBPLAYSOURCE_H_ #define DBPLAYSOURCE_H_ #include "../PlaySource.h" #include "SQL.h" #include <sqlite3.h> #include <boost/array.hpp> class DbPlaySource : public ModPlaySource { public: DbPlaySource() { m_track_cache_index = -1; for (int i = 0; i < 100; i++) m_track_cache[i] = Track::create(); } TrackRef get_track(int index) const; protected: void invalidate_cache() { m_track_cache_index = -1; } mutable SQLstmt m_get_track_stmt; mutable boost::array<TrackRef, 100> m_track_cache; // TODO is this excessive for small playlists? mutable int m_track_cache_index; }; #endif /* DBPLAYSOURCE_H_ */