Commit 61309b2d authored by Joseph Noir's avatar Joseph Noir

Flatten caf::opencl::detail namespace

parent b0e66758
...@@ -20,10 +20,9 @@ ...@@ -20,10 +20,9 @@
#include "caf/detail/type_list.hpp" #include "caf/detail/type_list.hpp"
#include "caf/opencl/arguments.hpp" #include "caf/opencl/command.hpp"
namespace caf { namespace caf {
namespace opencl {
namespace detail { namespace detail {
// signature for the function that is applied to output arguments // signature for the function that is applied to output arguments
...@@ -41,7 +40,7 @@ struct command_sig; ...@@ -41,7 +40,7 @@ struct command_sig;
template <class T, class... Ts> template <class T, class... Ts>
struct command_sig<T, detail::type_list<Ts...>> { struct command_sig<T, detail::type_list<Ts...>> {
using type = command<T, Ts...>; using type = opencl::command<T, Ts...>;
}; };
// derive type for a tuple matching the arguments as mem_refs // derive type for a tuple matching the arguments as mem_refs
...@@ -54,7 +53,5 @@ struct tuple_type_of<detail::type_list<Ts...>> { ...@@ -54,7 +53,5 @@ struct tuple_type_of<detail::type_list<Ts...>> {
}; };
} // namespace detail } // namespace detail
} // namespace opencl
} // namespace caf } // namespace caf
...@@ -30,11 +30,9 @@ ...@@ -30,11 +30,9 @@
inline void intrusive_ptr_add_ref(cltype ptr) { claddref(ptr); } \ inline void intrusive_ptr_add_ref(cltype ptr) { claddref(ptr); } \
inline void intrusive_ptr_release(cltype ptr) { clrelease(ptr); } \ inline void intrusive_ptr_release(cltype ptr) { clrelease(ptr); } \
namespace caf { \ namespace caf { \
namespace opencl { \
namespace detail { \ namespace detail { \
using aliasname = intrusive_ptr<std::remove_pointer<cltype>::type>; \ using aliasname = intrusive_ptr<std::remove_pointer<cltype>::type>; \
} /* namespace detail */ \ } /* namespace detail */ \
} /* namespace opencl */ \
} // namespace caf } // namespace caf
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "caf/opencl/actor_facade.hpp" #include "caf/opencl/actor_facade.hpp"
namespace caf { namespace caf {
namespace opencl {
namespace detail { namespace detail {
struct tuple_construct { }; struct tuple_construct { };
...@@ -62,6 +61,5 @@ struct cl_spawn_helper { ...@@ -62,6 +61,5 @@ struct cl_spawn_helper {
}; };
} // namespace detail } // namespace detail
} // namespace opencl
} // namespace caf } // namespace caf
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "caf/intrusive_ptr.hpp" #include "caf/intrusive_ptr.hpp"
#include "caf/detail/raw_ptr.hpp"
#include "caf/detail/command_helper.hpp"
#include "caf/detail/limited_vector.hpp" #include "caf/detail/limited_vector.hpp"
#include "caf/opencl/global.hpp" #include "caf/opencl/global.hpp"
...@@ -37,10 +39,6 @@ ...@@ -37,10 +39,6 @@
#include "caf/opencl/arguments.hpp" #include "caf/opencl/arguments.hpp"
#include "caf/opencl/opencl_err.hpp" #include "caf/opencl/opencl_err.hpp"
#include "caf/opencl/detail/core.hpp"
#include "caf/opencl/detail/raw_ptr.hpp"
#include "caf/opencl/detail/command_helper.hpp"
namespace caf { namespace caf {
namespace opencl { namespace opencl {
......
...@@ -26,11 +26,8 @@ ...@@ -26,11 +26,8 @@
#include "caf/optional.hpp" #include "caf/optional.hpp"
#include "caf/opencl/mem_ref.hpp" #include "caf/opencl/mem_ref.hpp"
#include "caf/opencl/detail/core.hpp"
namespace caf { namespace caf {
namespace opencl {
namespace detail { namespace detail {
template <class T, class F> template <class T, class F>
...@@ -58,6 +55,8 @@ T try_apply_fun(F& fun, message& msg, const T& fallback) { ...@@ -58,6 +55,8 @@ T try_apply_fun(F& fun, message& msg, const T& fallback) {
} // namespace detail } // namespace detail
namespace opencl {
// Tag classes to mark arguments received in a messages as reference or value // Tag classes to mark arguments received in a messages as reference or value
/// Arguments tagged as `val` are expected as a vector (or value in case /// Arguments tagged as `val` are expected as a vector (or value in case
/// of a private argument). /// of a private argument).
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "caf/abstract_actor.hpp" #include "caf/abstract_actor.hpp"
#include "caf/response_promise.hpp" #include "caf/response_promise.hpp"
#include "caf/detail/raw_ptr.hpp"
#include "caf/detail/scope_guard.hpp" #include "caf/detail/scope_guard.hpp"
#include "caf/opencl/global.hpp" #include "caf/opencl/global.hpp"
...@@ -36,9 +37,6 @@ ...@@ -36,9 +37,6 @@
#include "caf/opencl/arguments.hpp" #include "caf/opencl/arguments.hpp"
#include "caf/opencl/opencl_err.hpp" #include "caf/opencl/opencl_err.hpp"
#include "caf/opencl/detail/core.hpp"
#include "caf/opencl/detail/raw_ptr.hpp"
namespace caf { namespace caf {
namespace opencl { namespace opencl {
......
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once
namespace caf {
namespace detail {
} // namespace detail
namespace opencl {
namespace detail {
using namespace caf::detail;
} // namespace detail
} // namespace opencl
} // namespace caf
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
#include "caf/sec.hpp" #include "caf/sec.hpp"
#include "caf/detail/raw_ptr.hpp"
#include "caf/opencl/global.hpp" #include "caf/opencl/global.hpp"
#include "caf/opencl/opencl_err.hpp" #include "caf/opencl/opencl_err.hpp"
#include "caf/opencl/detail/raw_ptr.hpp"
namespace caf { namespace caf {
namespace opencl { namespace opencl {
......
...@@ -27,16 +27,15 @@ ...@@ -27,16 +27,15 @@
#include "caf/config.hpp" #include "caf/config.hpp"
#include "caf/actor_system.hpp" #include "caf/actor_system.hpp"
#include "caf/detail/raw_ptr.hpp"
#include "caf/detail/spawn_helper.hpp"
#include "caf/opencl/device.hpp" #include "caf/opencl/device.hpp"
#include "caf/opencl/global.hpp" #include "caf/opencl/global.hpp"
#include "caf/opencl/program.hpp" #include "caf/opencl/program.hpp"
#include "caf/opencl/platform.hpp" #include "caf/opencl/platform.hpp"
#include "caf/opencl/actor_facade.hpp" #include "caf/opencl/actor_facade.hpp"
#include "caf/opencl/detail/core.hpp"
#include "caf/opencl/detail/raw_ptr.hpp"
#include "caf/opencl/detail/spawn_helper.hpp"
namespace caf { namespace caf {
namespace opencl { namespace opencl {
......
...@@ -25,33 +25,11 @@ ...@@ -25,33 +25,11 @@
#include "caf/optional.hpp" #include "caf/optional.hpp"
#include "caf/ref_counted.hpp" #include "caf/ref_counted.hpp"
#include "caf/opencl/detail/core.hpp" #include "caf/detail/raw_ptr.hpp"
#include "caf/opencl/detail/raw_ptr.hpp"
namespace caf { namespace caf {
namespace opencl { namespace opencl {
/// Updates the reference types in a message with a given event.
struct msg_adding_event {
msg_adding_event(detail::raw_event_ptr event) : event_(event) {
// nop
}
template <class T, class... Ts>
message operator()(T& x, Ts&... xs) {
return make_message(add_event(std::move(x)), add_event(std::move(xs))...);
}
template <class... Ts>
message operator()(std::tuple<Ts...>& values) {
return apply_args(*this, detail::get_indices(values), values);
}
template <class T>
mem_ref<T> add_event(mem_ref<T> ref) {
ref.set_event(event_);
return std::move(ref);
}
detail::raw_event_ptr event_;
};
// Tag to separate mem_refs from other types in messages. // Tag to separate mem_refs from other types in messages.
struct ref_tag {}; struct ref_tag {};
...@@ -145,9 +123,10 @@ public: ...@@ -145,9 +123,10 @@ public:
} }
mem_ref(mem_ref&& other) = default; mem_ref(mem_ref&& other) = default;
mem_ref& operator=(mem_ref<T>&& other) = default;
mem_ref(const mem_ref& other) = default; mem_ref(const mem_ref& other) = default;
mem_ref& operator=(mem_ref<T>&& other) = default;
mem_ref& operator=(const mem_ref& other) = default; mem_ref& operator=(const mem_ref& other) = default;
~mem_ref() { ~mem_ref() {
// nop // nop
} }
...@@ -176,10 +155,30 @@ private: ...@@ -176,10 +155,30 @@ private:
detail::raw_mem_ptr memory_; detail::raw_mem_ptr memory_;
}; };
/// Updates the reference types in a message with a given event.
struct msg_adding_event {
msg_adding_event(detail::raw_event_ptr event) : event_(event) {
// nop
}
template <class T, class... Ts>
message operator()(T& x, Ts&... xs) {
return make_message(add_event(std::move(x)), add_event(std::move(xs))...);
}
template <class... Ts>
message operator()(std::tuple<Ts...>& values) {
return apply_args(*this, detail::get_indices(values), values);
}
template <class T>
mem_ref<T> add_event(mem_ref<T> ref) {
ref.set_event(event_);
return std::move(ref);
}
detail::raw_event_ptr event_;
};
} // namespace opencl } // namespace opencl
template <class T> template <class T>
struct allowed_unsafe_message_type<opencl::mem_ref<T>> : std::true_type {}; struct allowed_unsafe_message_type<opencl::mem_ref<T>> : std::true_type {};
} // namespace caf } // namespace caf
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
#include "caf/ref_counted.hpp" #include "caf/ref_counted.hpp"
#include "caf/detail/raw_ptr.hpp"
#include "caf/opencl/device.hpp" #include "caf/opencl/device.hpp"
#include "caf/opencl/global.hpp" #include "caf/opencl/global.hpp"
#include "caf/opencl/detail/raw_ptr.hpp"
namespace caf { namespace caf {
namespace opencl { namespace opencl {
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include "caf/opencl/platform.hpp" #include "caf/opencl/platform.hpp"
#include "caf/opencl/opencl_err.hpp" #include "caf/opencl/opencl_err.hpp"
#include "caf/opencl/detail/raw_ptr.hpp"
using namespace std; using namespace std;
namespace caf { namespace caf {
......
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