Open Lighting Architecture  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PluginAdaptor.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15  *
16  * PluginAdaptor.h
17  * The provides operations on a ola_device.
18  * Copyright (C) 2005 Simon Newton
19  */
20 
27 #ifndef INCLUDE_OLAD_PLUGINADAPTOR_H_
28 #define INCLUDE_OLAD_PLUGINADAPTOR_H_
29 
30 #include <ola/Callback.h>
31 #include <ola/Clock.h>
32 #include <ola/ExportMap.h>
33 #include <ola/base/Macro.h>
34 #include <ola/io/SelectServerInterface.h>
35 #include <olad/OlaServer.h>
36 
37 #include <string>
38 
39 namespace ola {
40 
42  public:
52  PluginAdaptor(class DeviceManager *device_manager,
53  ola::io::SelectServerInterface *select_server,
54  ExportMap *export_map,
55  class PreferencesFactory *preferences_factory,
56  class PortBrokerInterface *port_broker,
57  const std::string *instance_name);
58 
59  // The following methods are part of the SelectServerInterface
61 
63  bool delete_on_close = false);
64 
66 
68 
70 
72 
74  Callback0<bool> *closure);
75 
77  const TimeInterval &interval,
78  Callback0<bool> *closure);
79 
81  unsigned int ms,
82  SingleUseCallback0<void> *closure);
83 
85  const TimeInterval &interval,
86  SingleUseCallback0<void> *closure);
87 
89 
90  void Execute(ola::BaseCallback0<void> *closure);
91 
92  const TimeStamp *WakeUpTime() const;
93 
94  // These are the extra bits for the plugins
99  const std::string InstanceName();
100 
101  ExportMap *GetExportMap() const {
102  return m_export_map;
103  }
104 
110  bool RegisterDevice(class AbstractDevice *device) const;
111 
117  bool UnregisterDevice(class AbstractDevice *device) const;
118 
123  class Preferences *NewPreference(const std::string &name) const;
124  class PortBrokerInterface *GetPortBroker() const {
125  return m_port_broker;
126  }
127 
128  void DrainCallbacks();
129 
130  private:
131  DeviceManager *m_device_manager;
133  ExportMap *m_export_map;
134  class PreferencesFactory *m_preferences_factory;
135  class PortBrokerInterface *m_port_broker;
136  const std::string *m_instance_name;
137 
139 };
140 } // namespace ola
141 #endif // INCLUDE_OLAD_PLUGINADAPTOR_H_