Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
PortManager.h
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 * PortManager.h
17 * Provides a unified interface for controlling port patchings & priorities.
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef OLAD_PLUGIN_API_PORTMANAGER_H_
22#define OLAD_PLUGIN_API_PORTMANAGER_H_
23
24#include <vector>
25#include "olad/Device.h"
26#include "olad/PortBroker.h"
27#include "olad/plugin_api/DeviceManager.h"
28#include "olad/plugin_api/UniverseStore.h"
29#include "ola/base/Macro.h"
30
31
32namespace ola {
33
38 public:
44 PortManager(UniverseStore *universe_store,
45 PortBroker *broker)
46 : m_universe_store(universe_store),
47 m_broker(broker) {
48 }
49
54
61 bool PatchPort(InputPort *port, unsigned int universe);
62
69 bool PatchPort(OutputPort *port, unsigned int universe);
70
76 bool UnPatchPort(InputPort *port);
77
83 bool UnPatchPort(OutputPort *port);
84
89 bool SetPriorityInherit(Port *port);
90
96 bool SetPriorityStatic(Port *port, uint8_t value);
97
98 private:
99 template<class PortClass>
100 bool GenericPatchPort(PortClass *port,
101 unsigned int new_universe_id);
102
103 template<class PortClass>
104 bool GenericUnPatchPort(PortClass *port);
105
106 template<class PortClass>
107 bool CheckLooping(const AbstractDevice *device,
108 unsigned int new_universe_id) const;
109
110 template<class PortClass>
111 bool CheckMultiPort(const AbstractDevice *device,
112 unsigned int new_universe_id) const;
113
118 bool CheckInputPortsForUniverse(const AbstractDevice *device,
119 unsigned int universe_id) const;
120
125 bool CheckOutputPortsForUniverse(const AbstractDevice *device,
126 unsigned int universe_id) const;
127
132 template<class PortClass>
133 bool CheckForPortMatchingUniverse(const std::vector<PortClass*> &ports,
134 unsigned int universe_id) const;
135
136 UniverseStore * const m_universe_store;
137 PortBroker *m_broker;
138
139 PortManager(const PortManager &) = delete;
140 const PortManager &operator=(const PortManager &) = delete;
141};
142} // namespace ola
143#endif // OLAD_PLUGIN_API_PORTMANAGER_H_
Helper macros.
Definition Device.h:44
A port that receives DMX512 data.
Definition Port.h:137
A port that sends DMX512 data.
Definition Port.h:163
Definition PortBroker.h:53
The base port class.
Definition Port.h:49
Responsible for performing Port operations.
Definition PortManager.h:37
bool PatchPort(InputPort *port, unsigned int universe)
Patch an InputPort to a universe.
Definition PortManager.cpp:32
~PortManager()
Destructor.
Definition PortManager.h:53
PortManager(UniverseStore *universe_store, PortBroker *broker)
Create a new PortManager.
Definition PortManager.h:44
bool SetPriorityInherit(Port *port)
Set a port to 'inherit' priority mode.
Definition PortManager.cpp:50
bool SetPriorityStatic(Port *port, uint8_t value)
Set a port to 'override' priority mode.
Definition PortManager.cpp:61
bool UnPatchPort(InputPort *port)
UnPatch an InputPort.
Definition PortManager.cpp:42
Maintains a collection of Universe objects.
Definition UniverseStore.h:39
The namespace containing all OLA symbols.
Definition Credentials.cpp:44