2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Helge Norberg, helge.norberg@svt.se
24 #include "filesystem_monitor.h"
26 #include <boost/asio.hpp>
31 * A portable filesystem monitor implementation which periodically polls the
32 * filesystem for changes. Will not react instantly but never misses any
35 * Will create a dedicated thread for each monitor created.
37 class polling_filesystem_monitor_factory : public filesystem_monitor_factory
43 * @param scheduler The io_service that will be used for
44 * scheduling periodic scans.
45 * @param scan_interval_millis The number of milliseconds between each
46 * scheduled scan. Lower values lowers the reaction
47 * time but causes more I/O.
49 polling_filesystem_monitor_factory(
50 std::shared_ptr<boost::asio::io_service> scheduler,
51 int scan_interval_millis = 5000);
52 virtual ~polling_filesystem_monitor_factory();
53 virtual filesystem_monitor::ptr create(
54 const boost::filesystem::path& folder_to_watch,
55 filesystem_event events_of_interest_mask,
56 bool report_already_existing,
57 const filesystem_monitor_handler& handler,
58 const initial_files_handler& initial_files_handler);
61 spl::unique_ptr<impl> impl_;