From ac814ed5f458d72d2c0a99b05a6325fe8ff29992 Mon Sep 17 00:00:00 2001
From: Jose-Luis Blanco-Claraco <joseluisblancoc@gmail.com>
Date: Fri, 12 Sep 2014 23:34:59 +0200
Subject: [PATCH] MSVC fixes after UNUSED_PARAM() additions

---
 .../include/mrpt/utils/CLoadableOptions.h     |  6 +-
 libs/base/src/utils/CLoadableOptions.cpp      |  8 +++
 .../hwdrivers/src/aria/src/ArModuleLoader.cpp |  4 ++
 .../maps/include/mrpt/slam/CHeightGridMap2D.h |  7 +--
 .../include/mrpt/slam/COccupancyGridMap2D.h   |  7 +--
 .../include/mrpt/slam/CRandomFieldGridMap2D.h |  7 +--
 .../mrpt/slam/CReflectivityGridMap2D.h        |  7 +--
 libs/maps/src/maps/CHeightGridMap2D.cpp       | 13 ++++
 .../src/maps/COccupancyGridMap2D_common.cpp   | 12 ++++
 libs/maps/src/maps/CRandomFieldGridMap2D.cpp  | 13 ++++
 libs/maps/src/maps/CReflectivityGridMap2D.cpp | 12 ++++
 libs/obs/include/mrpt/slam/CMetricMap.h       | 47 ++------------
 libs/obs/src/CMetricMap.cpp                   | 63 +++++++++++++++++++
 13 files changed, 134 insertions(+), 72 deletions(-)

diff --git a/libs/base/include/mrpt/utils/CLoadableOptions.h b/libs/base/include/mrpt/utils/CLoadableOptions.h
index 65d9a33668..5c128ca4bb 100644
--- a/libs/base/include/mrpt/utils/CLoadableOptions.h
+++ b/libs/base/include/mrpt/utils/CLoadableOptions.h
@@ -70,11 +70,7 @@ namespace utils
 		 */
 		virtual void  saveToConfigFile(
 			mrpt::utils::CConfigFileBase &target,
-			const std::string            &section) const
-			{
-				MRPT_UNUSED_PARAM(target); MRPT_UNUSED_PARAM(section);
-			    throw std::logic_error("The child class does not implement this method.");
-			}
+			const std::string            &section) const;
 
 		/** Behaves like saveToConfigFile, but you can pass directly a file name and a temporary CConfigFile object will be created automatically to save the file.
 		  * \sa saveToConfigFile, loadFromConfigFileName
diff --git a/libs/base/src/utils/CLoadableOptions.cpp b/libs/base/src/utils/CLoadableOptions.cpp
index a8f396ea21..2b7256a0e9 100644
--- a/libs/base/src/utils/CLoadableOptions.cpp
+++ b/libs/base/src/utils/CLoadableOptions.cpp
@@ -30,6 +30,14 @@ void  CLoadableOptions::loadFromConfigFileName(
 	this->loadFromConfigFile(f,section);
 }
 
+void  CLoadableOptions::saveToConfigFile(
+	mrpt::utils::CConfigFileBase &target,
+	const std::string            &section) const
+{
+	MRPT_UNUSED_PARAM(target); MRPT_UNUSED_PARAM(section);
+	throw std::logic_error("The child class does not implement this method.");
+}
+
 void  CLoadableOptions::saveToConfigFileName(
 	const std::string		&config_file,
 	const std::string		&section) const
diff --git a/libs/hwdrivers/src/aria/src/ArModuleLoader.cpp b/libs/hwdrivers/src/aria/src/ArModuleLoader.cpp
index 6d5f6ea2b2..50bbc02f79 100644
--- a/libs/hwdrivers/src/aria/src/ArModuleLoader.cpp
+++ b/libs/hwdrivers/src/aria/src/ArModuleLoader.cpp
@@ -115,11 +115,15 @@ AREXPORT ArModuleLoader::Status ArModuleLoader::load(const char *modName,
     return(STATUS_FAILED_OPEN);
   }
 
+#ifndef _MSC_VER
   #pragma GCC diagnostic push
   #pragma GCC diagnostic ignored "-fstrict-aliasing"
+#endif
   //func=(bool(*)(ArRobot*,void*))dlsym(handle, "ariaInitModule");
   func=reinterpret_cast<TFunc>( dlsym(handle, "ariaInitModule") );
+#ifndef _MSC_VER
   #pragma GCC diagnostic pop
+#endif
   if (!func || dlerror() != NULL)
   {
     if (!quiet)
diff --git a/libs/maps/include/mrpt/slam/CHeightGridMap2D.h b/libs/maps/include/mrpt/slam/CHeightGridMap2D.h
index 37f3a16cf7..b7b9a4eee9 100644
--- a/libs/maps/include/mrpt/slam/CHeightGridMap2D.h
+++ b/libs/maps/include/mrpt/slam/CHeightGridMap2D.h
@@ -147,12 +147,7 @@ namespace mrpt
 					const CPose3D							&otherMapPose,
 					float									maxDistForCorr = 0.10f,
 					float									maxMahaDistForCorr = 2.0f
-					) const
-			{
-				MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
-				MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
-				return 0;
-			}
+					) const;
 
 			/** The implementation in this class just calls all the corresponding method of the contained metric maps.
 			  */
