summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-11-27 19:37:49 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-11-27 19:37:49 +0100
commite0101834ae2b156b70cee5202a1d22cc92365c8a (patch)
tree5453dda1c3c56d7386cf2b38da3c64426c2f5ca9 /src
parente322219b2057053be0cf72278062702df3886aaa (diff)
downloadODR-AudioEnc-e0101834ae2b156b70cee5202a1d22cc92365c8a.tar.gz
ODR-AudioEnc-e0101834ae2b156b70cee5202a1d22cc92365c8a.tar.bz2
ODR-AudioEnc-e0101834ae2b156b70cee5202a1d22cc92365c8a.zip
mot-encoder: refactor database
Diffstat (limited to 'src')
-rw-r--r--src/mot-encoder.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp
index 561406b..832ad50 100644
--- a/src/mot-encoder.cpp
+++ b/src/mot-encoder.cpp
@@ -168,7 +168,7 @@ class History {
int get_fidx(const char* filepath);
private:
- std::deque<fingerprint_t> database;
+ std::deque<fingerprint_t> m_database;
size_t m_hist_size;
@@ -273,7 +273,6 @@ int main(int argc, char *argv[])
const char* dir = NULL;
const char* output = "/tmp/pad.fifo";
const char* dls_file = NULL;
-
const struct option longopts[] = {
{"dir", required_argument, 0, 'd'},
@@ -424,7 +423,7 @@ int main(int argc, char *argv[])
sleep(sleepdelay);
}
- if (slides_to_transmit.size() == 0) {
+ if (slides_to_transmit.empty()) {
sleep(sleepdelay);
}
@@ -435,7 +434,6 @@ int main(int argc, char *argv[])
writeDLS(output_fd, dls_file, padlen);
sleep(sleepdelay);
-
}
if (pDir) {
@@ -1175,10 +1173,10 @@ int get_xpadlengthmask(int padlen)
int History::find(const fingerprint_t& fp) const
{
size_t i;
- for (i = 0; i < database.size(); i++) {
- if (database[i] == fp) {
+ for (i = 0; i < m_database.size(); i++) {
+ if (m_database[i] == fp) {
// return the id of fingerprint found
- return database[i].fidx;
+ return m_database[i].fidx;
}
}
@@ -1188,10 +1186,10 @@ int History::find(const fingerprint_t& fp) const
void History::add(fingerprint_t& fp)
{
- database.push_back(fp);
+ m_database.push_back(fp);
- if (database.size() > m_hist_size) {
- database.pop_front();
+ if (m_database.size() > m_hist_size) {
+ m_database.pop_front();
}
}
@@ -1199,13 +1197,13 @@ void History::disp_database()
{
size_t id;
printf("HISTORY DATABASE:\n");
- if (database.size() == 0) {
+ if (m_database.empty()) {
printf(" empty\n");
}
else {
- for (id = 0; id < database.size(); id++) {
+ for (id = 0; id < m_database.size(); id++) {
printf(" id %4d: ", id);
- database[id].disp();
+ m_database[id].disp();
}
}
printf("-----------------\n");