changeset 421:166312a124bc api-inversion

Code spaghettification continues. Include accumulator.h in audioDB.h. This means we also need audioDB_API.h in there, to get the definition of adb_result_t. Use preprocessor defines to prevent audioDB_API.h from being included multiple times. Include an accumulator field in class audioDB.
author mas01cr
date Wed, 24 Dec 2008 10:54:59 +0000
parents 580f696c817c
children a7d61291fbda
files accumulator_test.cpp accumulators.h audioDB.h audioDB_API.h
diffstat 4 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/accumulator_test.cpp	Wed Dec 24 10:54:55 2008 +0000
+++ b/accumulator_test.cpp	Wed Dec 24 10:54:59 2008 +0000
@@ -1,3 +1,9 @@
+#include "audioDB.h"
+extern "C" {
+#include "audioDB_API.h"
+}
+#include "audioDB-internals.h"
+
 #include "accumulators.h"
 
 static NearestAccumulator<adb_result_dist_lt> *foo = new NearestAccumulator<adb_result_dist_lt>();
--- a/accumulators.h	Wed Dec 24 10:54:55 2008 +0000
+++ b/accumulators.h	Wed Dec 24 10:54:59 2008 +0000
@@ -7,12 +7,6 @@
 #include <map>
 #include <functional>
 
-#include "audioDB.h"
-extern "C" {
-#include "audioDB_API.h"
-}
-#include "audioDB-internals.h"
-
 #include "accumulator.h"
 #include "dbaccumulator.h"
 #include "pertrackaccumulator.h"
--- a/audioDB.h	Wed Dec 24 10:54:55 2008 +0000
+++ b/audioDB.h	Wed Dec 24 10:54:59 2008 +0000
@@ -20,7 +20,11 @@
 #include <gsl/gsl_rng.h>
 
 // includes for LSH indexing
+extern "C" {
+#include "audioDB_API.h"
+}
 #include "ReporterBase.h"
+#include "accumulator.h"
 #include "lshlib.h"
 
 // includes for web services
@@ -300,6 +304,7 @@
   double relative_threshold;
   
   ReporterBase* reporter;  // track/point reporter
+  Accumulator *accumulator;
   priority_queue<PointPair, std::vector<PointPair>, std::less<PointPair> >* exact_evaluation_queue;
 
   // Timers
@@ -490,6 +495,7 @@
     use_relative_threshold(false),		\
     relative_threshold(0.0),			\
     reporter(0),                                \
+    accumulator(0),                             \
     exact_evaluation_queue(0),                  \
     lisztOffset(0),                             \
     lisztLength(0),                             \
--- a/audioDB_API.h	Wed Dec 24 10:54:55 2008 +0000
+++ b/audioDB_API.h	Wed Dec 24 10:54:59 2008 +0000
@@ -1,3 +1,6 @@
+#ifndef AUDIODB_API_H
+#define AUDIODB_API_H
+
 #include <stdbool.h>
 #include <stdint.h>
 
@@ -182,3 +185,5 @@
 
 /* varoius dump formats */
 int audiodb_dump(adb_ptr mydb, const char *outputdir);
+
+#endif