From aa454620bff8b6c5dcd4e0e379726307ad1918da Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Jan 2007 05:00:29 +0000 Subject: Created Raul namespace. git-svn-id: http://svn.drobilla.net/lad/raul@265 a436a847-0d15-0410-975c-d299462d15a1 --- src/JackDriver.cpp | 88 ++++++++++++++++++++++++++++-------------------------- src/Namespaces.cpp | 11 +++++-- src/Path.cpp | 11 +++++-- src/RDFQuery.cpp | 11 +++++-- src/RDFWriter.cpp | 17 +++++++---- src/Thread.cpp | 11 +++++-- 6 files changed, 90 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index cd96ab7..a8ece4a 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -26,16 +26,17 @@ using std::cerr; using std::endl; using std::string; +namespace Raul { + JackDriver::JackDriver() -//: m_app(app) -: m_client(NULL) -, m_is_activated(false) -, m_xruns(0) -, m_xrun_delay(0) +: _client(NULL) +, _is_activated(false) +, _xruns(0) +, _xrun_delay(0) { - m_last_pos.frame = 0; - m_last_pos.valid = (jack_position_bits_t)0; + _last_pos.frame = 0; + _last_pos.valid = (jack_position_bits_t)0; } @@ -51,33 +52,33 @@ void JackDriver::attach(const string& client_name) { // Already connected - if (m_client) + if (_client) return; jack_set_error_function(error_cb); - m_client = jack_client_open(client_name.c_str(), JackNullOption, NULL); - if (m_client == NULL) { - //m_app->status_message("[JACK] Unable to create client"); - m_is_activated = false; + _client = jack_client_open(client_name.c_str(), JackNullOption, NULL); + if (_client == NULL) { + //_app->status_message("[JACK] Unable to create client"); + _is_activated = false; } else { jack_set_error_function(error_cb); - jack_on_shutdown(m_client, jack_shutdown_cb, this); - jack_set_port_registration_callback(m_client, jack_port_registration_cb, this); - jack_set_graph_order_callback(m_client, jack_graph_order_cb, this); - jack_set_buffer_size_callback(m_client, jack_buffer_size_cb, this); - jack_set_xrun_callback(m_client, jack_xrun_cb, this); + jack_on_shutdown(_client, jack_shutdown_cb, this); + jack_set_port_registration_callback(_client, jack_port_registration_cb, this); + jack_set_graph_order_callback(_client, jack_graph_order_cb, this); + jack_set_buffer_size_callback(_client, jack_buffer_size_cb, this); + jack_set_xrun_callback(_client, jack_xrun_cb, this); - //m_is_dirty = true; - m_buffer_size = jack_get_buffer_size(m_client); + //_is_dirty = true; + _buffer_size = jack_get_buffer_size(_client); - if (!jack_activate(m_client)) { - m_is_activated = true; + if (!jack_activate(_client)) { + _is_activated = true; //signal_attached.emit(); - //m_app->status_message("[JACK] Attached"); + //_app->status_message("[JACK] Attached"); } else { - //m_app->status_message("[JACK] ERROR: Failed to attach"); - m_is_activated = false; + //_app->status_message("[JACK] ERROR: Failed to attach"); + _is_activated = false; } } } @@ -86,11 +87,11 @@ JackDriver::attach(const string& client_name) void JackDriver::detach() { - if (m_client) { - jack_deactivate(m_client); - jack_client_close(m_client); - m_client = NULL; - m_is_activated = false; + if (_client) { + jack_deactivate(_client); + jack_client_close(_client); + _client = NULL; + _is_activated = false; //signal_detached.emit(); } } @@ -124,7 +125,7 @@ JackDriver::jack_buffer_size_cb(jack_nframes_t buffer_size, void* jack_driver) me->reset_xruns(); me->reset_delay(); me->on_buffer_size_changed(buffer_size); - me->m_buffer_size = buffer_size; + me->_buffer_size = buffer_size; return 0; } @@ -137,8 +138,8 @@ JackDriver::jack_xrun_cb(void* jack_driver) assert(me); - me->m_xruns++; - me->m_xrun_delay = jack_get_xrun_delayed_usecs(me->m_client); + me->_xruns++; + me->_xrun_delay = jack_get_xrun_delayed_usecs(me->_client); me->reset_delay(); me->on_xrun(); @@ -158,7 +159,7 @@ JackDriver::jack_shutdown_cb(void* jack_driver) me->on_shutdown(); - me->m_client = NULL; + me->_client = NULL; } @@ -172,18 +173,18 @@ JackDriver::error_cb(const char* msg) jack_nframes_t JackDriver::buffer_size() { - if (m_is_activated) - return m_buffer_size; + if (_is_activated) + return _buffer_size; else - return jack_get_buffer_size(m_client); + return jack_get_buffer_size(_client); } void JackDriver::reset_xruns() { - m_xruns = 0; - m_xrun_delay = 0; + _xruns = 0; + _xrun_delay = 0; } @@ -194,16 +195,19 @@ JackDriver::set_buffer_size(jack_nframes_t size) return true; } - if (!m_client) { - m_buffer_size = size; + if (!_client) { + _buffer_size = size; return true; } - if (jack_set_buffer_size(m_client, size)) { - //m_app->status_message("[JACK] ERROR: Unable to set buffer size"); + if (jack_set_buffer_size(_client, size)) { + //_app->status_message("[JACK] ERROR: Unable to set buffer size"); return false; } else { return true; } } + +} // namespace Raul + diff --git a/src/Namespaces.cpp b/src/Namespaces.cpp index d45d259..379644d 100644 --- a/src/Namespaces.cpp +++ b/src/Namespaces.cpp @@ -1,11 +1,11 @@ -/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. +/* This file is part of Raul. Copyright (C) 2007 Dave Robillard. * - * Ingen is free software; you can redistribute it and/or modify it under the + * Raul is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * Raul is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. * @@ -16,6 +16,8 @@ #include "raul/Namespaces.h" +namespace Raul { + /** Create a prefixed qname from @a uri, if possible. * @@ -35,3 +37,6 @@ Namespaces::qualify(std::string uri) return uri; } + +} // namespace Raul + diff --git a/src/Path.cpp b/src/Path.cpp index 59e18dd..07c5279 100644 --- a/src/Path.cpp +++ b/src/Path.cpp @@ -1,11 +1,11 @@ -/* This file is part of Ingen. Copyright (C) 2006-2007 Dave Robillard. +/* This file is part of Raul. Copyright (C) 2007-2007 Dave Robillard. * - * Ingen is free software; you can redistribute it and/or modify it under the + * Raul is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * Raul is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. * @@ -16,6 +16,8 @@ #include "raul/Path.h" +namespace Raul { + bool Path::is_valid(const std::basic_string& path) @@ -169,3 +171,6 @@ Path::is_parent_of(const Path& child) const return child.is_child_of(*this); } + +} // namespace Raul + diff --git a/src/RDFQuery.cpp b/src/RDFQuery.cpp index f92ca89..471723f 100644 --- a/src/RDFQuery.cpp +++ b/src/RDFQuery.cpp @@ -1,11 +1,11 @@ -/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. +/* This file is part of Raul. Copyright (C) 2007 Dave Robillard. * - * Ingen is free software; you can redistribute it and/or modify it under the + * Raul is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * Raul is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. * @@ -19,6 +19,8 @@ #include #include "raul/RDFQuery.h" +namespace Raul { + RDFQuery::Results RDFQuery::run(const Glib::ustring base_uri_str) const @@ -69,3 +71,6 @@ RDFQuery::run(const Glib::ustring base_uri_str) const return result; } + +} // namespace Raul + diff --git a/src/RDFWriter.cpp b/src/RDFWriter.cpp index 972286d..66b166a 100644 --- a/src/RDFWriter.cpp +++ b/src/RDFWriter.cpp @@ -1,11 +1,11 @@ -/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. +/* This file is part of Raul. Copyright (C) 2007 Dave Robillard. * - * Ingen is free software; you can redistribute it and/or modify it under the + * Raul is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * Raul is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. * @@ -19,6 +19,9 @@ #define U(x) ((const unsigned char*)(x)) +namespace Raul { + + //static const char* const RDF_LANG = "rdfxml-abbrev"; static const char* const RDF_LANG = "turtle"; @@ -44,7 +47,7 @@ RDFWriter::setup_prefixes() { assert(_serializer); - for (map::const_iterator i = _prefixes.begin(); i != _prefixes.end(); ++i) { + for (Namespaces::const_iterator i = _prefixes.begin(); i != _prefixes.end(); ++i) { raptor_serialize_set_namespace(_serializer, raptor_new_uri(U(i->second.c_str())), U(i->first.c_str())); } @@ -56,7 +59,7 @@ RDFWriter::setup_prefixes() string RDFWriter::expand_uri(const string& uri) { - for (map::const_iterator i = _prefixes.begin(); i != _prefixes.end(); ++i) + for (Namespaces::const_iterator i = _prefixes.begin(); i != _prefixes.end(); ++i) if (uri.substr(0, i->first.length()+1) == i->first + ":") return i->second + uri.substr(i->first.length()+1); @@ -216,3 +219,7 @@ RDFWriter::write(const RdfId& subject, raptor_free_uri((raptor_uri*)triple.predicate); } + + +} // namespace Raul + diff --git a/src/Thread.cpp b/src/Thread.cpp index 34ba0f9..cc024b0 100644 --- a/src/Thread.cpp +++ b/src/Thread.cpp @@ -1,11 +1,11 @@ -/* This file is part of Ingen. Copyright (C) 2007 Dave Robillard. +/* This file is part of Raul. Copyright (C) 2007 Dave Robillard. * - * Ingen is free software; you can redistribute it and/or modify it under the + * Raul is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * Raul is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. * @@ -16,6 +16,11 @@ #include "raul/Thread.h" +namespace Raul { + /* Thread-specific data key (once-only initialized) */ pthread_once_t Thread::_thread_key_once = PTHREAD_ONCE_INIT; pthread_key_t Thread::_thread_key; + +} // namespace Raul + -- cgit v1.2.1