From f73de50a0847d346f629bb6b4025fee620376c1a Mon Sep 17 00:00:00 2001 From: James Betker Date: Sun, 27 Dec 2015 23:59:34 -0600 Subject: [PATCH] Make code useable from C++ --- gps.h | 8 ++++++++ kalman.h | 8 ++++++++ matrix.h | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/gps.h b/gps.h index a209df4..25e515d 100644 --- a/gps.h +++ b/gps.h @@ -15,6 +15,10 @@ #include #include "kalman.h" +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + /* Create a GPS filter that only tracks two dimensions of position and velocity. The inherent assumption is that changes in velocity are randomly @@ -56,4 +60,8 @@ double calculate_mph(double lat, double lon, /* Extract speed in miles per hour from a velocity2d Kalman filter. */ double get_mph(KalmanFilter f); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif diff --git a/kalman.h b/kalman.h index d66f96f..2f317bf 100644 --- a/kalman.h +++ b/kalman.h @@ -3,6 +3,10 @@ #include "matrix.h" +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + /* Refer to http://en.wikipedia.org/wiki/Kalman_filter for mathematical details. The naming scheme is that variables get names that make sense, and are commented with their analog in @@ -86,4 +90,8 @@ void predict(KalmanFilter f); /* Just the estimation phase of update. */ void estimate(KalmanFilter f); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif diff --git a/matrix.h b/matrix.h index ce4e2fa..050d6a8 100644 --- a/matrix.h +++ b/matrix.h @@ -1,6 +1,10 @@ #ifndef __MATRIX_H__ #define __MATRIX_H__ +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + typedef struct { /* Dimensions */ int rows; @@ -73,4 +77,8 @@ void shear_row(Matrix m, int r1, int r2, double scalar); input is mutated as well by this routine. */ int destructive_invert_matrix(Matrix input, Matrix output); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif