diff options
author | David Robillard <d@drobilla.net> | 2009-05-13 16:04:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-13 16:04:14 +0000 |
commit | c0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04 (patch) | |
tree | c559879d17437adfb1aae4fb5fb40bbe6ac2f983 /raul | |
parent | f60b59b49df6bc298755d49e97bc329b6d6030a1 (diff) | |
download | raul-c0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04.tar.gz raul-c0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04.tar.bz2 raul-c0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04.zip |
Strip trailing whitespace.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@1999 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul')
36 files changed, 287 insertions, 287 deletions
diff --git a/raul/Array.hpp b/raul/Array.hpp index 62a7622..1094f53 100644 --- a/raul/Array.hpp +++ b/raul/Array.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -26,7 +26,7 @@ namespace Raul { /** An array. - * + * * Has a stack-like push_back(), but is NOT a resizeable array (the size given * to the constructor or alloc method is the maximum number of elements which * can be pushed). @@ -39,7 +39,7 @@ public: if (size > 0) _elems = new T[size]; } - + Array(size_t size, T initial_value) : _size(size), _top(0), _elems(NULL) { if (size > 0) { _elems = new T[size]; @@ -47,7 +47,7 @@ public: _elems[i] = initial_value; } } - + Array(size_t size, const Array<T>& contents) : _size(size), _top(size+1) { _elems = new T[size]; if (size <= contents.size()) @@ -62,17 +62,17 @@ public: void alloc(size_t num_elems) { assert(num_elems > 0); - + delete[] _elems; _size = num_elems; _top = 0; - + _elems = new T[num_elems]; } - + void alloc(size_t num_elems, T initial_value) { assert(num_elems > 0); - + delete[] _elems; _size = num_elems; _top = 0; @@ -81,16 +81,16 @@ public: for (size_t i=0; i < _size; ++i) _elems[i] = initial_value; } - + void push_back(T n) { assert(_top < _size); _elems[_top++] = n; } - + inline size_t size() const { return _size; } inline T& operator[](size_t i) const { assert(i < _size); return _elems[i]; } - + inline T& at(size_t i) const { assert(i < _size); return _elems[i]; } private: diff --git a/raul/Atom.hpp b/raul/Atom.hpp index 44b4b0c..e6c8ce6 100644 --- a/raul/Atom.hpp +++ b/raul/Atom.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -51,9 +51,9 @@ public: Atom(float val) : _type(FLOAT), _float_val(val) {} Atom(bool val) : _type(BOOL), _bool_val(val) {} Atom(const char* val) : _type(STRING), _string_val(strdup(val)) {} - + Atom(Type t, const std::string& val) : _type(t), _string_val(strdup(val.c_str())) {} - + Atom(const char* type_uri, size_t size, void* val) : _type(BLOB) { _blob_type_length = strlen(type_uri) + 1; // + 1 for \0 _blob_size = size; @@ -86,7 +86,7 @@ public: break; } } - + Atom& operator=(const Atom& other) { if (_type == BLOB) free(_blob_val); @@ -127,7 +127,7 @@ public: } inline bool operator!=(const Atom& other) const { return ! operator==(other); } - + inline bool operator<(const Atom& other) const { if (_type == other.type()) { switch (_type) { @@ -155,7 +155,7 @@ public: } return 0; } - + inline bool is_valid() const { return (_type != NIL); } /** Type of this atom. Always check this before attempting to get the @@ -168,13 +168,13 @@ public: inline bool get_bool() const { assert(_type == BOOL); return _bool_val; } inline const char* get_string() const { assert(_type == STRING); return _string_val; } inline const char* get_uri() const { assert(_type == URI); return _string_val; } - + inline const char* get_blob_type() const { assert(_type == BLOB); return (const char*)_blob_val; } inline const void* get_blob() const { assert(_type == BLOB); return (const char*)_blob_val + _blob_type_length; } private: Type _type; - + union { int32_t _int_val; float _float_val; diff --git a/raul/AtomLiblo.hpp b/raul/AtomLiblo.hpp index 677c7d4..882169d 100644 --- a/raul/AtomLiblo.hpp +++ b/raul/AtomLiblo.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/AtomRDF.hpp b/raul/AtomRDF.hpp index 18073a9..d3b4148 100644 --- a/raul/AtomRDF.hpp +++ b/raul/AtomRDF.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -41,7 +41,7 @@ namespace AtomRDF { inline Atom node_to_atom(const Redland::Node& node) { - if (node.is_bool()) + if (node.is_bool()) return Atom(bool(node.to_bool())); else if (node.is_resource()) return Atom(Atom::URI, node.to_c_string()); @@ -104,7 +104,7 @@ atom_to_node(Redland::World& world, const Atom& atom) //std::cerr << "WARNING: Unserializable Atom!" << std::endl; break; } - + if (!node && str != "") node = librdf_new_node_from_typed_literal(world.world(), CUC(str.c_str()), NULL, type); diff --git a/raul/AtomicInt.hpp b/raul/AtomicInt.hpp index a07ec3c..7fa5a8c 100644 --- a/raul/AtomicInt.hpp +++ b/raul/AtomicInt.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -25,13 +25,13 @@ namespace Raul { class AtomicInt { public: - + inline AtomicInt(int val) { g_atomic_int_set(static_cast<volatile gint*>(&_val), (gint)val); } inline AtomicInt(const AtomicInt& copy) { g_atomic_int_set(static_cast<volatile gint*>(&_val), (gint)copy.get()); } - + inline int get() const { return g_atomic_int_get(static_cast<volatile gint*>(&_val)); } @@ -40,10 +40,10 @@ public: inline void operator+=(int val) { g_atomic_int_add(static_cast<volatile gint*>(&_val), (gint)val); } - + inline void operator-=(int val) { g_atomic_int_add(static_cast<volatile gint*>(&_val), (gint)-val); } - + inline bool operator==(int val) const { return get() == val; } @@ -52,10 +52,10 @@ public: inline AtomicInt& operator++() // prefix { g_atomic_int_inc(static_cast<volatile gint*>(&_val)); return *this; } - + inline AtomicInt& operator--() // prefix { g_atomic_int_add(static_cast<volatile gint*>(&_val), -1); return *this; } - + /** Set value to @a val iff current value is @a old. * @return true iff set succeeded. */ diff --git a/raul/AtomicPtr.hpp b/raul/AtomicPtr.hpp index 3a5ddcd..51f7a83 100644 --- a/raul/AtomicPtr.hpp +++ b/raul/AtomicPtr.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/Command.hpp b/raul/Command.hpp index 5350852..819ef27 100644 --- a/raul/Command.hpp +++ b/raul/Command.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/Deletable.hpp b/raul/Deletable.hpp index 6431c36..227378e 100644 --- a/raul/Deletable.hpp +++ b/raul/Deletable.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/DoubleBuffer.hpp b/raul/DoubleBuffer.hpp index 3d02730..9abcbec 100644 --- a/raul/DoubleBuffer.hpp +++ b/raul/DoubleBuffer.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -35,14 +35,14 @@ namespace Raul { template<typename T> class DoubleBuffer { public: - + inline DoubleBuffer(T val) : _state(RAUL_DB_READ_WRITE) { _vals[0] = val; _read_val = &_vals[0]; } - + inline DoubleBuffer(const DoubleBuffer& copy) : _state(RAUL_DB_READ_WRITE) { diff --git a/raul/EventRingBuffer.hpp b/raul/EventRingBuffer.hpp index b065dae..334f00e 100644 --- a/raul/EventRingBuffer.hpp +++ b/raul/EventRingBuffer.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/List.hpp b/raul/List.hpp index a3f63a2..28309df 100644 --- a/raul/List.hpp +++ b/raul/List.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -29,7 +29,7 @@ namespace Raul { /** A realtime safe, (partially) thread safe doubly-linked list. - * + * * Elements can be added safely while another thread is reading the list. * Like a typical ringbuffer, this is single-reader single-writer threadsafe * only. See documentation for specific functions for specifics. @@ -38,7 +38,7 @@ template <typename T> class List : public Raul::Deletable, public boost::noncopyable { public: - + /** A node in a List. * * This is exposed so the user can allocate Nodes in different thread @@ -54,14 +54,14 @@ public: Node(const typename List<Y>::Node& copy) : _elem(copy._elem), _prev(copy._prev), _next(copy._next) {} - + Node* prev() const { return _prev.get(); } void prev(Node* ln) { _prev = ln; } Node* next() const { return _next.get(); } void next(Node* ln) { _next = ln; } T& elem() { return _elem;} const T& elem() const { return _elem; } - + private: T _elem; AtomicPtr<Node> _prev; @@ -79,7 +79,7 @@ public: _end_iter._listnode = NULL; _const_end_iter._listnode = NULL; } - + ~List(); void push_back(Node* elem); ///< Realtime Safe @@ -111,12 +111,12 @@ public: inline bool operator!=(const iterator& iter) const; inline bool operator==(const const_iterator& iter) const; inline bool operator==(const iterator& iter) const; - + inline typename List<T>::Node* node() { return _listnode; } inline const typename List<T>::Node* node() const { return _listnode; } friend class List<T>; - + private: const List<T>* _list; const typename List<T>::Node* _listnode; @@ -135,7 +135,7 @@ public: inline bool operator!=(const const_iterator& iter) const; inline bool operator==(const iterator& iter) const; inline bool operator==(const const_iterator& iter) const; - + friend class List<T>; friend class List<T>::const_iterator; @@ -145,7 +145,7 @@ public: }; void chop_front(List<T>& front, size_t front_size, Node* new_head); - + Node* erase(const iterator iter); iterator find(const T& val); diff --git a/raul/ListImpl.hpp b/raul/ListImpl.hpp index 24fc761..30d1cbf 100644 --- a/raul/ListImpl.hpp +++ b/raul/ListImpl.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -63,7 +63,7 @@ List<T>::push_back(Node* const ln) assert(ln); ln->next(NULL); - + if ( ! _head.get()) { // empty ln->prev(NULL); _tail = ln; @@ -91,7 +91,7 @@ List<T>::push_back(T& elem) assert(ln); ln->next(NULL); - + if ( ! _head.get()) { // empty ln->prev(NULL); _tail = ln; @@ -122,7 +122,7 @@ List<T>::append(List<T>& list) Node* const my_tail = _tail.get(); Node* const other_head = list._head.get(); Node* const other_tail = list._tail.get(); - + assert((my_head && my_tail) || (!my_head && !my_tail)); assert((other_head && other_tail) || (!other_head && !other_tail)); @@ -132,7 +132,7 @@ List<T>::append(List<T>& list) _tail = other_tail; _size = list._size; } else if (other_head != NULL && other_tail != NULL) { - + other_head->prev(my_tail); // FIXME: atomicity an issue? _size < true size is probably fine... @@ -167,7 +167,7 @@ List<T>::find(const T& val) /** Remove an element from the list using an iterator. - * + * * This function is realtime safe - it is the caller's responsibility to * delete the returned Node, or there will be a leak. * Thread safe (safe to call while another thread reads the list). @@ -178,7 +178,7 @@ typename List<T>::Node* List<T>::erase(const iterator iter) { Node* const n = iter._listnode; - + if (n) { Node* const prev = n->prev(); Node* const next = n->next(); @@ -196,7 +196,7 @@ List<T>::erase(const iterator iter) if (next) n->next()->prev(prev); - + --_size; } @@ -313,7 +313,7 @@ List<T>::begin() typename List<T>::iterator iter(this); iter._listnode = _head.get(); - + return iter; } @@ -340,7 +340,7 @@ List<T>::const_iterator::const_iterator(const List<T>* const list) template <typename T> const T& -List<T>::const_iterator::operator*() +List<T>::const_iterator::operator*() { assert(_listnode); return _listnode->elem(); @@ -349,7 +349,7 @@ List<T>::const_iterator::operator*() template <typename T> const T* -List<T>::const_iterator::operator->() +List<T>::const_iterator::operator->() { assert(_listnode); return &_listnode->elem(); diff --git a/raul/MIDISink.hpp b/raul/MIDISink.hpp index 434dd82..47ccf46 100644 --- a/raul/MIDISink.hpp +++ b/raul/MIDISink.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/Maid.hpp b/raul/Maid.hpp index e485b50..cc3092a 100644 --- a/raul/Maid.hpp +++ b/raul/Maid.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -58,13 +58,13 @@ public: } void manage(SharedPtr<Raul::Deletable> ptr); - + void cleanup(); - + private: typedef Raul::SRSWQueue<Raul::Deletable*> Objects; typedef Raul::List<SharedPtr<Raul::Deletable> > Managed; - + Objects _objects; Managed _managed; }; diff --git a/raul/Path.hpp b/raul/Path.hpp index 33e3936..5ff2e3d 100644 --- a/raul/Path.hpp +++ b/raul/Path.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -29,14 +29,14 @@ namespace Raul { - + /** Simple wrapper around standard string with useful path-specific methods. * * This enforces that a Path is a valid OSC path (though it is used for * GraphObject paths, which aren't directly OSC paths but a portion of one). * * A path is divided by slashes (/). The first character MUST be a slash, and - * the last character MUST NOT be a slash (except in the special case of the + * the last character MUST NOT be a slash (except in the special case of the * root path "/", which is the only valid single-character path). * * Valid characters are the 95 printable ASCII characters (32-126), excluding: @@ -74,7 +74,7 @@ public: if (!is_valid(str())) throw BadPath(str()); } - + /** Construct a Path from a C string. * * It is a fatal error to construct a Path from an invalid string, @@ -86,9 +86,9 @@ public: if (!is_valid(str())) throw BadPath(str()); } - + static bool is_valid(const std::basic_string<char>& path); - + static bool is_valid_name(const std::basic_string<char>& name) { return name.length() > 0 && name.find("/") == std::string::npos && is_valid(std::string("/").append(name)); @@ -98,12 +98,12 @@ public: static std::string nameify(const std::basic_string<char>& str); static void replace_invalid_chars(std::string& str, size_t start, bool replace_slash = false); - + bool is_root() const { return str() == root_uri; } bool is_child_of(const Path& parent) const; bool is_parent_of(const Path& child) const; - + Path child(const std::string& s) const { if (is_valid(s)) return std::string(base()) + Path(s).chop_scheme().substr(1); @@ -112,7 +112,7 @@ public: } Path operator+(const Path& p) const { return child(p); } - + /** Return the name of this object (everything after the last '/'). * This is the "method name" for OSC paths. * The empty string may be returned (if the path is "/"). @@ -123,8 +123,8 @@ public: else return substr(find_last_of("/")+1); } - - + + /** Return the name of this object (everything after the last '/'). * This is the "method name" for OSC paths. * Note it is illegal to call this method on the path "/". @@ -132,8 +132,8 @@ public: inline Symbol symbol() const { return substr(find_last_of("/")+1); } - - + + /** Return the parent's path. * * Calling this on the path "/" will return "/". @@ -147,7 +147,7 @@ public: return (last_slash == prefix_len) ? root_uri : substr(0, last_slash); } } - + /** Return path relative to some base path (chop prefix) */ diff --git a/raul/PathTable.hpp b/raul/PathTable.hpp index f7ff916..d3a97b8 100644 --- a/raul/PathTable.hpp +++ b/raul/PathTable.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -36,9 +36,9 @@ public: { return find_range_end(parent, &Path::descendant_comparator); } - + typename Table<Path, T>::const_iterator find_descendants_end( - typename Table<Path, T>::const_iterator parent) const + typename Table<Path, T>::const_iterator parent) const { return find_range_end(parent, &Path::descendant_comparator); } diff --git a/raul/Process.hpp b/raul/Process.hpp index 8827a9e..379e432 100644 --- a/raul/Process.hpp +++ b/raul/Process.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -75,7 +75,7 @@ public: _exit (-1); /* exit the child process here */ - default: + default: _exit (0); } } diff --git a/raul/Quantizer.hpp b/raul/Quantizer.hpp index 2295ceb..faebd5e 100644 --- a/raul/Quantizer.hpp +++ b/raul/Quantizer.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -33,7 +33,7 @@ public: const double td = t.to_double(); return TimeStamp(t.unit(), (qd > 0) ? lrint(td / qd) * qd : td); } - + inline static double quantize(double q, double t) { return (q > 0) ? lrint(t / q) * q diff --git a/raul/RingBuffer.hpp b/raul/RingBuffer.hpp index 6f7dcb3..3cab1ca 100644 --- a/raul/RingBuffer.hpp +++ b/raul/RingBuffer.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007-2008 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -44,7 +44,7 @@ public: assert(read_space() == 0); assert(write_space() == size - 1); } - + virtual ~RingBuffer() { delete[] _buf; } @@ -60,7 +60,7 @@ public: size_t write_space() const { const size_t w = g_atomic_int_get(&_write_ptr); const size_t r = g_atomic_int_get(&_read_ptr); - + if (w > r) { return ((r - w + _size) % _size) - 1; } else if (w < r) { @@ -69,11 +69,11 @@ public: return _size - 1; } } - + size_t read_space() const { const size_t w = g_atomic_int_get(&_write_ptr); const size_t r = g_atomic_int_get(&_read_ptr); - + if (w > r) { return w - r; } else { @@ -90,13 +90,13 @@ public: bool full_read(size_t size, T* dst); bool skip(size_t size); - + void write(size_t size, const T* src); protected: mutable int _write_ptr; mutable int _read_ptr; - + size_t _size; ///< Size (capacity) in bytes T* _buf; ///< size, event, size, event... }; @@ -105,7 +105,7 @@ protected: /** Peek at the ringbuffer (read w/o advancing read pointer). * * Note that a full read may not be done if the data wraps around. - * Caller must check return value and call again if necessary, or use the + * Caller must check return value and call again if necessary, or use the * full_peek method which does this automatically. */ template<typename T> @@ -117,7 +117,7 @@ RingBuffer<T>::peek(size_t size, T* dst) const size_t read_size = (priv_read_ptr + size < _size) ? size : _size - priv_read_ptr; - + memcpy(dst, &_buf[priv_read_ptr], read_size); return read_size; @@ -133,7 +133,7 @@ RingBuffer<T>::full_peek(size_t size, T* dst) } const size_t read_size = peek(size, dst); - + if (read_size < size) { peek(size - read_size, dst + read_size); } @@ -145,7 +145,7 @@ RingBuffer<T>::full_peek(size_t size, T* dst) /** Read from the ringbuffer. * * Note that a full read may not be done if the data wraps around. - * Caller must check return value and call again if necessary, or use the + * Caller must check return value and call again if necessary, or use the * full_read method which does this automatically. */ template<typename T> @@ -157,9 +157,9 @@ RingBuffer<T>::read(size_t size, T* dst) const size_t read_size = (priv_read_ptr + size < _size) ? size : _size - priv_read_ptr; - + memcpy(dst, &_buf[priv_read_ptr], read_size); - + g_atomic_int_set(&_read_ptr, (priv_read_ptr + read_size) % _size); return read_size; @@ -175,7 +175,7 @@ RingBuffer<T>::full_read(size_t size, T* dst) } const size_t read_size = read(size, dst); - + if (read_size < size) { read(size - read_size, dst + read_size); } @@ -192,7 +192,7 @@ RingBuffer<T>::skip(size_t size) std::cerr << "WARNING: Attempt to skip past end of MIDI ring buffer" << std::endl; return false; } - + const size_t priv_read_ptr = g_atomic_int_get(&_read_ptr); g_atomic_int_set(&_read_ptr, (priv_read_ptr + size) % _size); @@ -205,7 +205,7 @@ inline void RingBuffer<T>::write(size_t size, const T* src) { const size_t priv_write_ptr = g_atomic_int_get(&_write_ptr); - + if (priv_write_ptr + size <= _size) { memcpy(&_buf[priv_write_ptr], src, size); g_atomic_int_set(&_write_ptr, (priv_write_ptr + size) % _size); @@ -219,7 +219,7 @@ RingBuffer<T>::write(size_t size, const T* src) } } - + } // namespace Raul #endif // RAUL_RING_BUFFER_HPP diff --git a/raul/SMFReader.hpp b/raul/SMFReader.hpp index b554368..e0852ff 100644 --- a/raul/SMFReader.hpp +++ b/raul/SMFReader.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -58,9 +58,9 @@ public: uint32_t* ev_size, uint32_t* ev_delta_time) throw (std::logic_error, PrematureEOF, CorruptFile); - + void close(); - + static uint32_t read_var_len(FILE* fd) throw (PrematureEOF); protected: diff --git a/raul/SMFWriter.hpp b/raul/SMFWriter.hpp index ec29abf..e8f601e 100644 --- a/raul/SMFWriter.hpp +++ b/raul/SMFWriter.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/SRMWQueue.hpp b/raul/SRMWQueue.hpp index 631fcc5..a4b0532 100644 --- a/raul/SRMWQueue.hpp +++ b/raul/SRMWQueue.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -34,7 +34,7 @@ namespace Raul { * data into this queue for a single thread to consume. * * The interface is intentionally as similar to std::queue as possible, but - * note the additional thread restrictions imposed (e.g. empty() is only + * note the additional thread restrictions imposed (e.g. empty() is only * legal to call in the read thread). * * Obey the threading restrictions documented here, or horrible nasty (possibly @@ -54,35 +54,35 @@ class SRMWQueue : boost::noncopyable public: SRMWQueue(size_t size); ~SRMWQueue(); - + // Any thread: - + inline size_t capacity() const { return _size-1; } - + // Write thread(s): inline bool full() const; inline bool push(const T& obj); - + // Read thread: - + inline bool empty() const; inline T& front() const; inline void pop(); - + private: // Note that _front doesn't need to be an AtomicInt since it's only accessed // by the (single) reader thread - + unsigned _front; ///< Circular index of element at front of queue (READER ONLY) AtomicInt _back; ///< Circular index 1 past element at back of queue (WRITERS ONLY) AtomicInt _write_space; ///< Remaining free space for new elements (all threads) const unsigned _size; ///< Size of @ref _objects (you can store _size-1 objects) - + T* const _objects; ///< Fixed array containing queued elements AtomicInt* const _valid; ///< Parallel array to _objects, whether loc is written or not }; @@ -145,7 +145,7 @@ SRMWQueue<T>::push(const T& elem) * really isn't designed to be filled... */ if (already_full) { - + /* if multiple threads simultaneously get here, _write_space may be 0 * or negative. The next call to pop() will set _write_space back to * a sane value. Note that _write_space is not exposed, so this is okay @@ -154,14 +154,14 @@ SRMWQueue<T>::push(const T& elem) return false; } else { - + // Note: _size must be a power of 2 for this to not explode when _back overflows const unsigned write_index = (unsigned)_back.exchange_and_add(1) % _size; - + assert(_valid[write_index] == 0); _objects[write_index] = elem; ++(_valid[write_index]); - + return true; } diff --git a/raul/SRSWQueue.hpp b/raul/SRSWQueue.hpp index 572da2e..f33ebae 100644 --- a/raul/SRSWQueue.hpp +++ b/raul/SRSWQueue.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -28,7 +28,7 @@ namespace Raul { /** Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer) * - * Implemented as a dequeue in a fixed array. This is read/write thread-safe, + * Implemented as a dequeue in a fixed array. This is read/write thread-safe, * pushing and popping may occur simultaneously by seperate threads, but * the push and pop operations themselves are not thread-safe (ie. there can * be at most 1 read and at most 1 writer thread). @@ -41,24 +41,24 @@ class SRSWQueue : boost::noncopyable public: SRSWQueue(size_t size); ~SRSWQueue(); - + // Any thread: - + inline size_t capacity() const { return _size-1; } - + // Write thread(s): inline bool full() const; inline bool push(const T& obj); - + // Read thread: - + inline bool empty() const; inline T& front() const; inline void pop(); - + private: AtomicInt _front; ///< Index to front of queue (circular) AtomicInt _back; ///< Index to back of queue (one past last element) (circular) diff --git a/raul/Semaphore.hpp b/raul/Semaphore.hpp index 5354d8f..6eb5aba 100644 --- a/raul/Semaphore.hpp +++ b/raul/Semaphore.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -31,7 +31,7 @@ namespace Raul { class Semaphore : boost::noncopyable { public: inline Semaphore(unsigned int initial) { sem_init(&_sem, 0, initial); } - + inline ~Semaphore() { sem_destroy(&_sem); } inline void reset(unsigned int initial) { @@ -46,7 +46,7 @@ public: } /** Increment (and signal any waiters). - * + * * Realtime safe. */ inline void post() { sem_post(&_sem); } @@ -59,7 +59,7 @@ public: * Obviously not realtime safe. */ inline void wait() { while (sem_wait(&_sem) != 0) ; } - + /** Non-blocking version of wait(). * * \return true if decrement was successful (lock was acquired). diff --git a/raul/SharedPtr.hpp b/raul/SharedPtr.hpp index 34a9d3d..ed2058c 100644 --- a/raul/SharedPtr.hpp +++ b/raul/SharedPtr.hpp @@ -1,15 +1,15 @@ /* A Reference Counting Smart Pointer. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * This 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. - * + * * This file 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -30,7 +30,7 @@ static std::list<void*> shared_ptr_counters; // Use debug hooks to ensure 2 shared_ptrs never point to the same thing namespace boost { - + inline void sp_scalar_constructor_hook(void* object, unsigned long cnt, void* ptr) { assert(std::find(shared_ptr_counters.begin(), shared_ptr_counters.end(), (void*)object) == shared_ptr_counters.end()); @@ -38,7 +38,7 @@ namespace boost { //std::cerr << "Creating SharedPtr to " // << object << ", count = " << cnt << std::endl; } - + inline void sp_scalar_destructor_hook(void* object, unsigned long cnt, void* ptr) { shared_ptr_counters.remove(object); //std::cerr << "Destroying SharedPtr to " diff --git a/raul/Slave.hpp b/raul/Slave.hpp index 2830e3f..9cb8a91 100644 --- a/raul/Slave.hpp +++ b/raul/Slave.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/Stateful.hpp b/raul/Stateful.hpp index 41b165f..c23cc53 100644 --- a/raul/Stateful.hpp +++ b/raul/Stateful.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -28,14 +28,14 @@ public: virtual ~Stateful() {} virtual void write_state(Redland::Model& model) = 0; - + Redland::Node id() const { return _id; } void set_id(const Redland::Node& id) { _id = id; } protected: Redland::Node _id; }; - + } // namespace Raul diff --git a/raul/Symbol.hpp b/raul/Symbol.hpp index 0b8cba7..8ec11af 100644 --- a/raul/Symbol.hpp +++ b/raul/Symbol.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -26,9 +26,9 @@ namespace Raul { - + /** A restricted string (C identifier, which is a component of a path). - * + * * A Symbol is an lv2-compliant symbol, which is also valid as a component of * a URI, filesystem or OSC path, programming language identifier, etc. * \ingroup raul @@ -46,7 +46,7 @@ public: { assert(is_valid(symbol)); } - + /** Construct a Symbol from a C string. * @@ -58,9 +58,9 @@ public: { assert(is_valid(csymbol)); } - + static bool is_valid(const std::basic_string<char>& path); - + static std::string symbolify(const std::basic_string<char>& str); }; diff --git a/raul/Table.hpp b/raul/Table.hpp index 40386e5..cb8f60e 100644 --- a/raul/Table.hpp +++ b/raul/Table.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -39,7 +39,7 @@ class Table : public boost::noncopyable { public: Table<K, T>() : _entries() {} Table<K, T>(size_t capacity) : _entries(capacity) {} - + void clear() { _entries.clear(); } bool empty() const { return _entries.empty(); } void reserve(size_t n) { _entries.reserve(n); } @@ -58,7 +58,7 @@ public: const Table<K,T>* _table; size_t _index; }; - + struct iterator { iterator(Table<K,T>& t, size_t i) : _table(&t), _index(i) {} inline std::pair<K, T>& operator*() const { return (std::pair<K, T>&)_table->_entries[_index]; } @@ -83,14 +83,14 @@ public: void erase(iterator i); void erase(iterator start, iterator end); void erase_by_index(size_t start, size_t end); - + SharedPtr< Table<K, T> > yank(iterator start, iterator end); std::pair<iterator, bool> cram(const Table<K, T>& range); - + const_iterator find(const_iterator start, const_iterator end, const K& key) const; const_iterator find(const K& key) const; - + iterator find(const_iterator start, const_iterator end, const K& key); iterator find(const K& key); @@ -110,7 +110,7 @@ private: #endif friend class iterator; - + typedef std::pair<K, T> Entry; std::vector<Entry> _entries; diff --git a/raul/TableImpl.hpp b/raul/TableImpl.hpp index c314022..eb53453 100644 --- a/raul/TableImpl.hpp +++ b/raul/TableImpl.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -35,7 +35,7 @@ Table<K,T>::is_sorted() const { if (size() <= 1) return true; - + K prev_key = _entries[0].first; for (size_t i=1; i < size(); ++i) @@ -43,7 +43,7 @@ Table<K,T>::is_sorted() const return false; else prev_key = _entries[i].first; - + return true; } #endif @@ -87,7 +87,7 @@ Table<K,T>::find(const_iterator start, const_iterator finish, const K& key) size_t lower = start._index; size_t upper = finish._index - 1; size_t i; - + while (upper >= lower) { i = lower + ((upper - lower) / 2); const Entry& elem = _entries[i]; @@ -101,7 +101,7 @@ Table<K,T>::find(const_iterator start, const_iterator finish, const K& key) else break; } - + return end(); } @@ -125,7 +125,7 @@ Table<K,T>::find_range_end(const_iterator start, bool (*comp)(const K&,const K&) return (const_cast<Table<K, T>&>(*this)).find_range_end(*((iterator*)&start), comp); } - + /** Find the end of a range using a custom comparator. * Two entries a, b are considered in the range if comp(a, b) returns true. * @@ -158,11 +158,11 @@ Table<K,T>::find_range_end(iterator start, bool (*comp)(const K&,const K&)) } size_t i; - + while (upper > lower) { - + i = lower + ((upper - lower) / 2); - + if (upper - lower == 1) { if (comp(key, _entries[upper].first) && upper < size()) return iterator(*this, upper+1); @@ -174,26 +174,26 @@ Table<K,T>::find_range_end(iterator start, bool (*comp)(const K&,const K&)) // Hit if (comp(key, elem.first)) { - + if (i == size()-1 || !comp(key, _entries[i+1].first)) return iterator(*this, i+1); - else + else lower = i; // Miss } else { upper = i; - + } } - + assert(comp(start->first, _entries[lower].first)); assert(lower == size()-1 || !comp(start->first, _entries[lower+1].first)); return iterator(*this, lower+1); } - + /** Erase and return a range of entries */ template <typename K, typename T> @@ -216,16 +216,16 @@ std::pair<typename Table<K,T>::iterator, bool> Table<K, T>::cram(const Table<K,T>& range) { /* FIXME: _way_ too slow */ - + const size_t orig_size = size(); if (range.size() == 0) return std::make_pair(end(), false); - + std::pair<iterator, bool> ret = insert(range._entries.front()); if (range.size() == 1) return ret; - + const size_t insert_index = ret.first._index; std::vector<Entry> new_entries(orig_size + range.size()); @@ -235,18 +235,18 @@ Table<K, T>::cram(const Table<K,T>& range) for (size_t i=0; i < size() - insert_index; ++i) new_entries.at(new_entries.size() - 1 - i) = _entries.at(size() - 1 - i); - + for (size_t i=1; i < range.size(); ++i) new_entries.at(insert_index + i) = range._entries.at(i); - + _entries = new_entries; - + /*std::cerr << "********************************\n"; for (size_t i=0; i < size(); ++i) { std::cerr << _entries[i].first << std::endl; } std::cerr << "********************************\n";*/ - + assert(size() == orig_size + range.size()); #ifdef TABLE_SORT_DEBUG assert(is_sorted()); @@ -269,7 +269,7 @@ Table<K,T>::insert(const std::pair<K, T>& entry) { const K& key = entry.first; const T& value = entry.second; - + if (size() == 0 || (size() == 1 && key > _entries[0].first)) { _entries.push_back(entry); return std::make_pair(iterator(*this, size()-1), true); @@ -282,7 +282,7 @@ Table<K,T>::insert(const std::pair<K, T>& entry) size_t lower = 0; size_t upper = size() - 1; size_t i; - + // Find the earliest element > key while (upper >= lower) { i = lower + ((upper - lower) / 2); @@ -309,22 +309,22 @@ Table<K,T>::insert(const std::pair<K, T>& entry) // Lil' off by one touchup :) if (i < size() && _entries[i].first <= key) ++i; - + _entries.push_back(_entries.back()); // Shift everything beyond i right for (size_t j = size()-2; j > i; --j) _entries[j] = _entries[j-1]; - + _entries[i] = entry; #ifdef TABLE_SORT_DEBUG assert(is_sorted()); #endif - + return std::make_pair(iterator(*this, i), true); } - + /** Insert an item, and return a reference to it's value. * diff --git a/raul/Thread.hpp b/raul/Thread.hpp index d7733c7..22215d1 100644 --- a/raul/Thread.hpp +++ b/raul/Thread.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -32,7 +32,7 @@ namespace Raul { * to perform some task. * * The current Thread can be accessed using the get() method. - * + * * \ingroup raul */ class Thread : boost::noncopyable @@ -44,21 +44,21 @@ public: static Thread* create(const std::string& name="") { return new Thread(name); } - + /** Must be called from thread */ static Thread* create_for_this_thread(const std::string& name="") { return new Thread(pthread_self(), name); } - + static Thread& get(); virtual void start(); virtual void stop(); void set_scheduling(int policy, unsigned int priority); - + const std::string& name() const { return _name; } void set_name(const std::string& name) { _name = name; } - + unsigned context() const { return _context; } void set_context(unsigned context) { _context = context; } @@ -75,7 +75,7 @@ protected: * should exit. */ virtual void _run() {} - + bool _exit_flag; private: @@ -95,7 +95,7 @@ private: /* Key for the thread-specific buffer */ static pthread_key_t _thread_key; - + /* Once-only initialisation of the key */ static pthread_once_t _thread_key_once; diff --git a/raul/TimeSlice.hpp b/raul/TimeSlice.hpp index 05ed170..d1a1f4a 100644 --- a/raul/TimeSlice.hpp +++ b/raul/TimeSlice.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -94,7 +94,7 @@ public: _beat_rate = 60.0/bpm; update_beat_time(); } - + inline TimeStamp beats_to_seconds(TimeStamp beats) const { return TimeStamp(real_unit(), beats.to_double() * 1/(double)_beat_rate); } @@ -102,7 +102,7 @@ public: inline TimeStamp beats_to_ticks(TimeStamp beats) const { return TimeStamp(ticks_unit(), beats.to_double() / (double)_beat_rate * _tick_rate); } - + inline TimeStamp ticks_to_seconds(TimeStamp ticks) const { return TimeStamp(real_unit(), ticks.ticks() * 1/(double)_tick_rate); } @@ -110,7 +110,7 @@ public: inline TimeStamp ticks_to_beats(TimeStamp ticks) const { return TimeStamp(beats_unit(), ticks.ticks() * 1/(double)_tick_rate * _beat_rate); } - + /** Start of current sub-cycle in ticks */ inline TimeStamp start_ticks() const { return _start_ticks; } @@ -128,7 +128,7 @@ public: /** Offset relative to external (e.g Jack) time */ inline TimeDuration offset_ticks() const { return _offset_ticks; } - + inline TimeUnit beats_unit() const { return _start_beats.unit(); } inline TimeUnit ticks_unit() const { return _start_ticks.unit(); } inline TimeUnit real_unit() const { return TimeUnit(TimeUnit::SECONDS, 0); } @@ -148,7 +148,7 @@ private: TimeDuration _length_ticks; ///< Current window length in ticks TimeStamp _start_beats; ///< Current window start in beats TimeDuration _length_beats; ///< Current window length in beats - + TimeDuration _offset_ticks; ///< Offset to global time (ie Jack sub-cycle offset) }; diff --git a/raul/TimeStamp.hpp b/raul/TimeStamp.hpp index 820a8bf..96a31ff 100644 --- a/raul/TimeStamp.hpp +++ b/raul/TimeStamp.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -25,8 +25,8 @@ #include <iostream> namespace Raul { - - + + /** A type of time stamp */ class TimeUnit { @@ -36,7 +36,7 @@ public: BEATS, SECONDS }; - + /** @a ppt (parts per tick) is the sample rate for FRAMES, * PPQN for BEATS, and ignored for SECONDS. */ @@ -52,11 +52,11 @@ public: inline Type type() const { return _type; } inline uint32_t ppt() const { return _ppt; } - + inline bool operator==(const TimeUnit& rhs) const { return (_type == rhs._type && _ppt == rhs._ppt); } - + inline bool operator!=(const TimeUnit& rhs) const { return (_type != rhs._type || _ppt != rhs._ppt); } @@ -83,7 +83,7 @@ public: , _subticks(subticks) , _unit(unit) {} - + inline TimeStamp(TimeUnit unit, double dec) : _ticks((uint32_t)floor(dec)) , _subticks((dec - floor(dec)) * unit.ppt()) @@ -92,11 +92,11 @@ public: assert(dec >= 0); assert(dec <= std::numeric_limits<uint32_t>::max()); } - + inline TimeUnit unit() const { return _unit; } inline uint32_t ticks() const { return _ticks; } inline uint32_t subticks() const { return _subticks; } - + inline double to_double() const { return _ticks + (_subticks / (double)_unit.ppt()); } @@ -112,7 +112,7 @@ public: //_unit = rhs._unit; return *this; } - + inline TimeStamp& operator=(uint32_t ticks) { _ticks = ticks; _subticks = 0; @@ -124,7 +124,7 @@ public: && _subticks == rhs._subticks && _unit == rhs._unit; } - + inline bool operator!=(const TimeStamp& rhs) const { return ! operator==(rhs); } @@ -134,21 +134,21 @@ public: return (_ticks < rhs._ticks || (_ticks == rhs._ticks && _subticks < rhs._subticks)); } - + inline bool operator<=(const TimeStamp& rhs) const { assert(_unit == rhs._unit); return (_ticks <= rhs._ticks || (_ticks == rhs._ticks && _subticks <= rhs._subticks)); } - + inline bool operator>=(const TimeStamp& rhs) const { return ! (rhs < *this); } - + inline bool operator>(const TimeStamp& rhs) const { return ! (rhs <= *this); } - + inline TimeStamp& operator+=(const TimeStamp& rhs) { assert(_unit == rhs._unit); _ticks += rhs._ticks; @@ -160,7 +160,7 @@ public: } return *this; } - + inline TimeStamp& operator-=(const TimeStamp& rhs) { assert(_unit == rhs._unit); assert(rhs <= *this); @@ -173,14 +173,14 @@ public: } return *this; } - + inline TimeStamp operator+(const TimeStamp& rhs) const { assert(_unit == rhs._unit); TimeStamp result = *this; result += rhs; return result; } - + inline TimeStamp operator-(const TimeStamp& rhs) const { assert(_unit == rhs._unit); TimeStamp result = *this; @@ -213,7 +213,7 @@ operator<<(std::ostream& os, const TimeStamp& t) return os; } - + class FrameStamp : public TimeStamp { public: inline FrameStamp(uint32_t rate, uint32_t ticks=0, uint32_t subticks=0) diff --git a/raul/URI.hpp b/raul/URI.hpp index 7642aaf..91e7865 100644 --- a/raul/URI.hpp +++ b/raul/URI.hpp @@ -1,15 +1,15 @@ /* This file is part of Raul. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * 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. - * + * * 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -24,7 +24,7 @@ namespace Raul { - + /** Simple wrapper around standard string with useful URI-specific methods. * * This "should" be used for proper URIs (RFC3986), but not much support or @@ -64,7 +64,7 @@ public: static bool is_valid(const std::basic_string<char>& uri) { return uri.find(":") != std::string::npos; } - + /** Return path with every up to and including the first occurence of str */ inline const std::string chop_start(const std::string& str) const { return substr(find(str) + str.length()); @@ -81,7 +81,7 @@ public: inline operator const std::string() const { return str(); } inline operator std::string() { return str(); } - + inline std::string substr(size_t start, size_t end=std::string::npos) const { return str().substr(start, end); } diff --git a/raul/WeakPtr.hpp b/raul/WeakPtr.hpp index 650b437..c5beb45 100644 --- a/raul/WeakPtr.hpp +++ b/raul/WeakPtr.hpp @@ -1,15 +1,15 @@ /* A "weak" pointer to a resource owned by a shared pointer. * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * + * * This 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. - * + * * This file 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. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/raul/midi_names.h b/raul/midi_names.h index 114c299..28fb388 100644 --- a/raul/midi_names.h +++ b/raul/midi_names.h @@ -37,7 +37,7 @@ extern "C" { inline static const char* midi_name(uint8_t status) { switch (status) { - + case MIDI_CMD_NOTE_OFF: return "Note Off"; break; case MIDI_CMD_NOTE_ON: |