21 #ifndef INCLUDE_OLAD_DEVICE_H_
22 #define INCLUDE_OLAD_DEVICE_H_
25 #include <olad/Port.h>
55 virtual const string Name()
const = 0;
61 virtual string UniqueId()
const = 0;
64 virtual bool Stop() = 0;
67 virtual bool AllowLooping()
const = 0;
71 virtual bool AllowMultiPortPatching()
const = 0;
74 virtual void InputPorts(vector<InputPort*> *ports)
const = 0;
75 virtual void OutputPorts(vector<OutputPort*> *ports)
const = 0;
78 virtual InputPort *GetInputPort(
unsigned int port_id)
const = 0;
79 virtual OutputPort *GetOutputPort(
unsigned int port_id)
const = 0;
82 virtual void Configure(google::protobuf::RpcController *controller,
83 const string &request,
85 google::protobuf::Closure *done) = 0;
97 const string Name()
const {
return m_name; }
98 void SetName(
const string &name) { m_name = name; }
101 string UniqueId()
const;
104 virtual 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(vector<InputPort*> *ports)
const;
118 void OutputPorts(vector<OutputPort*> *ports)
const;
120 InputPort *GetInputPort(
unsigned int port_id)
const;
121 OutputPort *GetOutputPort(
unsigned int port_id)
const;
124 void DeleteAllPorts();
127 virtual void Configure(
class google::protobuf::RpcController *controller,
128 const string &request,
130 google::protobuf::Closure *done);
133 virtual bool StartHook() {
return true; }
134 virtual void PrePortStop() {}
135 virtual void PostPortStop() {}
138 typedef map<unsigned int, InputPort*> input_port_map;
139 typedef map<unsigned int, OutputPort*> output_port_map;
144 mutable string m_unique_id;
145 input_port_map m_input_ports;
146 output_port_map m_output_ports;
151 template<
class PortClass>
152 bool GenericAddPort(PortClass *port,
153 map<unsigned int, PortClass*> *ports);
155 template <
class PortClass>
156 void GenericDeletePort(PortClass *p);
159 #endif // INCLUDE_OLAD_DEVICE_H_