diff --git a/libs/maps/include/mrpt/slam/COccupancyGridMap2D.h b/libs/maps/include/mrpt/slam/COccupancyGridMap2D.h
index 32789a29d1..29784b158c 100644
--- a/libs/maps/include/mrpt/slam/COccupancyGridMap2D.h
+++ b/libs/maps/include/mrpt/slam/COccupancyGridMap2D.h
@@ -983,12 +983,7 @@ namespace slam
 				const CPose3D							&otherMapPose,
 				float									maxDistForCorr = 0.10f,
 				float									maxMahaDistForCorr = 2.0f
-				) const
-		{
-			MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
-			MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
-			return 0;
-		}
+				) const;
 
 		/** This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >, as an image or in any other applicable way (Notice that other methods to save the map may be implemented in classes implementing this virtual interface).
 		  */
diff --git a/libs/maps/include/mrpt/slam/CRandomFieldGridMap2D.h b/libs/maps/include/mrpt/slam/CRandomFieldGridMap2D.h
index a7cc2b0726..253ed98187 100644
--- a/libs/maps/include/mrpt/slam/CRandomFieldGridMap2D.h
+++ b/libs/maps/include/mrpt/slam/CRandomFieldGridMap2D.h
@@ -245,12 +245,7 @@ namespace slam
 				const CPose3D							&otherMapPose,
 				float									maxDistForCorr = 0.10f,
 				float									maxMahaDistForCorr = 2.0f
-				) const
-		{
-			MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
-			MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
-			return 0;
-		}
+				) const;
 
 
 		/** The implementation in this class just calls all the corresponding method of the contained metric maps.
diff --git a/libs/maps/include/mrpt/slam/CReflectivityGridMap2D.h b/libs/maps/include/mrpt/slam/CReflectivityGridMap2D.h
index 97de2cdd45..0b5afa12e7 100644
--- a/libs/maps/include/mrpt/slam/CReflectivityGridMap2D.h
+++ b/libs/maps/include/mrpt/slam/CReflectivityGridMap2D.h
@@ -108,12 +108,7 @@ namespace mrpt
 					const CPose3D							&otherMapPose,
 					float									maxDistForCorr = 0.10f,
 					float									maxMahaDistForCorr = 2.0f
-					) const
-			{
-				MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
-				MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
-				return 0;
-			}
+					) const;
 
 			/** The implementation in this class just calls all the corresponding method of the contained metric maps.
 			  */
diff --git a/libs/maps/src/maps/CHeightGridMap2D.cpp b/libs/maps/src/maps/CHeightGridMap2D.cpp
index 486f053c27..3c3f8f6d44 100644
--- a/libs/maps/src/maps/CHeightGridMap2D.cpp
+++ b/libs/maps/src/maps/CHeightGridMap2D.cpp
@@ -515,3 +515,16 @@ size_t CHeightGridMap2D::countObservedCells() const
 	default: THROW_EXCEPTION("countObservedCells() not implemented for this mapType (!?)")
 	};
 }
+
+
+float  CHeightGridMap2D::compute3DMatchingRatio(
+	const CMetricMap						*otherMap,
+	const CPose3D							&otherMapPose,
+	float									maxDistForCorr,
+	float									maxMahaDistForCorr
+	) const
+{
+	MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
+	MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
+	return 0;
+}
diff --git a/libs/maps/src/maps/COccupancyGridMap2D_common.cpp b/libs/maps/src/maps/COccupancyGridMap2D_common.cpp
index 6fb0e2170b..5d52ee324c 100644
--- a/libs/maps/src/maps/COccupancyGridMap2D_common.cpp
+++ b/libs/maps/src/maps/COccupancyGridMap2D_common.cpp
@@ -699,3 +699,15 @@ float  COccupancyGridMap2D::computePathCost( float x1, float y1, float x2, float
 	else	return 0;
 }
 
