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;
101 virtual std::string DeviceId()
const = 0;
103 bool IsEnabled()
const {
return m_enabled; }
109 bool AllowLooping()
const {
return false; }
110 bool AllowMultiPortPatching()
const {
return false; }
114 void InputPorts(std::vector<InputPort*> *ports)
const;
115 void OutputPorts(std::vector<OutputPort*> *ports)
const;
117 InputPort *GetInputPort(
unsigned int port_id)
const;
118 OutputPort *GetOutputPort(
unsigned int port_id)
const;
121 void DeleteAllPorts();
125 const std::string &request,
126 std::string *response,
130 virtual bool StartHook() {
return true; }
131 virtual void PrePortStop() {}
132 virtual void PostPortStop() {}
135 typedef std::map<unsigned int, InputPort*> input_port_map;
136 typedef std::map<unsigned int, OutputPort*> output_port_map;
141 mutable std::string m_unique_id;
142 input_port_map m_input_ports;
143 output_port_map m_output_ports;
145 template<
class PortClass>
146 bool GenericAddPort(PortClass *port,
147 std::map<unsigned int, PortClass*> *ports);
149 template <
class PortClass>
150 void GenericDeletePort(PortClass *p);
152 DISALLOW_COPY_AND_ASSIGN(
Device);
155 #endif // INCLUDE_OLAD_DEVICE_H_