fswatch  1.14.0
monitor_factory.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2018 Enrico M. Crisostomo
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 3, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program. If not, see <http://www.gnu.org/licenses/>.
15  */
28 #ifndef FSW__MONITOR_FACTORY_H
29 # define FSW__MONITOR_FACTORY_H
30 
31 #include "monitor.hpp"
32 #include "libfswatch_set.hpp"
33 
34 namespace fsw
35 {
57  {
58  public:
74  std::vector<std::string> paths,
75  FSW_EVENT_CALLBACK *callback,
76  void *context = nullptr);
77 
92  static monitor *create_monitor(const std::string& name,
93  std::vector<std::string> paths,
94  FSW_EVENT_CALLBACK *callback,
95  void *context = nullptr);
96 
102  static std::vector<std::string> get_types();
103 
113  static bool exists_type(const std::string& name);
114 
115  monitor_factory() = delete;
116  monitor_factory(const monitor_factory& orig) = delete;
117  monitor_factory& operator=(const monitor_factory& that) = delete;
118  private:
119  static std::map<std::string, fsw_monitor_type>& creators_by_string();
120  };
121 }
122 
123 #endif /* FSW__MONITOR_FACTORY_H */
Base class of all monitors.
Definition: monitor.hpp:146
Main namespace of libfswatch.
Definition: event.cpp:23
Header defining the default set type used by the library.
static monitor * create_monitor(fsw_monitor_type type, std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context=nullptr)
Creates a monitor of the specified type.
Definition: monitor_factory.cpp:69
static std::vector< std::string > get_types()
Get the available monitor types.
Definition: monitor_factory.cpp:153
fsw_monitor_type
Available monitors.
Definition: cmonitor.h:43
Header of the fsw::monitor class.
Object factory class for fsw::monitor instances.
Definition: monitor_factory.hpp:56
static bool exists_type(const std::string &name)
Checks whether a monitor of the type specified by name exists.
Definition: monitor_factory.cpp:146
void FSW_EVENT_CALLBACK(const std::vector< event > &, void *)
Function definition of an event callback.
Definition: monitor.hpp:60