+float  COccupancyGridMap2D::compute3DMatchingRatio(
+	const CMetricMap						*otherMap,
+	const CPose3D							&otherMapPose,
+	float									maxDistForCorr ,
+	float									maxMahaDistForCorr
+	) const
+{
+	MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
+	MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
+	return 0;
+}
+
diff --git a/libs/maps/src/maps/CRandomFieldGridMap2D.cpp b/libs/maps/src/maps/CRandomFieldGridMap2D.cpp
index 5d4a03d73d..47a226fc79 100644
--- a/libs/maps/src/maps/CRandomFieldGridMap2D.cpp
+++ b/libs/maps/src/maps/CRandomFieldGridMap2D.cpp
@@ -2900,3 +2900,16 @@ bool CRandomFieldGridMap2D::exist_relation_between2cells(
 	//cout << "Connection not found (false)" << endl;
 	return false;
 }
+
+float  CRandomFieldGridMap2D::compute3DMatchingRatio(
+	const CMetricMap						*otherMap,
+	const CPose3D							&otherMapPose,
+	float									maxDistForCorr,
+	float									maxMahaDistForCorr
+	) const
+{
+	MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
+	MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
+	return 0;
+}
+
diff --git a/libs/maps/src/maps/CReflectivityGridMap2D.cpp b/libs/maps/src/maps/CReflectivityGridMap2D.cpp
index 356397fffa..e1871f3d51 100644
--- a/libs/maps/src/maps/CReflectivityGridMap2D.cpp
+++ b/libs/maps/src/maps/CReflectivityGridMap2D.cpp
@@ -360,3 +360,15 @@ void  CReflectivityGridMap2D::getAs3DObject( mrpt::opengl::CSetOfObjectsPtr	&out
 
 	MRPT_END
 }
+
+float  CReflectivityGridMap2D::compute3DMatchingRatio(
+	const CMetricMap						*otherMap,
+	const CPose3D							&otherMapPose,
+	float									maxDistForCorr,
+	float									maxMahaDistForCorr
+	) const
+{
+	MRPT_UNUSED_PARAM(otherMap); MRPT_UNUSED_PARAM(otherMapPose);
+	MRPT_UNUSED_PARAM(maxDistForCorr); MRPT_UNUSED_PARAM(maxMahaDistForCorr);
+	return 0;
+}
diff --git a/libs/obs/include/mrpt/slam/CMetricMap.h b/libs/obs/include/mrpt/slam/CMetricMap.h
index 22e11a9194..6cdebaa22b 100644
--- a/libs/obs/include/mrpt/slam/CMetricMap.h
+++ b/libs/obs/include/mrpt/slam/CMetricMap.h
@@ -220,17 +220,7 @@ namespace mrpt
 				const CPose2D         & otherMapPose,
 				TMatchingPairList     & correspondences,
 				const TMatchingParams & params,
-				TMatchingExtraResults & extraResults ) const
-			{
-				MRPT_UNUSED_PARAM(otherMap);
-				MRPT_UNUSED_PARAM(otherMapPose);
-				MRPT_UNUSED_PARAM(correspondences);
-				MRPT_UNUSED_PARAM(params);
-				MRPT_UNUSED_PARAM(extraResults);
-				MRPT_START
-				THROW_EXCEPTION("Virtual method not implemented in derived class.")
-				MRPT_END
-			}
+				TMatchingExtraResults & extraResults ) const;
 
 			/** Computes the matchings between this and another 3D points map - method used in 3D-ICP.
 			 *  This method finds the set of point pairs in each map.
@@ -255,17 +245,7 @@ namespace mrpt
 				const CPose3D         & otherMapPose,
 				TMatchingPairList     & correspondences,
 				const TMatchingParams & params,
-				TMatchingExtraResults & extraResults ) const
-			{
-				MRPT_UNUSED_PARAM(otherMap);
-				MRPT_UNUSED_PARAM(otherMapPose);
-				MRPT_UNUSED_PARAM(correspondences);
-				MRPT_UNUSED_PARAM(params);
-				MRPT_UNUSED_PARAM(extraResults);
-				MRPT_START
-				THROW_EXCEPTION("Virtual method not implemented in derived class.")
-				MRPT_END
-			}
+				TMatchingExtraResults & extraResults ) const;
 
 			/** Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map, whose 6D pose relative to "this" is "otherMapPose"
 			 *   In the case of a multi-metric map, this returns the average between the maps. This method always return 0 for grid maps.
@@ -282,17 +262,7 @@ namespace mrpt
 				const CPose3D							&otherMapPose,
 				float									maxDistForCorr = 0.10f,
 				float									maxMahaDistForCorr = 2.0f
-			) const
-			{
-				MRPT_UNUSED_PARAM(otherMap);
-				MRPT_UNUSED_PARAM(otherMapPose);
-				MRPT_UNUSED_PARAM(maxDistForCorr);
-				MRPT_UNUSED_PARAM(maxMahaDistForCorr);
-				MRPT_START
-				THROW_EXCEPTION("Virtual method not implemented in derived class.")
-				MRPT_END
-			}
-
+			) const;
 
 			/** This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >, as an image or in any other applicable way (Notice that other methods to save the map may be implemented in classes implementing this virtual interface).
 			  */
