summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-27 00:26:40 +0000
committerDavid Robillard <d@drobilla.net>2007-07-27 00:26:40 +0000
commite3899fa6e89b7839c920fbfbb20237963d7e538d (patch)
tree0d6af8bbf5aa96ec1cb30eea8b14d0fcb22e23f6
parent9361bc8fbcad0454f646c4c973bb9607967c3f87 (diff)
downloadraul-e3899fa6e89b7839c920fbfbb20237963d7e538d.tar.gz
raul-e3899fa6e89b7839c920fbfbb20237963d7e538d.tar.bz2
raul-e3899fa6e89b7839c920fbfbb20237963d7e538d.zip
Use uint32_t for num_ports (and poly), matches LV2 and size_t is excessive on 64-bit.
Remove (linear) sorted assertion from Table, except in unit tests. git-svn-id: http://svn.drobilla.net/lad/raul@643 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--raul/Table.hpp4
-rw-r--r--raul/TableImpl.hpp10
-rw-r--r--tests/Makefile.am2
3 files changed, 13 insertions, 3 deletions
diff --git a/raul/Table.hpp b/raul/Table.hpp
index 4ab449c..9fd672a 100644
--- a/raul/Table.hpp
+++ b/raul/Table.hpp
@@ -21,6 +21,8 @@
#include <vector>
#include <algorithm>
+//#define TABLE_SORT_DEBUG
+
namespace Raul {
@@ -98,7 +100,7 @@ public:
iterator end() { return iterator(*this, size()); }
private:
-#ifndef NDEBUG
+#ifdef TABLE_SORT_DEBUG
bool is_sorted() const;
#endif
diff --git a/raul/TableImpl.hpp b/raul/TableImpl.hpp
index c1ed938..1bb4699 100644
--- a/raul/TableImpl.hpp
+++ b/raul/TableImpl.hpp
@@ -31,7 +31,7 @@ namespace Raul {
* std::vector::iterator or vice-versa should be shot and pissed on.
*/
-#ifndef NDEBUG
+#ifdef TABLE_SORT_DEBUG
template <typename K, typename T>
bool
Table<K,T>::is_sorted() const
@@ -231,7 +231,9 @@ Table<K, T>::cram(const Table<K,T>& range)
std::cerr << "********************************\n";*/
assert(size() == orig_size + range.size());
+#ifdef TABLE_SORT_DEBUG
assert(is_sorted());
+#endif
return make_pair(iterator(*this, insert_index), true);
}
@@ -299,7 +301,9 @@ Table<K,T>::insert(const std::pair<K, T>& entry)
_entries[i] = entry;
+#ifdef TABLE_SORT_DEBUG
assert(is_sorted());
+#endif
return std::make_pair(iterator(*this, i), true);
}
@@ -350,7 +354,9 @@ Table<K,T>::erase(iterator i)
_entries.pop_back();
+#ifdef TABLE_SORT_DEBUG
assert(is_sorted());
+#endif
}
@@ -383,7 +389,9 @@ Table<K,T>::erase_by_index(size_t first_index, size_t last_index)
_entries.resize(size() - num_removed);
+#ifdef TABLE_SORT_DEBUG
assert(is_sorted());
+#endif
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ae3db13..f18bcc9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
if BUILD_TESTS
-AM_CXXFLAGS = -I.. -lpthread @REDLAND_CFLAGS@ @GLIBMM_CFLAGS@
+AM_CXXFLAGS = -I.. -lpthread @REDLAND_CFLAGS@ @GLIBMM_CFLAGS@ -DTABLE_SORT_DEBUG
ALL_LIBS = @REDLAND_LIBS@ @GLIBMM_LIBS@ ../src/libraul.la
noinst_PROGRAMS = \