[mlpack-git] master,mlpack-1.0.x: Refactor core.hpp into two files; one for non-mlpack includes, and one for everything else. (a9153ab)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:47:53 EST 2015


Repository : https://github.com/mlpack/mlpack

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit a9153ab99479befee17dc20cd931ad172b2e930b
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue May 27 03:35:52 2014 +0000

    Refactor core.hpp into two files; one for non-mlpack includes, and one for everything else.


>---------------------------------------------------------------

a9153ab99479befee17dc20cd931ad172b2e930b
 src/mlpack/core.hpp    | 36 +++---------------------------------
 src/mlpack/prereqs.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 33 deletions(-)

diff --git a/src/mlpack/core.hpp b/src/mlpack/core.hpp
index b381f86..a6374f0 100644
--- a/src/mlpack/core.hpp
+++ b/src/mlpack/core.hpp
@@ -138,40 +138,10 @@
  *   - Andrew Wells <andrewmw94 at gmail.com>
  */
 
-// First, standard includes.
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <float.h>
-#include <stdint.h>
-#include <iostream>
+// First, include all of the prerequisites.
+#include <mlpack/prereqs.hpp>
 
-// Defining _USE_MATH_DEFINES should set M_PI.
-#define _USE_MATH_DEFINES
-#include <math.h>
-
-// For tgamma().
-#include <boost/math/special_functions/gamma.hpp>
-
-// But if it's not defined, we'll do it.
-#ifndef M_PI
-  #define M_PI 3.141592653589793238462643383279
-#endif
-
-// Give ourselves a nice way to force functions to be inline if we need.
-#define force_inline
-#if defined(__GNUG__) && !defined(DEBUG)
-  #undef force_inline
-  #define force_inline __attribute__((always_inline))
-#elif defined(_MSC_VER) && !defined(DEBUG)
-  #undef force_inline
-  #define force_inline __forceinline
-#endif
-
-// Now MLPACK-specific includes.
-#include <mlpack/core/arma_extend/arma_extend.hpp> // Includes Armadillo.
+// Now the core mlpack classes.
 #include <mlpack/core/util/arma_traits.hpp>
 #include <mlpack/core/util/log.hpp>
 #include <mlpack/core/util/cli.hpp>
diff --git a/src/mlpack/prereqs.hpp b/src/mlpack/prereqs.hpp
new file mode 100644
index 0000000..1c15dae
--- /dev/null
+++ b/src/mlpack/prereqs.hpp
@@ -0,0 +1,44 @@
+/**
+ * @file prereqs.hpp
+ *
+ * The core includes that mlpack expects; standard C++ includes and Armadillo.
+ */
+#ifndef __MLPACK_PREREQS_HPP
+#define __MLPACK_PREREQS_HPP
+
+// First, standard includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include <float.h>
+#include <stdint.h>
+#include <iostream>
+
+// Defining _USE_MATH_DEFINES should set M_PI.
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+// For tgamma().
+#include <boost/math/special_functions/gamma.hpp>
+
+// But if it's not defined, we'll do it.
+#ifndef M_PI
+  #define M_PI 3.141592653589793238462643383279
+#endif
+
+// Give ourselves a nice way to force functions to be inline if we need.
+#define force_inline
+#if defined(__GNUG__) && !defined(DEBUG)
+  #undef force_inline
+  #define force_inline __attribute__((always_inline))
+#elif defined(_MSC_VER) && !defined(DEBUG)
+  #undef force_inline
+  #define force_inline __forceinline
+#endif
+
+// Now include Armadillo through the special mlpack extensions.
+#include <mlpack/core/arma_extend/arma_extend.hpp>
+
+#endif



More information about the mlpack-git mailing list