service: add sort of servicelist including all required layers
[enigma2.git] / lib / dvb / db.h
1 #ifndef __db_h
2 #define __db_h
3
4 #include <lib/dvb/idvb.h>
5 #include <set>
6
7 class ServiceDescriptionSection;
8
9 struct eDVBBouquet
10 {
11         std::vector<eServiceReferenceDVB> m_services;
12         int lookupService(eServiceReferenceDVB &ref);
13 };
14
15 class eDVBDB: public iDVBChannelList
16 {
17 DECLARE_REF(eDVBDB);
18         friend class eDVBDBQuery;
19 private:
20         struct channel
21         {
22                 ePtr<iDVBFrontendParameters> m_frontendParameters;
23         };
24         
25         std::map<eDVBChannelID, channel> m_channels;
26         
27         std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_services;
28         
29         std::map<eServiceReference, eDVBBouquet> m_bouquets;
30 public:
31         void load();
32         void save();
33         eDVBDB();
34         virtual ~eDVBDB();
35         
36         RESULT addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters *feparm);
37         RESULT removeChannel(const eDVBChannelID &id);
38
39         RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr<iDVBFrontendParameters> &parm);
40         
41         RESULT addService(const eServiceReferenceDVB &service, eDVBService *service);
42         RESULT getService(const eServiceReferenceDVB &reference, ePtr<eDVBService> &service);
43         
44         RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *query);
45 };
46
47         // we have to add a possibility to invalidate here.
48 class eDVBDBQuery: public iDVBChannelListQuery
49 {
50 DECLARE_REF(eDVBDBQuery);
51 private:
52         std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_cursor;
53         ePtr<eDVBDB> m_db;
54         ePtr<eDVBChannelQuery> m_query;
55         eServiceReference m_source;
56 public:
57         eDVBDBQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
58         virtual RESULT getNextResult(eServiceReferenceDVB &ref);
59         
60         int compareLessEqual(const eServiceReferenceDVB &a, const eServiceReferenceDVB &b);
61 };
62
63 #endif