@@ -318,16 +288,7 @@ namespace mrpt
 
 			/** Returns the square distance from the 2D point (x0,y0) to the closest correspondence in the map.
 			  */
-			virtual float squareDistanceToClosestCorrespondence(
-				float x0,
-				float y0 ) const
-			{
-				MRPT_UNUSED_PARAM(x0);
-				MRPT_UNUSED_PARAM(y0);
-				MRPT_START
-				THROW_EXCEPTION("Virtual method not implemented in derived class.")
-				MRPT_END
-			}
+			virtual float squareDistanceToClosestCorrespondence(float x0,float y0 ) const;
 
 
 			/** If the map is a simple points map or it's a multi-metric map that contains EXACTLY one simple points map, return it.
diff --git a/libs/obs/src/CMetricMap.cpp b/libs/obs/src/CMetricMap.cpp
index 1561af9a21..9b82e42cdb 100644
--- a/libs/obs/src/CMetricMap.cpp
+++ b/libs/obs/src/CMetricMap.cpp
@@ -138,3 +138,66 @@ bool CMetricMap::insertObservationPtr(
 bool CMetricMap::canComputeObservationLikelihood( const CObservationPtr &obs ) {
 	return canComputeObservationLikelihood(obs.pointer());
 }
+
+void  CMetricMap::determineMatching2D(
+	const CMetricMap      * otherMap,
+	const CPose2D         & otherMapPose,
+	TMatchingPairList     & correspondences,
+	const TMatchingParams & params,
+	TMatchingExtraResults & extraResults ) const
+{
+	MRPT_UNUSED_PARAM(otherMap);
+	MRPT_UNUSED_PARAM(otherMapPose);
+	MRPT_UNUSED_PARAM(correspondences);
+	MRPT_UNUSED_PARAM(params);
+	MRPT_UNUSED_PARAM(extraResults);
+	MRPT_START
+	THROW_EXCEPTION("Virtual method not implemented in derived class.")
+	MRPT_END
+}
+
+
+void CMetricMap::determineMatching3D(
+	const CMetricMap      * otherMap,
+	const CPose3D         & otherMapPose,
+	TMatchingPairList     & correspondences,
+	const TMatchingParams & params,
+	TMatchingExtraResults & extraResults ) const
+{
+	MRPT_UNUSED_PARAM(otherMap);
+	MRPT_UNUSED_PARAM(otherMapPose);
+	MRPT_UNUSED_PARAM(correspondences);
+	MRPT_UNUSED_PARAM(params);
+	MRPT_UNUSED_PARAM(extraResults);
+	MRPT_START
+	THROW_EXCEPTION("Virtual method not implemented in derived class.")
+	MRPT_END
+}
+
+
+float  CMetricMap::compute3DMatchingRatio(
+	const CMetricMap								*otherMap,
+	const CPose3D							&otherMapPose,
+	float									maxDistForCorr,
+	float									maxMahaDistForCorr
+) const
+{
+	MRPT_UNUSED_PARAM(otherMap);
+	MRPT_UNUSED_PARAM(otherMapPose);
+	MRPT_UNUSED_PARAM(maxDistForCorr);
+	MRPT_UNUSED_PARAM(maxMahaDistForCorr);
+	MRPT_START
+	THROW_EXCEPTION("Virtual method not implemented in derived class.")
+	MRPT_END
+}
+
+float CMetricMap::squareDistanceToClosestCorrespondence(
+	float x0,
+	float y0 ) const
+{
+	MRPT_UNUSED_PARAM(x0);
+	MRPT_UNUSED_PARAM(y0);
+	MRPT_START
+	THROW_EXCEPTION("Virtual method not implemented in derived class.")
+	MRPT_END
+}
\ No newline at end of file