[mlpack-git] master: Add Range::Serialize(). (88f8ef2)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Fri Jul 10 18:59:30 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/4a97187bbba7ce8a6191b714949dd818ef0f37d2...e5905e62c15d1bcff21e6359b11efcd7ab6d7ca0

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

commit 88f8ef26d85532f67e953abfe3100221e0113b34
Author: Ryan Curtin <ryan at ratml.org>
Date:   Sat Apr 18 01:32:04 2015 +0000

    Add Range::Serialize().


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

88f8ef26d85532f67e953abfe3100221e0113b34
 src/mlpack/core/math/range.hpp      | 6 ++++++
 src/mlpack/core/math/range_impl.hpp | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/mlpack/core/math/range.hpp b/src/mlpack/core/math/range.hpp
index 3bf68f3..7661c52 100644
--- a/src/mlpack/core/math/range.hpp
+++ b/src/mlpack/core/math/range.hpp
@@ -157,6 +157,12 @@ class Range
   inline bool Contains(const Range& r) const;
 
   /**
+   * Serialize the range object.
+   */
+  template<typename Archive>
+  void Serialize(Archive& ar, const unsigned int version);
+
+  /**
    * Returns a string representation of an object.
    */
   inline std::string ToString() const;
diff --git a/src/mlpack/core/math/range_impl.hpp b/src/mlpack/core/math/range_impl.hpp
index 20b84ce..c3c6a07 100644
--- a/src/mlpack/core/math/range_impl.hpp
+++ b/src/mlpack/core/math/range_impl.hpp
@@ -174,6 +174,14 @@ inline bool Range::Contains(const Range& r) const
   return lo <= r.hi && hi >= r.lo;
 }
 
+//! Serialize the range.
+template<typename Archive>
+void Range::Serialize(Archive& ar, const unsigned int /* version */)
+{
+  ar & data::CreateNVP(hi, "hi");
+  ar & data::CreateNVP(lo, "lo");
+}
+
 /**
  * Returns a string representation of an object.
  */



More information about the mlpack-git mailing list