summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--raul/Array.hpp26
-rw-r--r--raul/Atom.hpp20
-rw-r--r--raul/AtomLiblo.hpp6
-rw-r--r--raul/AtomRDF.hpp10
-rw-r--r--raul/AtomicInt.hpp18
-rw-r--r--raul/AtomicPtr.hpp6
-rw-r--r--raul/Command.hpp6
-rw-r--r--raul/Deletable.hpp6
-rw-r--r--raul/DoubleBuffer.hpp10
-rw-r--r--raul/EventRingBuffer.hpp6
-rw-r--r--raul/List.hpp24
-rw-r--r--raul/ListImpl.hpp26
-rw-r--r--raul/MIDISink.hpp6
-rw-r--r--raul/Maid.hpp12
-rw-r--r--raul/Path.hpp32
-rw-r--r--raul/PathTable.hpp10
-rw-r--r--raul/Process.hpp8
-rw-r--r--raul/Quantizer.hpp8
-rw-r--r--raul/RingBuffer.hpp38
-rw-r--r--raul/SMFReader.hpp10
-rw-r--r--raul/SMFWriter.hpp6
-rw-r--r--raul/SRMWQueue.hpp32
-rw-r--r--raul/SRSWQueue.hpp20
-rw-r--r--raul/Semaphore.hpp12
-rw-r--r--raul/SharedPtr.hpp10
-rw-r--r--raul/Slave.hpp6
-rw-r--r--raul/Stateful.hpp10
-rw-r--r--raul/Symbol.hpp16
-rw-r--r--raul/Table.hpp18
-rw-r--r--raul/TableImpl.hpp58
-rw-r--r--raul/Thread.hpp20
-rw-r--r--raul/TimeSlice.hpp16
-rw-r--r--raul/TimeStamp.hpp42
-rw-r--r--raul/URI.hpp12
-rw-r--r--raul/WeakPtr.hpp6
-rw-r--r--raul/midi_names.h2
-rw-r--r--src/LashClient.cpp12
-rw-r--r--src/LashProject.cpp8
-rw-r--r--src/LashServerInterface.cpp12
-rw-r--r--src/Maid.cpp6
-rw-r--r--src/Path.cpp24
-rw-r--r--src/SMFReader.cpp24
-rw-r--r--src/SMFWriter.cpp16
-rw-r--r--src/Symbol.cpp12
-rw-r--r--src/Thread.cpp6
-rw-r--r--src/TimeSlice.cpp10
-rw-r--r--tests/list_test.cpp26
-rw-r--r--tests/midi_ringbuffer_test.cpp6
-rw-r--r--tests/path_test.cpp4
-rw-r--r--tests/quantize_test.cpp6
-rw-r--r--tests/queue_test.cpp22
-rw-r--r--tests/ringbuffer_test.cpp4
-rw-r--r--tests/table_test.cpp100
-rw-r--r--tests/time_test.cpp6
54 files changed, 439 insertions, 439 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:
diff --git a/src/LashClient.cpp b/src/LashClient.cpp
index 8da0131..5e7dd83 100644
--- a/src/LashClient.cpp
+++ b/src/LashClient.cpp
@@ -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,7 +51,7 @@ LashClient::create(
return result;
}
-
+
/** Process all pending LASH events.
*
* This should be called regularly to keep track of LASH state.
@@ -65,13 +65,13 @@ LashClient::process_events()
// Process events
while ((ev = lash_get_event(_lash_client)) != NULL) {
handle_event(ev);
- lash_event_destroy(ev);
+ lash_event_destroy(ev);
}
// Process configs
while ((conf = lash_get_config(_lash_client)) != NULL) {
handle_config(conf);
- lash_config_destroy(conf);
+ lash_config_destroy(conf);
}
}
diff --git a/src/LashProject.cpp b/src/LashProject.cpp
index 84c83c6..626788b 100644
--- a/src/LashProject.cpp
+++ b/src/LashProject.cpp
@@ -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
@@ -80,7 +80,7 @@ LashProject::set_name(const string& name)
lash_event_set_string(event, name.c_str());
lash_send_event(client->lash_client(), event);
}
-
+
_name = name;
}
diff --git a/src/LashServerInterface.cpp b/src/LashServerInterface.cpp
index ed62794..7514b2f 100644
--- a/src/LashServerInterface.cpp
+++ b/src/LashServerInterface.cpp
@@ -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
@@ -55,10 +55,10 @@ LashServerInterface::handle_event(lash_event_t* ev)
const string str = (c_str == NULL) ? "" : c_str;
SharedPtr<LashProject> p;
-
+
//cout << "[LashServerInterface] Event, type = " << (unsigned int)type
// << ", string = " << str << endl;
-
+
switch (type) {
case LASH_Project_Add:
p = project(str);
@@ -121,7 +121,7 @@ LashServerInterface::handle_event(lash_event_t* ev)
LashClient::handle_event(ev);
}
-
+
void
LashServerInterface::restore_project(const std::string& filename)
diff --git a/src/Maid.cpp b/src/Maid.cpp
index bbf5475..4c5c032 100644
--- a/src/Maid.cpp
+++ b/src/Maid.cpp
@@ -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/src/Path.cpp b/src/Path.cpp
index e7d4d23..b5c228e 100644
--- a/src/Path.cpp
+++ b/src/Path.cpp
@@ -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
@@ -38,13 +38,13 @@ Path::is_valid(const std::basic_string<char>& path_str)
// Must start with a /
if (path[0] != '/')
return false;
-
+
// Must not end with a slash unless "/"
if (path.length() > 1 && path[path.length()-1] == '/')
return false;
assert(path.find_last_of("/") != string::npos);
-
+
// Double slash not allowed
if (path.find("//") != string::npos)
return false;
@@ -74,24 +74,24 @@ Path::pathify(const std::basic_string<char>& str)
{
if (str.length() == 0)
return root_uri; // this might not be wise?
-
+
string path = (str.substr(0, prefix_len) == prefix) ? str : prefix + str;
size_t start = prefix_len + 1;
// Must start with a /
if (path.at(start) != '/')
path = string("/").append(path);
-
+
// Must not end with a slash unless "/"
if (path.length() > prefix_len + 1 && path.at(path.length()-1) == '/')
path = path.substr(0, path.length()-1); // chop trailing slash
assert(path.find_last_of("/") != string::npos);
-
+
replace_invalid_chars(path, start, false);
assert(is_valid(path));
-
+
return path;
}
@@ -127,7 +127,7 @@ Path::replace_invalid_chars(string& str, size_t start, bool replace_slash)
size_t open_bracket = str.find_first_of('(');
if (open_bracket != string::npos)
str = str.substr(0, open_bracket);
-
+
open_bracket = str.find_first_of('[');
if (open_bracket != string::npos)
str = str.substr(0, open_bracket);
@@ -137,7 +137,7 @@ Path::replace_invalid_chars(string& str, size_t start, bool replace_slash)
if (isdigit(str[0]))
str = string("_").append(str);
-
+
for (size_t i=0; i < str.length(); ++i) {
if (i > 0 && str[i-1] == '/' && isdigit(str[i])) {
str = str.substr(0, i) + "_" + str.substr(i);
@@ -157,7 +157,7 @@ Path::replace_invalid_chars(string& str, size_t start, bool replace_slash)
str[i] = '_';
}
}
-
+
if (str.length() != 1 && str[str.length()-1] == '_')
str = str.substr(0, str.length()-1);
diff --git a/src/SMFReader.cpp b/src/SMFReader.cpp
index 0160875..b684c14 100644
--- a/src/SMFReader.cpp
+++ b/src/SMFReader.cpp
@@ -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
@@ -88,7 +88,7 @@ SMFReader::~SMFReader()
close();
}
-
+
bool
SMFReader::open(const string& filename) throw (logic_error, UnsupportedTime)
{
@@ -111,7 +111,7 @@ SMFReader::open(const string& filename) throw (logic_error, UnsupportedTime)
_fd = NULL;
return false;
}
-
+
// Read type (bytes 8..9)
fseek(_fd, 8, SEEK_SET);
uint16_t type_be = 0;
@@ -127,20 +127,20 @@ SMFReader::open(const string& filename) throw (logic_error, UnsupportedTime)
uint16_t ppqn_be = 0;
fread(&ppqn_be, 2, 1, _fd);
_ppqn = GUINT16_FROM_BE(ppqn_be);
-
+
// TODO: Absolute (SMPTE seconds) time support
if ((_ppqn & 0x8000) != 0)
throw UnsupportedTime();
seek_to_track(1);
-
+
return true;
} else {
return false;
}
}
-
+
/** Seek to the start of a given track, starting from 1.
* Returns true if specified track was found.
*/
@@ -188,7 +188,7 @@ SMFReader::seek_to_track(unsigned track) throw (std::logic_error)
}
}
-
+
/** Read an event from the current position in file.
*
* File position MUST be at the beginning of a delta time, or this will die very messily.
@@ -274,14 +274,14 @@ SMFReader::read_event(size_t buf_len,
// Read event, return size
if (ferror(_fd))
throw CorruptFile();
-
+
fread(buf+1, 1, *ev_size - 1, _fd);
-
+
if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) {
buf[0] = (0x80 | (buf[0] & 0x0F));
buf[2] = 0x40;
}
-
+
return *ev_size;
}
}
diff --git a/src/SMFWriter.cpp b/src/SMFWriter.cpp
index 771b3bf..a3609b0 100644
--- a/src/SMFWriter.cpp
+++ b/src/SMFWriter.cpp
@@ -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
@@ -71,7 +71,7 @@ SMFWriter::start(const string& filename,
_fd = fopen(filename.c_str(), "w+");
- if (_fd) {
+ if (_fd) {
_track_size = 0;
_filename = filename;
_start_time = start_time;
@@ -106,7 +106,7 @@ SMFWriter::write_event(Raul::TimeStamp time,
delta_time -= _start_time;
fseek(_fd, 0, SEEK_END);
-
+
uint64_t delta_ticks = delta_time.ticks() * _unit.ppt() + delta_time.subticks();
size_t stamp_size = 0;
@@ -121,7 +121,7 @@ SMFWriter::write_event(Raul::TimeStamp time,
_track_size += stamp_size + 3;
delta_ticks -= VAR_LEN_MAX;
}
-
+
assert(delta_ticks <= VAR_LEN_MAX);
stamp_size = write_var_len((uint32_t)delta_ticks);
fwrite(ev, 1, ev_size, _fd);
@@ -173,7 +173,7 @@ SMFWriter::write_header()
assert(_fd);
fseek(_fd, 0, 0);
write_chunk("MThd", 6, data);
- write_chunk_header("MTrk", _track_size);
+ write_chunk_header("MTrk", _track_size);
}
@@ -203,7 +203,7 @@ void
SMFWriter::write_chunk(const char id[4], uint32_t length, void* data)
{
write_chunk_header(id, length);
-
+
fwrite(data, 1, length, _fd);
}
diff --git a/src/Symbol.cpp b/src/Symbol.cpp
index a56b6db..d470417 100644
--- a/src/Symbol.cpp
+++ b/src/Symbol.cpp
@@ -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
@@ -60,15 +60,15 @@ Symbol::symbolify(const std::basic_string<char>& str)
string symbol = str;
Path::replace_invalid_chars(symbol, true);
-
+
if (symbol.length() == 0)
return "_";
if (isdigit(symbol[0]))
- symbol = string("_").append(symbol);
+ symbol = string("_").append(symbol);
assert(is_valid(symbol));
-
+
return symbol;
}
diff --git a/src/Thread.cpp b/src/Thread.cpp
index 1a40594..cbbba55 100644
--- a/src/Thread.cpp
+++ b/src/Thread.cpp
@@ -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/src/TimeSlice.cpp b/src/TimeSlice.cpp
index 661b465..3122394 100644
--- a/src/TimeSlice.cpp
+++ b/src/TimeSlice.cpp
@@ -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 @@ TimeSlice::TimeSlice(uint32_t tick_rate, double bpm)
, _length(0)
, _start_beats(0)
{}
-
+
/** Update beat time to match real (tick) time.
*/
@@ -42,7 +42,7 @@ TimeSlice::update_beat_time()
TickTime
TimeSlice::beats_to_ticks(BeatTime beats)
{
- return static_cast<TickTime>(beats_to_seconds(beats) / _tick_rate);
+ return static_cast<TickTime>(beats_to_seconds(beats) / _tick_rate);
}
Seconds
diff --git a/tests/list_test.cpp b/tests/list_test.cpp
index c3909a1..ae139ce 100644
--- a/tests/list_test.cpp
+++ b/tests/list_test.cpp
@@ -38,7 +38,7 @@ int main()
cout << *i << endl;
}
cout << endl;
-
+
/*l.remove(1);
cout << "Removed 1 (head) (by value)...\n";
@@ -60,7 +60,7 @@ int main()
cout << *i << endl;
}
cout << endl;
-
+
/*l.remove(5);
cout << "Removed 5 (by value)...\n";
@@ -68,7 +68,7 @@ int main()
cout << *i << endl;
}
cout << endl;
-
+
l.remove(8);
cout << "Removed 8 (tail) (by value)...\n";
@@ -97,7 +97,7 @@ int main()
for (List<int>::iterator i = r.begin(); i != r.end(); ++i) {
cout << *i << endl;
}
-
+
cout << "\n\nTesting appending to an empty list:\n";
l.clear();
@@ -106,12 +106,12 @@ int main()
l2.push_back(new List<int>::Node(2));
l2.push_back(new List<int>::Node(3));
l2.push_back(new List<int>::Node(4));
-
+
cout << "l1:\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
-
+
cout << "l2:\n";
for (List<int>::iterator i = l2.begin(); i != l2.end(); ++i) {
cout << *i << endl;
@@ -122,18 +122,18 @@ int main()
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
-
+
cout << "\n\nAppending non-empty lists:\n";
l2.push_back(new List<int>::Node(5));
l2.push_back(new List<int>::Node(6));
l2.push_back(new List<int>::Node(7));
l2.push_back(new List<int>::Node(8));
-
+
cout << "l1:\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
-
+
cout << "l2:\n";
for (List<int>::iterator i = l2.begin(); i != l2.end(); ++i) {
cout << *i << endl;
@@ -144,15 +144,15 @@ int main()
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
-
-
+
+
cout << "\n\nAppending an empty list:\n";
-
+
cout << "l1:\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
-
+
cout << "l2:\n";
for (List<int>::iterator i = l2.begin(); i != l2.end(); ++i) {
cout << *i << endl;
diff --git a/tests/midi_ringbuffer_test.cpp b/tests/midi_ringbuffer_test.cpp
index 05a7e35..0726259 100644
--- a/tests/midi_ringbuffer_test.cpp
+++ b/tests/midi_ringbuffer_test.cpp
@@ -21,17 +21,17 @@ read_write_test(EventRingBuffer& rb, unsigned offset)
size_t written = rb.write(t, size, buf);
#endif
assert(written == size);
-
+
for (size_t i=0; i < 4; ++i)
buf[i] = 0;
rb.read(&t, &size, buf);
-
+
cout << "t=" << t << ", s=" << size << ", b='" << buf << "'" << endl;
}
-
+
int
main()
{
diff --git a/tests/path_test.cpp b/tests/path_test.cpp
index ac7ff2b..20d6705 100644
--- a/tests/path_test.cpp
+++ b/tests/path_test.cpp
@@ -23,7 +23,7 @@ main()
cerr << "Nameification:" << endl;
for (list<string>::iterator i = names.begin(); i != names.end(); ++i)
cerr << *i << " -> " << Path::nameify(*i) << endl;
-
+
cerr << endl;
cerr << Path("/foo/bar") << " parent = " << Path("/foo/bar").parent() << endl;
cerr << Path("/foo") << " parent = " << Path("/foo").parent() << endl;
@@ -34,7 +34,7 @@ main()
cerr << (Path("/").is_parent_of(Path("/foo"))) << endl;
cerr << (Path("/foo").is_parent_of(Path("/foo/bar"))) << endl;
cerr << !(Path("/foo").is_parent_of(Path("/foo2"))) << endl;
-
+
cerr << endl << endl << "Descendants..." << endl;
cerr << "/ /foo " << Path::descendant_comparator("/", "/foo") << endl;
cerr << "/foo /foo/bar " << Path::descendant_comparator("/foo", "/foo/bar") << endl;
diff --git a/tests/quantize_test.cpp b/tests/quantize_test.cpp
index 49e3fbd..cc10505 100644
--- a/tests/quantize_test.cpp
+++ b/tests/quantize_test.cpp
@@ -13,19 +13,19 @@ main()
cout << "Quantization: ";
cin >> in;
cout << endl;
-
+
TimeStamp q(TimeUnit(TimeUnit::BEATS, 19200), in);
while (true) {
cout << "Beats: ";
cin >> in;
-
+
TimeStamp beats(TimeUnit(TimeUnit::BEATS, 19200), in);
cout << "Quantized: ";
cout << Quantizer::quantize(q, beats) << endl << endl;
}
- return 0;
+ return 0;
}
diff --git a/tests/queue_test.cpp b/tests/queue_test.cpp
index 1e92104..28d06d8 100644
--- a/tests/queue_test.cpp
+++ b/tests/queue_test.cpp
@@ -48,7 +48,7 @@ struct WriteAction {
// The victim
-SRMWQueue<WriteAction> queue(QUEUE_SIZE);
+SRMWQueue<WriteAction> queue(QUEUE_SIZE);
class WriteThread : public Thread {
@@ -119,7 +119,7 @@ dump_data()
int main()
{
unsigned long total_processed = 0;
-
+
cout << "Testing size" << endl;
for (unsigned i=0; i < queue.capacity(); ++i) {
queue.push(i);
@@ -137,7 +137,7 @@ int main()
}
}
}
-
+
for (unsigned i=0; i < queue.capacity(); ++i)
queue.pop();
@@ -145,7 +145,7 @@ int main()
cerr << "ERROR: Should be empty" << endl;
return -1;
}
-
+
cout << "Testing concurrent reading/writing" << endl;
vector<WriteThread*> writers(NUM_WRITERS, new WriteThread());
@@ -177,7 +177,7 @@ int main()
/*if (count > 0)
cout << "Processed " << count << " requests\t\t"
<< "(total " << total_processed << ")\r\n";*/
-
+
//if (total_processed > 0 && total_processed % 128l == 0)
// cout << "Total processed: " << total_processed << "\r\n";
}
@@ -185,7 +185,7 @@ int main()
if (tcsetattr(0, TCSANOW, &orig_term) != 0) return 1; //restore
cout << "Finishing." << endl;
-
+
// Stop the writers
for (unsigned i=0; i < NUM_WRITERS; ++i)
writers[i]->stop();
@@ -212,7 +212,7 @@ int main()
cout << "Total processed: " << total_processed << endl;
if (total_processed > INT_MAX)
cout << "(Counter had to wrap)" << endl;
- else
+ else
cout << "(Counter did NOT have to wrap)" << endl;
@@ -224,7 +224,7 @@ int main()
cout << "FAILED BY " << diff << endl;
// dump_data();
}
-
+
dump_data();
return 0;
@@ -240,7 +240,7 @@ int main()
cout << "New queue. Should be empty: " << q.empty() << endl;
cout << "Capacity: " << q.capacity() << endl;
//cout << "Fill: " << q.fill() << endl;
-
+
for (uint i=0; i < 5; ++i) {
q.push(i);
assert(!q.full());
@@ -263,7 +263,7 @@ int main()
}
cout << "Queue should be empty: " << q.empty() << endl;
//cout << "Fill: " << q.fill() << endl;
-
+
cout << "Attempting to add eleven elements to queue of size 10. Only first 10 should succeed:" << endl;
for (uint i=20; i <= 39; ++i) {
cout << i;
@@ -271,7 +271,7 @@ int main()
cout << " - full: " << q.full();
cout << ", succeeded: " << q.push(i) << endl;
}
-
+
return 0;
}
#endif
diff --git a/tests/ringbuffer_test.cpp b/tests/ringbuffer_test.cpp
index 162d984..87b81c6 100644
--- a/tests/ringbuffer_test.cpp
+++ b/tests/ringbuffer_test.cpp
@@ -23,7 +23,7 @@ int
main()
{
RingBuffer<char> rb(5);
-
+
char ev[] = { 'a', 'b', 'c' };
rb.write(3, ev);
@@ -34,7 +34,7 @@ main()
char ev2[] = { 'd', 'e', 'f' };
rb.write(3, ev2);
-
+
size_t read = rb.read(3, buf);
if (read < 3)
diff --git a/tests/table_test.cpp b/tests/table_test.cpp
index d5d0610..5e83479 100644
--- a/tests/table_test.cpp
+++ b/tests/table_test.cpp
@@ -51,17 +51,17 @@ main(int argc, char** argv)
t[20] = 20;
t[21] = 21;
-
+
cout << "Contents:" << endl;
for (Table<int,int>::const_iterator i = t.begin(); i != t.end(); ++i)
cout << i->first << " ";
cout << endl;
-
+
std::cout << "Range " << t.begin()->first << " .. " << range_end_val << std::endl;
Table<int,int>::const_iterator range_begin = t.begin();
++range_begin; ++range_begin;
-
+
Table<int,int>::iterator range_end = t.find_range_end(t.begin(), range_comparator);
for (Table<int,int>::const_iterator i = t.begin(); i != range_end; ++i)
@@ -79,7 +79,7 @@ main(int argc, char** argv)
for (Table<int,int>::const_iterator i = t.begin(); i != t.end(); ++i)
cout << i->first << " ";
cout << endl;
-
+
cout << "Erasing elements 0..3" << endl;
first = t.begin();
last = first;
@@ -89,7 +89,7 @@ main(int argc, char** argv)
for (Table<int,int>::const_iterator i = t.begin(); i != t.end(); ++i)
cout << i->first << " ";
cout << endl;
-
+
cout << "Erasing elements end()-2..end()" << endl;
last = t.end();
first = last;
@@ -99,7 +99,7 @@ main(int argc, char** argv)
for (Table<int,int>::const_iterator i = t.begin(); i != t.end(); ++i)
cout << i->first << " ";
cout << endl;
-
+
cout << "Erasing everything" << endl;
first = t.begin();
last = t.end();
@@ -108,7 +108,7 @@ main(int argc, char** argv)
for (Table<int,int>::const_iterator i = t.begin(); i != t.end(); ++i)
cout << i->first << " ";
cout << endl;
-
+
/* **** */
PathTable<char> pt;
@@ -122,12 +122,12 @@ main(int argc, char** argv)
pt.insert(make_pair("/bar/buzz/WHAT", 'c'));
pt.insert(make_pair("/bar/buzz/WHHHhhhhhAT", 'c'));
pt.insert(make_pair("/quux", 'a'));
-
+
cout << "Paths: " << endl;
for (PathTable<char>::const_iterator i = pt.begin(); i != pt.end(); ++i)
cout << i->first << " ";
cout << endl;
-
+
PathTable<char>::const_iterator descendants_begin = pt.begin();
size_t begin_index = rand() % pt.size();
for (size_t i=0; i < begin_index; ++i)
@@ -147,14 +147,14 @@ main(int argc, char** argv)
assert(quux_end != quux);
SharedPtr< Table<Path,char> > yanked = pt.yank(quux, quux_end);
-
+
cout << "Yanked " << yank_path << endl;
for (PathTable<char>::const_iterator i = pt.begin(); i != pt.end(); ++i)
cout << i->first << " ";
cout << endl;
pt.cram(*yanked.get());
-
+
cout << "Crammed " << yank_path << endl;
for (PathTable<char>::const_iterator i = pt.begin(); i != pt.end(); ++i)
cout << i->first << " ";
@@ -164,7 +164,7 @@ main(int argc, char** argv)
cout << "\nAssuming you built with debugging, if this continues to run "
<< "and chews your CPU without dying, everything's good." << endl;
-
+
Table<string, string> st;
@@ -175,7 +175,7 @@ main(int argc, char** argv)
//st["zeta"] = "one";
st.erase("banana");
-
+
for (Table<int,int>::const_iterator i = t.begin(); i != t.end(); ++i)
cout << i->first << " ";
cout << endl;
@@ -235,88 +235,88 @@ benchmark(size_t n)
timeval t1;
t1.tv_sec=0;
t1.tv_usec=0;
-
+
timeval t2;
t2.tv_sec=0;
t2.tv_usec=0;
-
+
/** std::map **/
std::map<string,int> m;
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
m.insert(make_pair(values[i], i));
-
+
gettimeofday(&t2, NULL);
float delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "std::map time to insert " << n << " values: \t" << delta_t << endl;
-
+
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
useless_accumulator += m.find(values[i])->second;
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "std::map time to lookup " << n << " values: \t" << delta_t << endl;
-
-
+
+
/** std::set **/
std::set<std::string> s;
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
s.insert(values[i]);
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "std::set time to insert " << n << " values: \t" << delta_t << endl;
-
+
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
useless_accumulator += (int)(*s.find(values[i]))[0];
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "std::set time to lookup " << n << " values: \t" << delta_t << endl;
-
-
+
+
/** sorted std::vector **/
/*std::vector<int> v;
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
v.push_back(values[i]);
sort(v.begin(), v.end());
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "std::vector (sorted) time to insert " << n << " values: \t" << delta_t << endl;
-
+
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
useless_accumulator += *lower_bound(v.begin(), v.end(), values[i]);
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
@@ -325,55 +325,55 @@ benchmark(size_t n)
/** Raul::Table **/
-
+
Raul::Table<string,int> t(n);
-
+
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
t.insert(make_pair(values[i], i));
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "Raul::Table time to insert " << n << " values: " << delta_t << endl;
-
+
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
useless_accumulator += t.find(values[i])->second;
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "Raul::Table time to lookup " << n << " values: \t" << delta_t << endl;
-
-
+
+
#ifdef WITH_TR1
/** boost::hash && std::unordered_map **/
-
+
tr1::unordered_map<string, int, boost::hash<string> > um;
gettimeofday(&t1, NULL);
-
+
um.rehash(n);
-
+
for (size_t i=0; i < n; ++i)
um.insert(make_pair(values[i], i));
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
cout << "tr1::unordered_map + boost::hash time to insert " << n << " values: \t" << delta_t << endl;
-
+
gettimeofday(&t1, NULL);
-
+
for (size_t i=0; i < n; ++i)
useless_accumulator += um.find(values[i])->second;
-
+
gettimeofday(&t2, NULL);
delta_t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec) * 0.000001f;
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 4757f6b..2b53207 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -15,18 +15,18 @@ main()
double in_double;
cout << "Beats: ";
cin >> in_double;
-
+
TimeStamp t(unit, (uint32_t)in_double,
(uint32_t)((in_double - (uint32_t)in_double) * unit.ppt()));
cout << "\tSeconds: ";
cout << ts.beats_to_seconds(t);
cout << endl;
-
+
cout << "\tTicks: ";
cout << ts.beats_to_ticks(t);
cout << endl;
- return 0;
+ return 0;
}