Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename include/xbt/{future.hpp => promise.hpp}.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 22 Feb 2021 10:33:39 +0000 (11:33 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 22 Feb 2021 12:55:25 +0000 (13:55 +0100)
Rationale: avoid confusion with include/simgrid/kernel/future.hpp in coverage measures.

MANIFEST.in
include/simgrid/kernel/future.hpp
include/simgrid/simix.hpp
include/simgrid/simix/blocking_simcall.hpp
include/xbt/promise.hpp [moved from include/xbt/future.hpp with 78% similarity]
teshsuite/kernel/simcall-generic/simcall-generic.cpp
tools/cmake/DefinePackages.cmake

index 431acaa..afc88e4 100644 (file)
@@ -2045,7 +2045,6 @@ include include/xbt/ex.h
 include include/xbt/file.hpp
 include include/xbt/function_types.h
 include include/xbt/functional.hpp
-include include/xbt/future.hpp
 include include/xbt/graph.h
 include include/xbt/log.h
 include include/xbt/log.hpp
@@ -2054,6 +2053,7 @@ include include/xbt/misc.h
 include include/xbt/module.h
 include include/xbt/parmap.h
 include include/xbt/parse_units.hpp
+include include/xbt/promise.hpp
 include include/xbt/random.hpp
 include include/xbt/range.hpp
 include include/xbt/replay.hpp
index b0be4b1..ec2c7a4 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <xbt/base.h>
 #include <xbt/functional.hpp>
-#include <xbt/future.hpp>
+#include <xbt/promise.hpp>
 
 namespace simgrid {
 namespace kernel {
index dbafbfa..b6bea16 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <simgrid/simix.h>
 #include <xbt/functional.hpp>
-#include <xbt/future.hpp>
+#include <xbt/promise.hpp>
 #include <xbt/signal.hpp>
 #include <xbt/utility.hpp>
 
index b0258a2..8a4c433 100644 (file)
 
 #include <xbt/sysdep.h>
 
-#include <xbt/future.hpp>
 #include <simgrid/kernel/future.hpp>
 #include <simgrid/simix.h>
 #include <simgrid/simix.hpp>
+#include <xbt/promise.hpp>
 
 namespace simgrid {
 namespace simix {
similarity index 78%
rename from include/xbt/future.hpp
rename to include/xbt/promise.hpp
index 0c850ee..83f4e53 100644 (file)
@@ -4,8 +4,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef XBT_FUTURE_HPP
-#define XBT_FUTURE_HPP
+#ifndef XBT_PROMISE_HPP
+#define XBT_PROMISE_HPP
 
 #include <cstddef>
 
@@ -28,25 +28,12 @@ namespace xbt {
  *
  *  Also the name is not so great.
  **/
-template<class T>
-class Result {
+template <class T> class Result {
 public:
-  bool is_valid() const
-  {
-    return value_.which() > 0;
-  }
-  void set_exception(std::exception_ptr e)
-  {
-    value_ = std::move(e);
-  }
-  void set_value(T&& value)
-  {
-    value_ = std::move(value);
-  }
-  void set_value(T const& value)
-  {
-    value_ = value;
-  }
+  bool is_valid() const { return value_.which() > 0; }
+  void set_exception(std::exception_ptr e) { value_ = std::move(e); }
+  void set_value(T&& value) { value_ = std::move(value); }
+  void set_value(T const& value) { value_ = value; }
 
   /** Extract the value from the future
    *
@@ -75,32 +62,16 @@ private:
   boost::variant<boost::blank, T, std::exception_ptr> value_;
 };
 
-template<>
-class Result<void> : public Result<std::nullptr_t>
-{
+template <> class Result<void> : public Result<std::nullptr_t> {
 public:
-  void set_value()
-  {
-    Result<std::nullptr_t>::set_value(nullptr);
-  }
-  void get()
-  {
-    Result<std::nullptr_t>::get();
-  }
+  void set_value() { Result<std::nullptr_t>::set_value(nullptr); }
+  void get() { Result<std::nullptr_t>::get(); }
 };
 
-template<class T>
-class Result<T&> : public Result<std::reference_wrapper<T>>
-{
+template <class T> class Result<T&> : public Result<std::reference_wrapper<T>> {
 public:
-  void set_value(T& value)
-  {
-    Result<std::reference_wrapper<T>>::set_value(std::ref(value));
-  }
-  T& get()
-  {
-    return Result<std::reference_wrapper<T>>::get();
-  }
+  void set_value(T& value) { Result<std::reference_wrapper<T>>::set_value(std::ref(value)); }
+  T& get() { return Result<std::reference_wrapper<T>>::get(); }
 };
 
 /** Execute some code and set a promise or result accordingly
@@ -156,7 +127,6 @@ template <class P, class F> inline void set_promise(P& promise, F&& future)
 {
   fulfill_promise(promise, [&future] { return std::forward<F>(future).get(); });
 }
-
 }
 }
 
index c2a1ecd..3e9adcf 100644 (file)
@@ -6,7 +6,7 @@
 #include <memory>
 #include <stdexcept>
 
-#include <xbt/future.hpp>
+#include <xbt/promise.hpp>
 
 #include <simgrid/kernel/future.hpp>
 #include <simgrid/s4u/Actor.hpp>
index d66369a..09b32f8 100644 (file)
@@ -758,7 +758,6 @@ set(headers_to_install
   include/xbt/file.hpp
   include/xbt/functional.hpp
   include/xbt/function_types.h
-  include/xbt/future.hpp
   include/xbt/graph.h
   include/xbt/log.h
   include/xbt/log.hpp
@@ -768,6 +767,7 @@ set(headers_to_install
   include/xbt/PropertyHolder.hpp
   include/xbt/parmap.h
   include/xbt/parse_units.hpp
+  include/xbt/promise.hpp
   include/xbt/range.hpp
   include/xbt/random.hpp
   include/xbt/replay.hpp