3 Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
5 This file is part of DCP-o-matic.
7 DCP-o-matic is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 DCP-o-matic is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef DCPOMATIC_CONTENT_PART_H
23 #define DCPOMATIC_CONTENT_PART_H
26 #include "change_signaller.h"
27 #include <boost/weak_ptr.hpp>
28 #include <boost/thread/mutex.hpp>
36 explicit ContentPart (Content* parent)
43 maybe_set (T& member, T new_value, int property) const
45 ChangeSignaller<Content> cc (_parent, property);
47 boost::mutex::scoped_lock lm (_mutex);
48 if (member == new_value) {
58 maybe_set (boost::optional<T>& member, T new_value, int property) const
60 ChangeSignaller<Content> cc (_parent, property);
62 boost::mutex::scoped_lock lm (_mutex);
63 if (member && member.get() == new_value) {
72 mutable boost::mutex _mutex;