13
0

NO-OP: indent & whitespace

This commit is contained in:
Robin Gareus 2020-04-03 14:56:57 +02:00
parent 3d98d13760
commit 80f3b54be4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __libardour_port_engine_shared_h__
#define __libardour_port_engine_shared_h__
#ifndef _libardour_port_engine_shared_h_
#define _libardour_port_engine_shared_h_
#include <map>
#include <set>
@ -39,36 +39,48 @@ namespace ARDOUR {
class PortEngineSharedImpl;
class PortManager;
class LIBARDOUR_API BackendPort
{
protected:
BackendPort (PortEngineSharedImpl &b, const std::string&, PortFlags);
protected:
BackendPort (PortEngineSharedImpl& b, const std::string&, PortFlags);
public:
public:
virtual ~BackendPort ();
const std::string& name () const { return _name; }
const std::string& name () const { return _name; }
const std::string& pretty_name () const { return _pretty_name; }
PortFlags flags () const { return _flags; }
int set_name (const std::string &name) { _name = name; return 0; }
int set_pretty_name (const std::string &name) { _pretty_name = name; return 0; }
int set_name (const std::string& name)
{
_name = name;
return 0;
}
int set_pretty_name (const std::string& name)
{
_pretty_name = name;
return 0;
}
virtual DataType type () const = 0;
PortFlags flags () const { return _flags; }
bool is_input () const { return flags () & IsInput; }
bool is_output () const { return flags () & IsOutput; }
bool is_physical () const { return flags () & IsPhysical; }
bool is_terminal () const { return flags () & IsTerminal; }
bool is_connected () const { return _connections.size () != 0; }
bool is_connected (const BackendPort *port) const;
bool is_connected (const BackendPort* port) const;
bool is_physically_connected () const;
const std::set<BackendPort *>& get_connections () const { return _connections; }
const std::set<BackendPort*>& get_connections () const
{
return _connections;
}
int connect (BackendPort *port);
int disconnect (BackendPort *port);
int connect (BackendPort* port);
int disconnect (BackendPort* port);
void disconnect_all ();
virtual void* get_buffer (pframes_t nframes) = 0;
@ -78,31 +90,31 @@ class LIBARDOUR_API BackendPort
return for_playback ? _playback_latency_range : _capture_latency_range;
}
void set_latency_range (const LatencyRange &latency_range, bool for_playback);
void set_latency_range (const LatencyRange& latency_range, bool for_playback);
void update_connected_latency (bool for_playback);
protected:
PortEngineSharedImpl &_backend;
protected:
PortEngineSharedImpl& _backend;
private:
std::string _name;
std::string _pretty_name;
const PortFlags _flags;
LatencyRange _capture_latency_range;
LatencyRange _playback_latency_range;
private:
std::string _name;
std::string _pretty_name;
const PortFlags _flags;
LatencyRange _capture_latency_range;
LatencyRange _playback_latency_range;
std::set<BackendPort*> _connections;
void _connect (BackendPort* , bool);
void _disconnect (BackendPort* , bool);
void _connect (BackendPort*, bool);
void _disconnect (BackendPort*, bool);
}; // class BackendPort
class LIBARDOUR_API PortEngineSharedImpl
{
public:
PortEngineSharedImpl (PortManager& mgr, std::string const & instance_name);
virtual ~PortEngineSharedImpl();
public:
PortEngineSharedImpl (PortManager& mgr, std::string const& instance_name);
virtual ~PortEngineSharedImpl ();
/* Discovering physical ports */
@ -114,10 +126,10 @@ class LIBARDOUR_API PortEngineSharedImpl
uint32_t port_name_size () const;
int set_port_name (PortEngine::PortHandle, const std::string&);
std::string get_port_name (PortEngine::PortHandle) const;
PortFlags get_port_flags (PortEngine::PortHandle) const;
PortEngine::PortHandle get_port_by_name (const std::string&) const;
int set_port_name (PortEngine::PortHandle, const std::string&);
std::string get_port_name (PortEngine::PortHandle) const;
PortFlags get_port_flags (PortEngine::PortHandle) const;
PortEngine::PortHandle get_port_by_name (const std::string&) const;
int get_port_property (PortEngine::PortHandle, const std::string& key, std::string& value, std::string& type) const;
int set_port_property (PortEngine::PortHandle, const std::string& key, const std::string& value, const std::string& type);
@ -127,13 +139,13 @@ class LIBARDOUR_API PortEngineSharedImpl
DataType port_data_type (PortEngine::PortHandle) const;
PortEngine::PortHandle register_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
virtual void unregister_port (PortEngine::PortHandle);
virtual void unregister_port (PortEngine::PortHandle);
int connect (const std::string& src, const std::string& dst);
int disconnect (const std::string& src, const std::string& dst);
int connect (PortEngine::PortHandle, const std::string&);
int disconnect (PortEngine::PortHandle, const std::string&);
int disconnect_all (PortEngine::PortHandle);
int connect (const std::string& src, const std::string& dst);
int disconnect (const std::string& src, const std::string& dst);
int connect (PortEngine::PortHandle, const std::string&);
int disconnect (PortEngine::PortHandle, const std::string&);
int disconnect_all (PortEngine::PortHandle);
bool connected (PortEngine::PortHandle, bool process_callback_safe);
bool connected_to (PortEngine::PortHandle, const std::string&, bool process_callback_safe);
@ -143,49 +155,50 @@ class LIBARDOUR_API PortEngineSharedImpl
virtual void port_connect_callback (const std::string& a, const std::string& b, bool conn) = 0;
virtual void port_connect_add_remove_callback () = 0;
protected:
protected:
std::string _instance_name;
std::vector<BackendPort *> _system_inputs;
std::vector<BackendPort *> _system_outputs;
std::vector<BackendPort *> _system_midi_in;
std::vector<BackendPort *> _system_midi_out;
std::vector<BackendPort*> _system_inputs;
std::vector<BackendPort*> _system_outputs;
std::vector<BackendPort*> _system_midi_in;
std::vector<BackendPort*> _system_midi_out;
void clear_ports ();
PortEngine::PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
void unregister_ports (bool system_only = false);
void unregister_ports (bool system_only = false);
struct SortByPortName
{
bool operator ()(const BackendPort* lhs, const BackendPort* rhs) const
struct SortByPortName {
bool operator() (const BackendPort* lhs, const BackendPort* rhs) const
{
return PBD::naturally_less (lhs->name ().c_str (), rhs->name ().c_str ());
}
};
typedef std::map<std::string, BackendPort *> PortMap; // fast lookup in _ports
typedef std::set<BackendPort *, SortByPortName> PortIndex; // fast lookup in _ports
SerializedRCUManager<PortMap> _portmap;
SerializedRCUManager<PortIndex> _ports;
typedef std::map<std::string, BackendPort*> PortMap; // fast lookup in _ports
typedef std::set<BackendPort*, SortByPortName> PortIndex; // fast lookup in _ports
SerializedRCUManager<PortMap> _portmap;
SerializedRCUManager<PortIndex> _ports;
bool valid_port (PortEngine::PortHandle port) const {
boost::shared_ptr<PortIndex> p = _ports.reader();
return std::find (p->begin(), p->end(), static_cast<BackendPort*>(port)) != p->end ();
bool valid_port (PortEngine::PortHandle port) const
{
boost::shared_ptr<PortIndex> p = _ports.reader ();
return std::find (p->begin (), p->end (), static_cast<BackendPort*> (port)) != p->end ();
}
BackendPort* find_port (const std::string& port_name) const {
boost::shared_ptr<PortMap> p = _portmap.reader();
PortMap::const_iterator it = p->find (port_name);
if (it == p->end()) {
return NULL;
}
return (*it).second;
BackendPort* find_port (const std::string& port_name) const
{
boost::shared_ptr<PortMap> p = _portmap.reader ();
PortMap::const_iterator it = p->find (port_name);
if (it == p->end ()) {
return NULL;
}
return (*it).second;
}
virtual BackendPort* port_factory (std::string const & name, ARDOUR::DataType dt, ARDOUR::PortFlags flags) = 0;
virtual BackendPort* port_factory (std::string const& name, ARDOUR::DataType dt, ARDOUR::PortFlags flags) = 0;
};
} /* namespace ARDOUR */
#endif /* __libardour_port_engine_shared_h__ */
#endif