21 #ifndef INCLUDE_OLAD_DEVICE_H_
22 #define INCLUDE_OLAD_DEVICE_H_
25 #include <olad/Port.h>
52 virtual const std::string Name()
const = 0;
58 virtual std::string UniqueId()
const = 0;
61 virtual bool Stop() = 0;
64 virtual bool AllowLooping()
const = 0;
68 virtual bool AllowMultiPortPatching()
const = 0;
71 virtual void InputPorts(std::vector<InputPort*> *ports)
const = 0;
72 virtual void OutputPorts(std::vector<OutputPort*> *ports)
const = 0;
75 virtual InputPort *GetInputPort(
unsigned int port_id)
const = 0;
76 virtual OutputPort *GetOutputPort(
unsigned int port_id)
const = 0;
80 const std::string &request,
81 std::string *response,
94 const std::string Name()
const {
return m_name; }
95 void SetName(
const std::string &name) { m_name = name; }
98 std::string UniqueId()
const;
104 virtual std::string
DeviceId()
const = 0;
106 bool IsEnabled()
const {
return m_enabled; }
112 bool AllowLooping()
const {
return false; }
113 bool AllowMultiPortPatching()
const {
return false; }
117 void InputPorts(std::vector<InputPort*> *ports)
const;
118 void OutputPorts(std::vector<OutputPort*> *ports)
const;
120 InputPort *GetInputPort(
unsigned int port_id)
const;
121 OutputPort *GetOutputPort(
unsigned int port_id)
const;
124 void DeleteAllPorts();
128 const std::string &request,
129 std::string *response,
139 virtual void PrePortStop() {}
140 virtual void PostPortStop() {}
143 typedef std::map<unsigned int, InputPort*> input_port_map;
144 typedef std::map<unsigned int, OutputPort*> output_port_map;
147 AbstractPlugin *m_owner;
149 mutable std::string m_unique_id;
150 input_port_map m_input_ports;
151 output_port_map m_output_ports;
153 template<
class PortClass>
154 bool GenericAddPort(PortClass *port,
155 std::map<unsigned int, PortClass*> *ports);
157 template <
class PortClass>
158 void GenericDeletePort(PortClass *p);
160 DISALLOW_COPY_AND_ASSIGN(Device);
163 #endif // INCLUDE_OLAD_DEVICE_H_