]> git.sesse.net Git - casparcg/blob - common/filesystem/polling_filesystem_monitor.h
Improved read_fps.
[casparcg] / common / filesystem / polling_filesystem_monitor.h
1 /*\r
2 * Copyright 2013 Sveriges Television AB http://casparcg.com/\r
3 *\r
4 * This file is part of CasparCG (www.casparcg.com).\r
5 *\r
6 * CasparCG is free software: you can redistribute it and/or modify\r
7 * it under the terms of the GNU General Public License as published by\r
8 * the Free Software Foundation, either version 3 of the License, or\r
9 * (at your option) any later version.\r
10 *\r
11 * CasparCG is distributed in the hope that it will be useful,\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 * GNU General Public License for more details.\r
15 *\r
16 * You should have received a copy of the GNU General Public License\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
18 *\r
19 * Author: Helge Norberg, helge.norberg@svt.se\r
20 */\r
21 \r
22 #pragma once\r
23 \r
24 #include "filesystem_monitor.h"\r
25 \r
26 namespace boost { namespace asio {\r
27         class io_service;\r
28 }}\r
29 \r
30 namespace caspar {\r
31 \r
32 /**\r
33  * A portable filesystem monitor implementation which periodically polls the\r
34  * filesystem for changes. Will not react instantly but never misses any\r
35  * changes.\r
36  * <p>\r
37  * Will create a dedicated thread for each monitor created.\r
38  */\r
39 class polling_filesystem_monitor_factory : public filesystem_monitor_factory\r
40 {\r
41 public:\r
42         /**\r
43          * Constructor.\r
44          *\r
45          * @param scheduler            The io_service that will be used for\r
46          *                             scheduling periodic scans.\r
47          * @param scan_interval_millis The number of milliseconds between each\r
48          *                             scheduled scan. Lower values lowers the\r
49          *                             reaction time but causes more I/O.\r
50          */\r
51         polling_filesystem_monitor_factory(\r
52                         boost::asio::io_service& scheduler,\r
53                         int scan_interval_millis = 5000);\r
54         virtual ~polling_filesystem_monitor_factory();\r
55         virtual filesystem_monitor::ptr create(\r
56                         const boost::filesystem::wpath& folder_to_watch,\r
57                         filesystem_event events_of_interest_mask,\r
58                         bool report_already_existing,\r
59                         const filesystem_monitor_handler& handler,\r
60                         const initial_files_handler& initial_files_handler);\r
61 private:\r
62         struct implementation;\r
63         safe_ptr<implementation> impl_;\r
64 };\r
65 \r
66 }\r