[mlpack] 25/324: Refactor core.hpp into two files; one for non-mlpack includes, and one for everything else.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:21:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 4fa92d1cfb43402212146c71cf2228df88691344
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
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.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16557 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list