From 7e96d5e9e7ee640ee4872b270d635f816419f06c Mon Sep 17 00:00:00 2001
From: joanvallve <jvallve@iri.upc.edu>
Date: Fri, 10 Apr 2020 11:49:26 +0200
Subject: [PATCH] moved common includes and typedefs to gnss_utils.h

---
 include/gnss_utils/gnss_utils.h   | 36 ++++++++++++++++++++++++++++++-
 include/gnss_utils/navigation.h   |  7 ------
 include/gnss_utils/observations.h | 14 ------------
 include/gnss_utils/snapshot.h     | 13 +----------
 include/gnss_utils/tdcp.h         | 12 +----------
 src/tdcp.cpp                      | 12 ++++-------
 6 files changed, 41 insertions(+), 53 deletions(-)

diff --git a/include/gnss_utils/gnss_utils.h b/include/gnss_utils/gnss_utils.h
index 4d9f83f..0c32ca8 100644
--- a/include/gnss_utils/gnss_utils.h
+++ b/include/gnss_utils/gnss_utils.h
@@ -5,4 +5,38 @@ extern "C" {
 #include "rtklib.h"
 }
 
-#endif
\ No newline at end of file
+// std includes
+#include <set>
+#include <map>
+#include <vector>
+#include <iostream>
+#include <memory>
+#include <cassert>
+// eigen
+#include <eigen3/Eigen/Dense>
+
+namespace GnssUtils
+{
+
+// forward declarations
+class Observations;
+class Navigation;
+class Snapshot;
+
+// Typedefs
+typedef std::map<int,Eigen::Vector3d> SatellitesPositions;
+
+// pointer typedefs
+typedef std::shared_ptr<Observations>       ObservationsPtr;
+typedef std::shared_ptr<const Observations> ObservationsConstPtr;
+
+typedef std::shared_ptr<Navigation>         NavigationPtr;
+typedef std::shared_ptr<const Navigation>   NavigationConstPtr;
+
+typedef std::shared_ptr<Snapshot>           SnapshotPtr;
+typedef std::shared_ptr<const Snapshot>     SnapshotConstPtr;
+
+
+}
+
+#endif
diff --git a/include/gnss_utils/navigation.h b/include/gnss_utils/navigation.h
index 95b3ad0..861742e 100644
--- a/include/gnss_utils/navigation.h
+++ b/include/gnss_utils/navigation.h
@@ -1,17 +1,10 @@
 #ifndef INCLUDE_GNSS_UTILS_NAVIGATION_H_
 #define INCLUDE_GNSS_UTILS_NAVIGATION_H_
 
-#include <vector>
-#include <iostream>
-#include <memory>
-
 #include "gnss_utils/gnss_utils.h"
 
 namespace GnssUtils
 {
-class Navigation;
-typedef std::shared_ptr<Navigation>       NavigationPtr;
-typedef std::shared_ptr<const Navigation> NavigationConstPtr;
 
 class Navigation
 {
diff --git a/include/gnss_utils/observations.h b/include/gnss_utils/observations.h
index caba378..0a94fbc 100644
--- a/include/gnss_utils/observations.h
+++ b/include/gnss_utils/observations.h
@@ -1,24 +1,10 @@
 #ifndef INCLUDE_GNSS_UTILS_OBSERVATIONS_H_
 #define INCLUDE_GNSS_UTILS_OBSERVATIONS_H_
 
-#include <vector>
-#include <map>
-#include <set>
-#include <iostream>
-#include <memory>
-#include <cassert>
-
-#include <eigen3/Eigen/Dense>
-
 #include "gnss_utils/gnss_utils.h"
 
 namespace GnssUtils
 {
-class Observations;
-typedef std::shared_ptr<Observations>       ObservationsPtr;
-typedef std::shared_ptr<const Observations> ObservationsConstPtr;
-
-typedef std::map<int,Eigen::Vector3d> SatellitesPositions;
 
 class Observations
 {
diff --git a/include/gnss_utils/snapshot.h b/include/gnss_utils/snapshot.h
index 8ba30db..6d8f1dc 100644
--- a/include/gnss_utils/snapshot.h
+++ b/include/gnss_utils/snapshot.h
@@ -14,20 +14,9 @@
 namespace GnssUtils
 {
 
-// forward declarations
-class Observations;
-class Navigation;
-typedef std::map<int,Eigen::Vector3d> SatellitesPositions;
-typedef std::shared_ptr<Observations>   ObservationsPtr;
-typedef std::shared_ptr<Navigation>     NavigationPtr;
-
-class Snapshot;
-typedef std::shared_ptr<Snapshot>       SnapshotPtr;
-typedef std::shared_ptr<const Snapshot> SnapshotConstPtr;
-
-
 class Snapshot
 {
+
 public:
   // Constructor & Destructor
   Snapshot();
diff --git a/include/gnss_utils/tdcp.h b/include/gnss_utils/tdcp.h
index 10e280d..45504e0 100644
--- a/include/gnss_utils/tdcp.h
+++ b/include/gnss_utils/tdcp.h
@@ -1,19 +1,9 @@
-/*
- * tdcp.h
- *
- *  Created on: Dec 4, 2019
- *      Author: jvallve
- */
-
 #ifndef INCLUDE_GNSS_UTILS_TDCP_H_
 #define INCLUDE_GNSS_UTILS_TDCP_H_
 
 #define GNSS_UTILS_TDCP_DEBUG 1
 
-#include <set>
-#include "gnss_utils/utils/rcv_position.h"
-#include "utils/satellite.h"
-#include "gnss_utils/snapshot.h"
+#include "gnss_utils/gnss_utils.h"
 
 namespace GnssUtils
 {
diff --git a/src/tdcp.cpp b/src/tdcp.cpp
index cfe42cc..e105a69 100644
--- a/src/tdcp.cpp
+++ b/src/tdcp.cpp
@@ -1,11 +1,7 @@
-/*
- * tdcp.cpp
- *
- *  Created on: Dec 4, 2019
- *      Author: jvallve
- */
-
 #include "gnss_utils/tdcp.h"
+#include "gnss_utils/utils/rcv_position.h"
+#include "gnss_utils/utils/satellite.h"
+#include "gnss_utils/snapshot.h"
 
 namespace GnssUtils
 {
@@ -297,7 +293,7 @@ bool Tdcp(SnapshotPtr               snapshot_r,
             printf("Ref distance      = %7.3f m\n", d_0.norm());
             printf("Computed distance = %7.3f m\n", d.head<3>().norm());
             printf("Tdcp: residual      = %13.10f\n", residual);
-            printf("Tdcp: row           = %i\n", r.rows());
+            printf("Tdcp: row           = %lu\n", r.rows());
             std::cout << "Tdcp: drho          = " << r.transpose() << std::endl;
             std::cout << "Tdcp: drho_m        = " << drho_m.transpose() << std::endl;
             std::cout << "Tdcp: H             = \n" << A << std::endl;
-- 
GitLab