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 <boost/weak_ptr.hpp>
27 #include <boost/thread/mutex.hpp>
35 explicit ContentPart (Content* parent)
42 maybe_set (T& member, T new_value, int property) const
45 boost::mutex::scoped_lock lm (_mutex);
46 if (member == new_value) {
51 _parent->signal_changed (property);
56 maybe_set (boost::optional<T>& member, T new_value, int property) const
59 boost::mutex::scoped_lock lm (_mutex);
60 if (member && member.get() == new_value) {
65 _parent->signal_changed (property);
69 mutable boost::mutex _mutex;