Merge master.
[dcpomatic.git] / src / lib / cinema.h
1 /*
2     Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file  src/lib/cinema.h
21  *  @brief Screen and Cinema classes.
22  */
23
24 #include <boost/enable_shared_from_this.hpp>
25 #include <dcp/certificates.h>
26
27 class Cinema;
28
29 namespace cxml {
30         class Node;
31 }
32
33 /** @class Screen
34  *  @brief A representation of a Screen for KDM generation.
35  *
36  *  This is the name of the screen and the certificate of its
37  *  server.
38  */
39 class Screen
40 {
41 public:
42         Screen (std::string const & n, boost::shared_ptr<dcp::Certificate> cert)
43                 : name (n)
44                 , certificate (cert)
45         {}
46
47         Screen (boost::shared_ptr<const cxml::Node>);
48
49         void as_xml (xmlpp::Element *) const;
50         
51         boost::shared_ptr<Cinema> cinema;
52         std::string name;
53         boost::shared_ptr<dcp::Certificate> certificate;
54 };
55
56 /** @class Cinema
57  *  @brief A description of a Cinema for KDM generation.
58  *
59  *  This is a cinema name, contact email address and a list of
60  *  Screen objects.
61  */
62 class Cinema : public boost::enable_shared_from_this<Cinema>
63 {
64 public:
65         Cinema (std::string const & n, std::string const & e)
66                 : name (n)
67                 , email (e)
68         {}
69
70         Cinema (boost::shared_ptr<const cxml::Node>);
71
72         void read_screens (boost::shared_ptr<const cxml::Node>);
73
74         void as_xml (xmlpp::Element *) const;
75
76         void add_screen (boost::shared_ptr<Screen>);
77         void remove_screen (boost::shared_ptr<Screen>);
78         
79         std::string name;
80         std::string email;
81         std::list<boost::shared_ptr<Screen> > screens () const {
82                 return _screens;
83         }
84
85 private:        
86         std::list<boost::shared_ptr<Screen> > _screens;
87 };