Commit b524a6c3 authored by Dominik Charousset's avatar Dominik Charousset

optional => maybe

parent a6d1df77
......@@ -74,7 +74,7 @@ public:
typename detail::tl_filter<arg_types, is_input_arg>::type;
using input_types =
typename detail::tl_map<input_wrapped_types, extract_type>::type;
using input_mapping = std::function<optional<message> (message&)>;
using input_mapping = std::function<maybe<message> (message&)>;
using output_wrapped_types =
typename detail::tl_filter<arg_types, is_output_arg>::type;
......
......@@ -25,7 +25,7 @@
#include <type_traits>
#include "caf/message.hpp"
#include "caf/optional.hpp"
#include "caf/maybe.hpp"
namespace caf {
namespace opencl {
......@@ -56,7 +56,7 @@ struct out {
out() { }
template <class F>
out(F fun) {
fun_ = [fun](message& msg) -> optional<size_t> {
fun_ = [fun](message& msg) -> maybe<size_t> {
auto res = msg.apply(fun);
size_t result;
if (res) {
......@@ -66,10 +66,10 @@ struct out {
return none;
};
}
optional<size_t> operator()(message& msg) const {
maybe<size_t> operator()(message& msg) const {
return fun_ ? fun_(msg) : 0;
}
std::function<optional<size_t> (message&)> fun_;
std::function<maybe<size_t> (message&)> fun_;
};
......
......@@ -27,7 +27,7 @@
#include "caf/all.hpp"
#include "caf/config.hpp"
#include "caf/optional.hpp"
#include "caf/maybe.hpp"
#include "caf/opencl/device.hpp"
#include "caf/opencl/global.hpp"
......@@ -53,11 +53,11 @@ public:
/// (Returns only devices of the first discovered platform).
const std::vector<device>& get_devices() const CAF_DEPRECATED;
/// Get the device with id. These ids are assigned sequientally to all available devices.
const optional<const device&> get_device(size_t id = 0) const;
const maybe<const device&> get_device(size_t id = 0) const;
/// Get the first device that satisfies the predicate.
/// The predicate should accept a `const device&` and return a bool;
template <class UnaryPredicate>
const optional<const device&> get_device_if(UnaryPredicate p) const {
const maybe<const device&> get_device_if(UnaryPredicate p) const {
for (auto& pl : platforms_) {
for (auto& dev : pl.get_devices()) {
if (p(dev))
......
......@@ -23,7 +23,7 @@
#include <algorithm>
#include <functional>
#include "caf/optional.hpp"
#include "caf/maybe.hpp"
#include "caf/actor_cast.hpp"
#include "caf/detail/limited_vector.hpp"
......@@ -43,7 +43,7 @@ struct tuple_construct { };
template <class... Ts>
struct cl_spawn_helper {
using impl = opencl::actor_facade<Ts...>;
using map_in_fun = std::function<optional<message> (message&)>;
using map_in_fun = std::function<maybe<message> (message&)>;
using map_out_fun = typename impl::output_mapping;
actor operator()(const opencl::program& p, const char* fn,
......@@ -177,7 +177,7 @@ template <class Fun, class... Ts>
actor spawn_cl(const opencl::program& prog,
const char* fname,
const opencl::spawn_config& config,
std::function<optional<message> (message&)> map_args,
std::function<maybe<message> (message&)> map_args,
Fun map_result,
Ts... xs) {
detail::cl_spawn_helper<Ts...> f;
......@@ -194,7 +194,7 @@ template <class Fun, class... Ts>
actor spawn_cl(const char* source,
const char* fname,
const opencl::spawn_config& config,
std::function<optional<message> (message&)> map_args,
std::function<maybe<message> (message&)> map_args,
Fun map_result,
Ts... xs) {
detail::cl_spawn_helper<Ts...> f;
......@@ -227,7 +227,7 @@ actor spawn_cl(const char* source,
template <class Signature, class Fun>
actor spawn_cl(const opencl::program& prog,
const char* fname,
std::function<optional<message> (message&)> map_args,
std::function<maybe<message> (message&)> map_args,
Fun map_result,
const opencl::dim_vec& dims,
const opencl::dim_vec& offset = {},
......@@ -237,7 +237,7 @@ actor spawn_cl(const opencl::program& prog,
template <class Signature, class Fun>
actor spawn_cl(const char* source,
const char* fname,
std::function<optional<message> (message&)> map_args,
std::function<maybe<message> (message&)> map_args,
Fun map_result,
const opencl::dim_vec& dims,
const opencl::dim_vec& offset = {},
......@@ -286,7 +286,7 @@ actor spawn_cl(const char* source,
template <class Signature, class Fun>
actor spawn_cl(const opencl::program& prog,
const char* fname,
std::function<optional<message> (message&)> map_args,
std::function<maybe<message> (message&)> map_args,
Fun map_result,
const opencl::dim_vec& dims,
const opencl::dim_vec& offset,
......@@ -305,7 +305,7 @@ actor spawn_cl(const opencl::program& prog,
template <class Signature, class Fun>
actor spawn_cl(const char* source,
const char* fname,
std::function<optional<message> (message&)> map_args,
std::function<maybe<message> (message&)> map_args,
Fun map_result,
const opencl::dim_vec& dims,
const opencl::dim_vec& offset,
......
......@@ -145,7 +145,7 @@ void multiplier(event_based_actor* self) {
cout << "calculating square of matrix:" << endl
<< to_string(m1) << endl;
auto unbox_args = [](message& msg) -> optional<message> {
auto unbox_args = [](message& msg) -> maybe<message> {
return msg.apply(
[](matrix_type& lhs, matrix_type& rhs) {
return make_message(std::move(lhs.data()), std::move(rhs.data()));
......
......@@ -37,7 +37,7 @@ const std::vector<device>& metainfo::get_devices() const {
return platforms_.front().get_devices();
}
const optional<const device&> metainfo::get_device(size_t id) const{
const maybe<const device&> metainfo::get_device(size_t id) const{
if (platforms_.empty())
return none;
size_t to = 0;
......
......@@ -252,7 +252,7 @@ void test_opencl() {
}
);
const matrix_type expected2(move(expected1));
auto map_arg = [](message& msg) -> optional<message> {
auto map_arg = [](message& msg) -> maybe<message> {
return msg.apply(
[](matrix_type& mx) {
return make_message(move(mx.data()));
......
......@@ -208,7 +208,7 @@ void test_opencl_deprecated() {
}
);
const matrix_type expected2(std::move(expected1));
auto map_arg = [](message& msg) -> optional<message> {
auto map_arg = [](message& msg) -> maybe<message> {
return msg.apply(
[](matrix_type& mx) {
return make_message(std::move(mx.data()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment