Commit 20a001da authored by Dominik Charousset's avatar Dominik Charousset

Merge branch 'develop'

parents 358cc5bb 7478b485
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(caf C CXX) project(caf C CXX)
# silence policy CMP0042 warning by enabling RPATH explicitly
if(APPLE AND NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH true)
endif()
################################################################################ ################################################################################
# make sure all variables are set to "no" if undefined for summary output # # make sure all variables are set to "no" if undefined for summary output #
...@@ -69,7 +73,7 @@ endif() ...@@ -69,7 +73,7 @@ endif()
################################################################################ ################################################################################
# check for g++ >= 4.7 or clang++ > = 3.2 # check for g++ >= 4.7 or clang++ > = 3.2
if(NOT NO_COMPILER_CHECK) if(NOT WIN32 AND NOT NO_COMPILER_CHECK)
try_run(ProgramResult try_run(ProgramResult
CompilationSucceeded CompilationSucceeded
"${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}"
...@@ -135,17 +139,18 @@ if(ENABLE_ADDRESS_SANITIZER) ...@@ -135,17 +139,18 @@ if(ENABLE_ADDRESS_SANITIZER)
message(STATUS "Enable address sanitizer") message(STATUS "Enable address sanitizer")
endif(ENABLE_ADDRESS_SANITIZER) endif(ENABLE_ADDRESS_SANITIZER)
# -pthread is ignored on MacOSX, enable it for all other platforms # -pthread is ignored on MacOSX, enable it for all other platforms
if(NOT APPLE) if(NOT APPLE AND NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif() endif()
# extra setup steps needed on MinGW # extra setup steps needed on MinGW
if(MINGW) if(MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32") add_definitions(-D_WIN32_WINNT=0x0600)
add_definitions(-DWIN32)
include(GenerateExportHeader) include(GenerateExportHeader)
set(LD_FLAGS "ws2_32 -liphlpapi") set(LD_FLAGS "ws2_32 -liphlpapi")
endif() endif()
# needed by subprojects # needed by subprojects
set(LD_FLAGS ${CMAKE_LD_LIBS}) set(LD_FLAGS ${LD_FLAGS} ${CMAKE_LD_LIBS})
################################################################################ ################################################################################
......
...@@ -9,12 +9,12 @@ network transparent messaging, and more. ...@@ -9,12 +9,12 @@ network transparent messaging, and more.
On the Web On the Web
---------- ----------
* __Project Homepage__: http://www.actor-framework.org * __Homepage__: http://www.actor-framework.org
* __Manual (HTML)__: http://actor-framework.github.io/actor-framework/manual/index.html * __Developer Blog__: http://blog.actor-framework.org
* __Manual (PDF)__: http://actor-framework.github.io/actor-framework/manual/manual.pdf * __Doxygen (HTML)__: http://www.actor-framework.org/doc
* __Doxygen (HTML)__: http://actor-framework.github.io/actor-framework/index.html * __Manual (HTML)__: http://www.actor-framework.org/manual
* __Manual (PDF)__: http://www.actor-framework.org/pdf/manual.pdf
* __Mailing List__: https://groups.google.com/d/forum/actor-framework * __Mailing List__: https://groups.google.com/d/forum/actor-framework
* __Deveoper Blog__: https://libcppa.blogspot.com
Get the Sources Get the Sources
......
...@@ -31,8 +31,13 @@ foreach (comp ${Libcaf_FIND_COMPONENTS}) ...@@ -31,8 +31,13 @@ foreach (comp ${Libcaf_FIND_COMPONENTS})
# look for headers: give CMake hints where to find non-installed CAF versions # look for headers: give CMake hints where to find non-installed CAF versions
# note that we look for the headers of each component individually: this is # note that we look for the headers of each component individually: this is
# necessary to support non-installed versions of CAF, i.e., accessing the # necessary to support non-installed versions of CAF, i.e., accessing the
# checked out "actor-framework" directory structure directly # checked out "actor-framework" or "caf" directory structure directly
set(HDRHINT "actor-framework/libcaf_${comp}") unset(HDRHINT)
foreach(dir ".." "../.." "../../..")
foreach(subdir "actor-framework" "caf")
set(HDRHINT ${HDRHINT} "${dir}/${subdir}/libcaf_${comp}")
endforeach()
endforeach()
find_path(LIBCAF_INCLUDE_DIR_${UPPERCOMP} find_path(LIBCAF_INCLUDE_DIR_${UPPERCOMP}
NAMES NAMES
${HDRNAME} ${HDRNAME}
...@@ -43,9 +48,7 @@ foreach (comp ${Libcaf_FIND_COMPONENTS}) ...@@ -43,9 +48,7 @@ foreach (comp ${Libcaf_FIND_COMPONENTS})
/opt/local/include /opt/local/include
/sw/include /sw/include
${CMAKE_INSTALL_PREFIX}/include ${CMAKE_INSTALL_PREFIX}/include
../${HDRHINT} ${HDRHINT})
../../${HDRHINT}
../../../${HDRHINT})
mark_as_advanced(LIBCAF_INCLUDE_DIR_${UPPERCOMP}) mark_as_advanced(LIBCAF_INCLUDE_DIR_${UPPERCOMP})
if (NOT "${LIBCAF_INCLUDE_DIR_${UPPERCOMP}}" STREQUAL "LIBCAF_INCLUDE_DIR_${UPPERCOMP}-NOTFOUND") if (NOT "${LIBCAF_INCLUDE_DIR_${UPPERCOMP}}" STREQUAL "LIBCAF_INCLUDE_DIR_${UPPERCOMP}-NOTFOUND")
# mark as found (set back to false in case library cannot be found) # mark as found (set back to false in case library cannot be found)
...@@ -63,6 +66,13 @@ foreach (comp ${Libcaf_FIND_COMPONENTS}) ...@@ -63,6 +66,13 @@ foreach (comp ${Libcaf_FIND_COMPONENTS})
# look for (.dll|.so|.dylib) file, again giving hints for non-installed CAFs # look for (.dll|.so|.dylib) file, again giving hints for non-installed CAFs
# skip probe_event as it is header only # skip probe_event as it is header only
if (NOT ${comp} STREQUAL "probe_event") if (NOT ${comp} STREQUAL "probe_event")
unset(LIBHINT)
foreach(dir ".." "../.." "../../..")
foreach(subdir "actor-framework" "caf")
set(LIBHINT ${LIBHINT} "${dir}/${subdir}/build/lib")
endforeach()
endforeach()
message(STATUS "libhint: ${LIBHINT}")
find_library(LIBCAF_LIBRARY_${UPPERCOMP} find_library(LIBCAF_LIBRARY_${UPPERCOMP}
NAMES NAMES
"caf_${comp}" "caf_${comp}"
...@@ -73,9 +83,7 @@ foreach (comp ${Libcaf_FIND_COMPONENTS}) ...@@ -73,9 +83,7 @@ foreach (comp ${Libcaf_FIND_COMPONENTS})
/opt/local/lib /opt/local/lib
/sw/lib /sw/lib
${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib
../actor-framework/build/lib ${LIBHINT})
../../actor-framework/build/lib
../../../actor-framework/build/lib)
mark_as_advanced(LIBCAF_LIBRARY_${UPPERCOMP}) mark_as_advanced(LIBCAF_LIBRARY_${UPPERCOMP})
if ("${LIBCAF_LIBRARY_${UPPERCOMP}}" STREQUAL "LIBCAF_LIBRARY-NOTFOUND") if ("${LIBCAF_LIBRARY_${UPPERCOMP}}" STREQUAL "LIBCAF_LIBRARY-NOTFOUND")
set(Libcaf_${comp}_FOUND false) set(Libcaf_${comp}_FOUND false)
......
...@@ -14,6 +14,17 @@ use this configure script to access CMake equivalent functionality.\ ...@@ -14,6 +14,17 @@ use this configure script to access CMake equivalent functionality.\
command="$0 $*" command="$0 $*"
dirname_0=`dirname $0` dirname_0=`dirname $0`
sourcedir=`cd $dirname_0 && pwd` sourcedir=`cd $dirname_0 && pwd`
benchmark_suite_options=""
if [ -d "$sourcedir/benchmarks/caf" ] ; then
benchmark_suite_options="\
Benchmark Suite Options:
--with-scalac=FILE path to Scala compiler
--with-erlc=FILE path to Erlang compiler
--with-charmc=FILE path to Charm++ compiler
--with-salsa=FILE path to SALSA Lite jar
"
fi
usage="\ usage="\
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
...@@ -68,11 +79,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]... ...@@ -68,11 +79,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
Influential Environment Variables (only on first invocation): Influential Environment Variables (only on first invocation):
CXX C++ compiler command CXX C++ compiler command
CXXFLAGS C++ compiler flags CXXFLAGS C++ compiler flags
$benchmark_suite_options"
Benchmark Suite Options:
--with-scalac=FILE path to scalac executable
--with-erlc=FILE path to erlc executable
"
# Appends a CMake cache entry definition to the CMakeCacheEntries variable. # Appends a CMake cache entry definition to the CMakeCacheEntries variable.
...@@ -290,6 +297,12 @@ while [ $# -ne 0 ]; do ...@@ -290,6 +297,12 @@ while [ $# -ne 0 ]; do
--with-erlc=*) --with-erlc=*)
append_cache_entry CAF_ERLANG_COMPILER FILEPATH "$optarg" append_cache_entry CAF_ERLANG_COMPILER FILEPATH "$optarg"
;; ;;
--with-charmc=*)
append_cache_entry CAF_CHARM_COMPILER FILEPATH "$optarg"
;;
--with-salsa=*)
append_cache_entry CAF_SALSA_JAR FILEPATH "$optarg"
;;
--no-nexus) --no-nexus)
append_cache_entry CAF_NO_NEXUS BOOL yes append_cache_entry CAF_NO_NEXUS BOOL yes
;; ;;
......
#include <iostream> #include <iostream>
#include <chrono>
#include "caf/all.hpp" #include "caf/all.hpp"
#include "caf/io/all.hpp" #include "caf/io/all.hpp"
...@@ -28,48 +29,38 @@ constexpr size_t cstr_size(const char (&)[Size]) { ...@@ -28,48 +29,38 @@ constexpr size_t cstr_size(const char (&)[Size]) {
return Size; return Size;
} }
actor_ostream out(broker* self, const char* role) {
return aout(self) << "[" << role << ":" << self->id() << "] ";
}
actor_ostream wout(broker* self) {
return out(self, "worker");
}
actor_ostream sout(broker* self) {
return out(self, "server");
}
behavior connection_worker(broker* self, connection_handle hdl) { behavior connection_worker(broker* self, connection_handle hdl) {
self->configure_read(hdl, receive_policy::at_most(1024)); self->configure_read(hdl, receive_policy::at_most(1024));
return { return {
[=](const new_data_msg& msg) { [=](const new_data_msg& msg) {
wout(self) << "received HTTP request, send http_ok" << endl;
self->write(msg.handle, cstr_size(http_ok), http_ok); self->write(msg.handle, cstr_size(http_ok), http_ok);
self->quit(); self->quit();
}, },
[=](const connection_closed_msg&) { [=](const connection_closed_msg&) {
wout(self) << "connection closed by remote host, quit" << endl;
self->quit(); self->quit();
} }
}; };
} }
behavior server(broker* self) { behavior server(broker* self) {
sout(self) << "running" << endl; auto counter = std::make_shared<int>(0);
self->delayed_send(self, std::chrono::seconds(1), atom("tick"));
return { return {
[=](const new_connection_msg& ncm) { [=](const new_connection_msg& ncm) {
auto worker = self->fork(connection_worker, ncm.handle); auto worker = self->fork(connection_worker, ncm.handle);
self->monitor(worker); self->monitor(worker);
self->link_to(worker); self->link_to(worker);
sout(self) << "forked connection, handle ID: " << ncm.handle.id()
<< ", worker ID: " << worker.id() << endl;
}, },
[=](const down_msg& dm) { [=](const down_msg&) {
sout(self) << "worker with ID " << dm.source.id() << " is done" << endl; ++*counter;
},
on(atom("tick")) >> [=] {
aout(self) << "Finished " << *counter << " requests per second." << endl;
*counter = 0;
self->delayed_send(self, std::chrono::seconds(1), atom("tick"));
}, },
others() >> [=] { others() >> [=] {
sout(self) << "unexpected: " << to_string(self->last_dequeued()) << endl; aout(self) << "unexpected: " << to_string(self->last_dequeued()) << endl;
} }
}; };
} }
......
...@@ -87,7 +87,7 @@ if (NOT "${CAF_BUILD_STATIC_ONLY}" STREQUAL "yes") ...@@ -87,7 +87,7 @@ if (NOT "${CAF_BUILD_STATIC_ONLY}" STREQUAL "yes")
SOVERSION ${LIBRARY_SOVERSION} SOVERSION ${LIBRARY_SOVERSION}
VERSION ${CAF_VERSION} VERSION ${CAF_VERSION}
OUTPUT_NAME caf_core) OUTPUT_NAME caf_core)
if(NOT MINGW) if(NOT WIN32)
install(TARGETS libcaf_core LIBRARY DESTINATION lib) install(TARGETS libcaf_core LIBRARY DESTINATION lib)
endif() endif()
endif () endif ()
...@@ -96,7 +96,7 @@ endif () ...@@ -96,7 +96,7 @@ endif ()
if ("${CAF_BUILD_STATIC_ONLY}" STREQUAL "yes" OR "${CAF_BUILD_STATIC}" STREQUAL "yes") if ("${CAF_BUILD_STATIC_ONLY}" STREQUAL "yes" OR "${CAF_BUILD_STATIC}" STREQUAL "yes")
add_library(libcaf_coreStatic STATIC ${LIBCAF_CORE_HDRS} ${LIBCAF_CORE_SRCS}) add_library(libcaf_coreStatic STATIC ${LIBCAF_CORE_HDRS} ${LIBCAF_CORE_SRCS})
set_target_properties(libcaf_coreStatic PROPERTIES OUTPUT_NAME caf_core_static) set_target_properties(libcaf_coreStatic PROPERTIES OUTPUT_NAME caf_core_static)
if(NOT MINGW) if(NOT WIN32)
install(TARGETS libcaf_coreStatic ARCHIVE DESTINATION lib) install(TARGETS libcaf_coreStatic ARCHIVE DESTINATION lib)
endif() endif()
endif () endif ()
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -110,10 +110,10 @@ class abstract_actor : public abstract_channel { ...@@ -110,10 +110,10 @@ class abstract_actor : public abstract_channel {
/** /**
* Detaches the first attached object that matches `what`. * Detaches the first attached object that matches `what`.
*/ */
void detach(const attachable::token& what); size_t detach(const attachable::token& what);
template <class T> template <class T>
void detach(const T& what) { size_t detach(const T& what) {
return detach(attachable::token{typeid(T), &what}); return detach(attachable::token{typeid(T), &what});
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -41,6 +41,7 @@ namespace caf { ...@@ -41,6 +41,7 @@ namespace caf {
class group; class group;
class serializer; class serializer;
class local_actor;
class deserializer; class deserializer;
/** /**
...@@ -50,6 +51,7 @@ class abstract_group : public abstract_channel { ...@@ -50,6 +51,7 @@ class abstract_group : public abstract_channel {
public: public:
friend class detail::group_manager; friend class detail::group_manager;
friend class detail::peer_connection; friend class detail::peer_connection;
friend class local_actor;
~abstract_group(); ~abstract_group();
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -61,8 +61,10 @@ class actor_ostream { ...@@ -61,8 +61,10 @@ class actor_ostream {
} }
template <class T> template <class T>
inline typename std::enable_if<!std::is_convertible<T, std::string>::value && !std::is_convertible<T, message>::value, actor_ostream&>::type operator<<( inline typename std::enable_if<
T&& arg) { !std::is_convertible<T, std::string>::value &&
!std::is_convertible<T, message>::value, actor_ostream&
>::type operator<<(T&& arg) {
return write(std::to_string(std::forward<T>(arg))); return write(std::to_string(std::forward<T>(arg)));
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -121,11 +121,11 @@ compound_member(C& (Parent::*getter)(), const Ts&... args) { ...@@ -121,11 +121,11 @@ compound_member(C& (Parent::*getter)(), const Ts&... args) {
template <class Parent, class GRes, class SRes, class SArg, class... Ts> template <class Parent, class GRes, class SRes, class SArg, class... Ts>
std::pair<std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>, std::pair<std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>,
detail::abstract_uniform_type_info< detail::abstract_uniform_type_info<
typename detail::rm_const_and_ref<GRes>::type>*> typename std::decay<GRes>::type>*>
compound_member(const std::pair<GRes (Parent::*)() const, compound_member(const std::pair<GRes (Parent::*)() const,
SRes (Parent::*)(SArg)>& gspair, SRes (Parent::*)(SArg)>& gspair,
const Ts&... args) { const Ts&... args) {
using mtype = typename detail::rm_const_and_ref<GRes>::type; using mtype = typename std::decay<GRes>::type;
return {gspair, new detail::default_uniform_type_info<mtype>(args...)}; return {gspair, new detail::default_uniform_type_info<mtype>(args...)};
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -22,28 +22,12 @@ ...@@ -22,28 +22,12 @@
namespace caf { namespace caf {
template <bool DiscardBehavior> struct keep_behavior_t {
struct behavior_policy { constexpr keep_behavior_t() {
static constexpr bool discard_old = DiscardBehavior; // nop
}
}; };
template <class T>
struct is_behavior_policy : std::false_type {};
template <bool DiscardBehavior>
struct is_behavior_policy<behavior_policy<DiscardBehavior>> : std::true_type {};
using keep_behavior_t = behavior_policy<false>;
using discard_behavior_t = behavior_policy<true>;
/**
* Policy tag that causes {@link event_based_actor::become} to
* discard the current behavior.
* @relates local_actor
*/
constexpr discard_behavior_t discard_behavior = discard_behavior_t{};
/** /**
* Policy tag that causes {@link event_based_actor::become} to * Policy tag that causes {@link event_based_actor::become} to
* keep the current behavior available. * keep the current behavior available.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "caf/mailbox_element.hpp" #include "caf/mailbox_element.hpp"
#include "caf/response_handle.hpp" #include "caf/response_handle.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/mixin/sync_sender.hpp" #include "caf/mixin/sync_sender.hpp"
#include "caf/mixin/mailbox_based.hpp" #include "caf/mixin/mailbox_based.hpp"
...@@ -242,8 +244,11 @@ class blocking_actor::functor_based : public blocking_actor { ...@@ -242,8 +244,11 @@ class blocking_actor::functor_based : public blocking_actor {
template <class F, class... Ts> template <class F, class... Ts>
functor_based(F f, Ts&&... vs) { functor_based(F f, Ts&&... vs) {
using trait = typename detail::get_callable_trait<F>::type;
using arg0 = typename detail::tl_head<typename trait::arg_types>::type;
blocking_actor* dummy = nullptr; blocking_actor* dummy = nullptr;
create(dummy, f, std::forward<Ts>(vs)...); std::integral_constant<bool, std::is_same<arg0, blocking_actor*>::value> tk;
create(dummy, tk, f, std::forward<Ts>(vs)...);
} }
protected: protected:
...@@ -252,22 +257,14 @@ class blocking_actor::functor_based : public blocking_actor { ...@@ -252,22 +257,14 @@ class blocking_actor::functor_based : public blocking_actor {
private: private:
void create(blocking_actor*, act_fun); void create(blocking_actor*, act_fun);
template <class Actor, typename F, typename T0, class... Ts> template <class Actor, typename F, class... Ts>
auto create(Actor* dummy, F f, T0&& v0, Ts&&... vs) void create(Actor* dummy, std::true_type, F f, Ts&&... vs) {
-> typename std::enable_if<std::is_same< create(dummy, std::bind(f, std::placeholders::_1, std::forward<Ts>(vs)...));
decltype(f(dummy, std::forward<T0>(v0), std::forward<Ts>(vs)...)),
void>::value>::type {
create(dummy, std::bind(f, std::placeholders::_1, std::forward<T0>(v0),
std::forward<Ts>(vs)...));
} }
template <class Actor, typename F, typename T0, class... Ts> template <class Actor, typename F, class... Ts>
auto create(Actor* dummy, F f, T0&& v0, Ts&&... vs) void create(Actor* dummy, std::false_type, F f, Ts&&... vs) {
-> typename std::enable_if<std::is_same< std::function<void()> fun = std::bind(f, std::forward<Ts>(vs)...);
decltype(f(std::forward<T0>(v0), std::forward<Ts>(vs)...)),
void>::value>::type {
std::function<void()> fun =
std::bind(f, std::forward<T0>(v0), std::forward<Ts>(vs)...);
create(dummy, [fun](Actor*) { fun(); }); create(dummy, [fun](Actor*) { fun(); });
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -28,16 +28,13 @@ ...@@ -28,16 +28,13 @@
// CAF_LOG_LEVEL: // CAF_LOG_LEVEL:
// - denotes the amount of logging, ranging from error messages only (0) // - denotes the amount of logging, ranging from error messages only (0)
// to complete traces (4) // to complete traces (4)
//
// CAF_OPENCL:
// - enables optional OpenCL module
/** /**
* Denotes the libcaf version in the format {MAJOR}{MINOR}{PATCH}, * Denotes the libcaf version in the format {MAJOR}{MINOR}{PATCH},
* whereas each number is a two-digit decimal number without * whereas each number is a two-digit decimal number without
* leading zeros (e.g. 900 is version 0.9.0). * leading zeros (e.g. 900 is version 0.9.0).
*/ */
#define CAF_VERSION 1100 #define CAF_VERSION 1101
#define CAF_MAJOR_VERSION (CAF_VERSION / 10000) #define CAF_MAJOR_VERSION (CAF_VERSION / 10000)
#define CAF_MINOR_VERSION ((CAF_VERSION / 100) % 100) #define CAF_MINOR_VERSION ((CAF_VERSION / 100) % 100)
...@@ -76,7 +73,7 @@ ...@@ -76,7 +73,7 @@
# define CAF_ANNOTATE_FALLTHROUGH static_cast<void>(0) # define CAF_ANNOTATE_FALLTHROUGH static_cast<void>(0)
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# define CAF_MSVC # define CAF_MSVC
# define CAF_DEPRECATED __declspec(deprecated) # define CAF_DEPRECATED
# define CAF_PUSH_WARNINGS # define CAF_PUSH_WARNINGS
# define CAF_POP_WARNINGS # define CAF_POP_WARNINGS
# define CAF_ANNOTATE_FALLTHROUGH static_cast<void>(0) # define CAF_ANNOTATE_FALLTHROUGH static_cast<void>(0)
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -432,7 +432,7 @@ template <class C, typename GRes, typename SRes, typename SArg> ...@@ -432,7 +432,7 @@ template <class C, typename GRes, typename SRes, typename SArg>
uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const, uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const,
SRes (C::*setter)(SArg)) { SRes (C::*setter)(SArg)) {
using access_policy = getter_setter_access_policy<C, GRes, SRes, SArg>; using access_policy = getter_setter_access_policy<C, GRes, SRes, SArg>;
using value_type = typename detail::rm_const_and_ref<GRes>::type; using value_type = typename std::decay<GRes>::type;
using result_type = member_tinfo<value_type, access_policy>; using result_type = member_tinfo<value_type, access_policy>;
return uniform_type_info_ptr( return uniform_type_info_ptr(
new result_type(access_policy(getter, setter))); new result_type(access_policy(getter, setter)));
...@@ -443,7 +443,7 @@ uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const, ...@@ -443,7 +443,7 @@ uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const,
SRes (C::*setter)(SArg), SRes (C::*setter)(SArg),
uniform_type_info_ptr meminf) { uniform_type_info_ptr meminf) {
using access_policy = getter_setter_access_policy<C, GRes, SRes, SArg>; using access_policy = getter_setter_access_policy<C, GRes, SRes, SArg>;
using value_type = typename detail::rm_const_and_ref<GRes>::type; using value_type = typename std::decay<GRes>::type;
using tinfo = member_tinfo<value_type, access_policy, using tinfo = member_tinfo<value_type, access_policy,
forwarding_serialize_policy>; forwarding_serialize_policy>;
return uniform_type_info_ptr(new tinfo(access_policy(getter, setter), return uniform_type_info_ptr(new tinfo(access_policy(getter, setter),
...@@ -538,7 +538,7 @@ class default_uniform_type_info : public detail::abstract_uniform_type_info<T> { ...@@ -538,7 +538,7 @@ class default_uniform_type_info : public detail::abstract_uniform_type_info<T> {
SR (C::*)(ST) // setter with one argument SR (C::*)(ST) // setter with one argument
>, >,
detail::abstract_uniform_type_info< detail::abstract_uniform_type_info<
typename detail::rm_const_and_ref<GR>::type>*>& pr, typename std::decay<GR>::type>*>& pr,
Ts&&... args) { Ts&&... args) {
m_members.push_back(new_member_tinfo(pr.first.first, pr.first.second, m_members.push_back(new_member_tinfo(pr.first.first, pr.first.second,
uniform_type_info_ptr(pr.second))); uniform_type_info_ptr(pr.second)));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <cassert> #include <cassert>
// GCC hack // GCC hack
#if !defined(_GLIBCXX_USE_SCHED_YIELD) && !defined(__clang__) #if defined(CAF_GCC) && !defined(_GLIBCXX_USE_SCHED_YIELD)
#include <time.h> #include <time.h>
namespace std { namespace std {
namespace this_thread { namespace this_thread {
...@@ -47,7 +47,7 @@ inline void yield() noexcept { ...@@ -47,7 +47,7 @@ inline void yield() noexcept {
#endif #endif
// another GCC hack // another GCC hack
#if !defined(_GLIBCXX_USE_NANOSLEEP) && !defined(__clang__) #if defined(CAF_GCC) && !defined(_GLIBCXX_USE_NANOSLEEP)
#include <time.h> #include <time.h>
namespace std { namespace std {
namespace this_thread { namespace this_thread {
...@@ -109,18 +109,19 @@ class double_ended_queue { ...@@ -109,18 +109,19 @@ class double_ended_queue {
static_assert(sizeof(node*) < CAF_CACHE_LINE_SIZE, static_assert(sizeof(node*) < CAF_CACHE_LINE_SIZE,
"sizeof(node*) >= CAF_CACHE_LINE_SIZE"); "sizeof(node*) >= CAF_CACHE_LINE_SIZE");
double_ended_queue() double_ended_queue() {
: m_head_lock(ATOMIC_FLAG_INIT), m_head_lock.clear();
m_tail_lock(ATOMIC_FLAG_INIT) { m_tail_lock.clear();
auto ptr = new node(nullptr); auto ptr = new node(nullptr);
m_head = ptr; m_head = ptr;
m_tail = ptr; m_tail = ptr;
} }
~double_ended_queue() { ~double_ended_queue() {
while (m_head) { auto ptr = m_head.load();
unique_node_ptr tmp{m_head.load()}; while (ptr) {
m_head = tmp->next.load(); unique_node_ptr tmp{ptr};
ptr = tmp->next.load();
} }
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -64,7 +64,7 @@ template <class T> ...@@ -64,7 +64,7 @@ template <class T>
struct strip_and_convert { struct strip_and_convert {
using type = using type =
typename implicit_conversions< typename implicit_conversions<
typename rm_const_and_ref<T>::type typename std::decay<T>::type
>::type; >::type;
}; };
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -51,11 +51,10 @@ template <class List, size_t N> ...@@ -51,11 +51,10 @@ template <class List, size_t N>
struct il_right; struct il_right;
template <long... Is, size_t N> template <long... Is, size_t N>
struct il_right<int_list<Is...>, N> : il_right_impl<(N > sizeof...(Is) struct il_right<int_list<Is...>, N> {
? sizeof...(Is) using type = typename il_right_impl<(N > sizeof...(Is) ? sizeof...(Is) : N),
: N), sizeof...(Is), Is...>::type;
sizeof...(Is), };
Is...> { };
/** /**
* Creates indices for `List` beginning at `Pos`. * Creates indices for `List` beginning at `Pos`.
...@@ -84,13 +83,13 @@ struct il_indices<List<T0, Ts...>, Pos, int_list<Is...>> { ...@@ -84,13 +83,13 @@ struct il_indices<List<T0, Ts...>, Pos, int_list<Is...>> {
}; };
template <class T> template <class T>
constexpr auto get_indices(const T&) -> typename il_indices<T>::type { typename il_indices<T>::type get_indices(const T&) {
return {}; return {};
} }
template <size_t Num, typename T> template <size_t Num, class T>
constexpr auto get_right_indices(const T&) typename il_right<typename il_indices<T>::type, Num>::type
-> typename il_right<typename il_indices<T>::type, Num>::type { get_right_indices(const T&) {
return {}; return {};
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,46 +10,102 @@ ...@@ -10,46 +10,102 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. * * http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/ ******************************************************************************/
#ifndef CAF_DETAIL_TUPLE_DUMMY_HPP #ifndef CAF_DETAIL_MATCHES_HPP
#define CAF_DETAIL_TUPLE_DUMMY_HPP #define CAF_DETAIL_MATCHES_HPP
#include "caf/fwd.hpp" #include <numeric>
#include "caf/detail/type_list.hpp" #include "caf/message.hpp"
#include "caf/wildcard_position.hpp"
#include "caf/detail/message_iterator.hpp" #include "caf/detail/type_list.hpp"
#include "caf/detail/pseudo_tuple.hpp"
namespace caf { namespace caf {
namespace detail { namespace detail {
struct tuple_dummy { template <class Pattern, class FilteredPattern>
using types = detail::empty_type_list; struct matcher;
using const_iterator = message_iterator<tuple_dummy>;
inline size_t size() const { return 0; } template <class... Ts, class... Us>
inline void* mutable_at(size_t) { return nullptr; } struct matcher<type_list<Ts...>, type_list<Us...>> {
inline const void* at(size_t) const { return nullptr; } template <class TupleIter, class PatternIter, class Push, class Commit,
inline const uniform_type_info* type_at(size_t) const { return nullptr; } class Rollback>
inline const std::type_info* type_token() const { bool operator()(TupleIter tbegin, TupleIter tend, PatternIter pbegin,
return &typeid(detail::empty_type_list); PatternIter pend, Push& push, Commit& commit,
} Rollback& rollback) const {
inline bool dynamically_typed() const { return false; } while (!(pbegin == pend && tbegin == tend)) {
inline const_iterator begin() const { if (pbegin == pend) {
return {this}; // reached end of pattern while some values remain unmatched
} return false;
inline const_iterator end() const { }
return {this, 0}; if (*pbegin == nullptr) { // nullptr == wildcard (anything)
// perform submatching
++pbegin;
// always true at the end of the pattern
if (pbegin == pend) {
return true;
}
// safe current mapping as fallback
commit();
// iterate over tuple values until we found a match
for (; tbegin != tend; ++tbegin) {
if ((*this)(tbegin, tend, pbegin, pend, push, commit, rollback)) {
return true;
}
// restore mapping to fallback (delete invalid mappings)
rollback();
}
return false; // no submatch found
}
// compare types
if (tbegin.type() != *pbegin) {
// type mismatch
return false;
}
// next iteration
push(tbegin);
++tbegin;
++pbegin;
}
return true; // pbegin == pend && tbegin == tend
} }
bool operator()(const message& tup, pseudo_tuple<Us...>* out) const {
auto& tarr = static_types_array<Ts...>::arr;
if (sizeof...(Us) == 0) {
// this pattern only has wildcards and thus always matches
return true;
}
if (tup.size() < sizeof...(Us)) {
return false;
}
if (out) {
size_t pos = 0;
size_t fallback_pos = 0;
auto fpush = [&](const typename message::const_iterator& iter) {
(*out)[pos++] = const_cast<void*>(iter.value());
};
auto fcommit = [&] { fallback_pos = pos; };
auto frollback = [&] { pos = fallback_pos; };
return (*this)(tup.begin(), tup.end(), tarr.begin(), tarr.end(), fpush,
fcommit, frollback);
}
auto no_push = [](const typename message::const_iterator&) { };
auto nop = [] { };
return (*this)(tup.begin(), tup.end(), tarr.begin(), tarr.end(), no_push,
nop, nop);
}
}; };
} // namespace detail } // namespace detail
} // namespace caf } // namespace caf
#endif // CAF_DETAIL_TUPLE_DUMMY_HPP #endif // CAF_DETAIL_MATCHES_HPP
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2014 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* 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 LICENCE_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. *
******************************************************************************/
#ifndef CAF_DETAIL_MATCHES_HPP
#define CAF_DETAIL_MATCHES_HPP
#include <numeric>
#include "caf/message.hpp"
#include "caf/wildcard_position.hpp"
#include "caf/detail/type_list.hpp"
namespace caf {
namespace detail {
template <wildcard_position, class Tuple, class...>
struct matcher;
template <class Tuple, class... T>
struct matcher<wildcard_position::nil, Tuple, T...> {
bool operator()(const Tuple& tup) const {
if (not tup.dynamically_typed()) {
// statically typed tuples return &typeid(type_list<T...>)
// as type token
return typeid(detail::type_list<T...>)== *(tup.type_token());
}
// always use a full dynamic match for dynamic typed tuples
else if (tup.size() == sizeof...(T)) {
auto& tarr = static_types_array<T...>::arr;
return std::equal(tup.begin(), tup.end(), tarr.begin(),
types_only_eq);
}
return false;
}
bool operator()(const Tuple& tup, std::vector<size_t>& mv) const {
if ((*this)(tup)) {
mv.resize(sizeof...(T));
std::iota(mv.begin(), mv.end(), 0);
return true;
}
return false;
}
};
template <class Tuple, class... T>
struct matcher<wildcard_position::trailing, Tuple, T...> {
static constexpr size_t size = sizeof...(T) - 1;
bool operator()(const Tuple& tup) const {
if (tup.size() >= size) {
auto& tarr = static_types_array<T...>::arr;
auto begin = tup.begin();
return std::equal(begin, begin + size, tarr.begin(), types_only_eq);
}
return false;
}
bool operator()(const Tuple& tup, std::vector<size_t>& mv) const {
if ((*this)(tup)) {
mv.resize(size);
std::iota(mv.begin(), mv.end(), 0);
return true;
}
return false;
}
};
template <class Tuple>
struct matcher<wildcard_position::leading, Tuple, anything> {
bool operator()(const Tuple&) const { return true; }
bool operator()(const Tuple&, std::vector<size_t>&) const { return true; }
};
template <class Tuple, class... T>
struct matcher<wildcard_position::leading, Tuple, T...> {
static constexpr size_t size = sizeof...(T) - 1;
bool operator()(const Tuple& tup) const {
auto tup_size = tup.size();
if (tup_size >= size) {
auto& tarr = static_types_array<T...>::arr;
auto begin = tup.begin();
begin += (tup_size - size);
return std::equal(begin, tup.end(),
(tarr.begin() + 1), // skip 'anything'
types_only_eq);
}
return false;
}
bool operator()(const Tuple& tup, std::vector<size_t>& mv) const {
if ((*this)(tup)) {
mv.resize(size);
std::iota(mv.begin(), mv.end(), tup.size() - size);
return true;
}
return false;
}
};
template <class Tuple, class... T>
struct matcher<wildcard_position::in_between, Tuple, T...> {
static constexpr int signed_wc_pos =
detail::tl_find<detail::type_list<T...>, anything>::value;
static constexpr size_t size = sizeof...(T);
static constexpr size_t wc_pos = static_cast<size_t>(signed_wc_pos);
static_assert(signed_wc_pos > 0 && wc_pos < (sizeof...(T) - 1),
"illegal wildcard position");
bool operator()(const Tuple& tup) const {
auto tup_size = tup.size();
if (tup_size >= (size - 1)) {
auto& tarr = static_types_array<T...>::arr;
// first range [0, X1)
auto begin = tup.begin();
auto end = begin + wc_pos;
if (std::equal(begin, end, tarr.begin(), types_only_eq)) {
// second range [X2, N)
begin = end = tup.end();
begin -= (size - (wc_pos + 1));
auto arr_begin = tarr.begin() + (wc_pos + 1);
return std::equal(begin, end, arr_begin, types_only_eq);
}
}
return false;
}
bool operator()(const Tuple& tup, std::vector<size_t>& mv) const {
if ((*this)(tup)) {
// first range
mv.resize(size - 1);
auto begin = mv.begin();
std::iota(begin, begin + wc_pos, 0);
// second range
begin = mv.begin() + wc_pos;
std::iota(begin, mv.end(), tup.size() - (size - (wc_pos + 1)));
return true;
}
return false;
}
};
template <class Tuple, class... T>
struct matcher<wildcard_position::multiple, Tuple, T...> {
static constexpr size_t wc_count =
detail::tl_count<detail::type_list<T...>, is_anything>::value;
static_assert(sizeof...(T) > wc_count, "only wildcards given");
template <class TupleIter, class PatternIter, class Push, class Commit,
class Rollback>
bool operator()(TupleIter tbegin, TupleIter tend, PatternIter pbegin,
PatternIter pend, Push& push, Commit& commit,
Rollback& rollback) const {
while (!(pbegin == pend && tbegin == tend)) {
if (pbegin == pend) {
// reached end of pattern while some values remain unmatched
return false;
} else if (*pbegin == nullptr) { // nullptr == wildcard (anything)
// perform submatching
++pbegin;
// always true at the end of the pattern
if (pbegin == pend) return true;
// safe current mapping as fallback
commit();
// iterate over tuple values until we found a match
for (; tbegin != tend; ++tbegin) {
if (match(tbegin, tend, pbegin, pend, push, commit,
rollback)) {
return true;
}
// restore mapping to fallback (delete invalid mappings)
rollback();
}
return false; // no submatch found
}
// compare types
else if (tbegin.type() == *pbegin)
push(tbegin);
// no match
else
return false;
// next iteration
++tbegin;
++pbegin;
}
return true; // pbegin == pend && tbegin == tend
}
bool operator()(const Tuple& tup) const {
auto& tarr = static_types_array<T...>::arr;
if (tup.size() >= (sizeof...(T) - wc_count)) {
auto fpush = [](const typename Tuple::const_iterator&) {};
auto fcommit = [] {};
auto frollback = [] {};
return match(tup.begin(), tup.end(), tarr.begin(), tarr.end(),
fpush, fcommit, frollback);
}
return false;
}
template <class MappingVector>
bool operator()(const Tuple& tup, MappingVector& mv) const {
auto& tarr = static_types_array<T...>::arr;
if (tup.size() >= (sizeof...(T) - wc_count)) {
size_t commited_size = 0;
auto fpush = [&](const typename Tuple::const_iterator& iter) {
mv.push_back(iter.position());
};
auto fcommit = [&] { commited_size = mv.size(); };
auto frollback = [&] { mv.resize(commited_size); };
return match(tup.begin(), tup.end(), tarr.begin(), tarr.end(),
fpush, fcommit, frollback);
}
return false;
}
};
template <class Tuple, class List>
struct select_matcher;
template <class Tuple, class... Ts>
struct select_matcher<Tuple, detail::type_list<Ts...>> {
using type = matcher<get_wildcard_position<detail::type_list<Ts...>>(),
Tuple, Ts...>;
};
} // namespace detail
} // namespace caf
#endif // CAF_DETAIL_MATCHES_HPP
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -64,9 +64,9 @@ class proper_actor_base : public Policies::resume_policy::template ...@@ -64,9 +64,9 @@ class proper_actor_base : public Policies::resume_policy::template
scheduling_policy().enqueue(dptr(), sender, mid, msg, eu); scheduling_policy().enqueue(dptr(), sender, mid, msg, eu);
} }
inline void launch(bool hidden, execution_unit* host) { inline void launch(bool hide, execution_unit* host) {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
this->is_registered(!hidden); this->is_registered(!hide);
this->scheduling_policy().launch(this, host); this->scheduling_policy().launch(this, host);
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -49,7 +49,7 @@ template <class T> ...@@ -49,7 +49,7 @@ template <class T>
struct purge_refs { struct purge_refs {
using type = using type =
typename purge_refs_impl< typename purge_refs_impl<
typename detail::rm_const_and_ref<T>::type typename std::decay<T>::type
>::type; >::type;
}; };
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -70,8 +70,6 @@ class singletons { ...@@ -70,8 +70,6 @@ class singletons {
static uniform_type_info_map* get_uniform_type_info_map(); static uniform_type_info_map* get_uniform_type_info_map();
static message_data* get_tuple_dummy();
// usually guarded by implementation-specific singleton getter // usually guarded by implementation-specific singleton getter
template <class Factory> template <class Factory>
static abstract_singleton* get_plugin_singleton(size_t id, Factory f) { static abstract_singleton* get_plugin_singleton(size_t id, Factory f) {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -33,31 +33,6 @@ ...@@ -33,31 +33,6 @@
namespace caf { namespace caf {
namespace detail { namespace detail {
/**
* Equal to std::remove_const<std::remove_reference<T>::type>.
*/
template <class T>
struct rm_const_and_ref {
using type = T;
};
template <class T>
struct rm_const_and_ref<const T&> {
using type = T;
};
template <class T>
struct rm_const_and_ref<const T> {
using type = T;
};
template <class T>
struct rm_const_and_ref<T&> {
using type = T;
};
// template <> struct rm_const_and_ref<void> { };
/** /**
* Joins all bool constants using operator &&. * Joins all bool constants using operator &&.
*/ */
...@@ -117,17 +92,17 @@ struct is_array_of { ...@@ -117,17 +92,17 @@ struct is_array_of {
*/ */
template <class T0, typename T1> template <class T0, typename T1>
struct deduce_ref_type { struct deduce_ref_type {
using type = typename detail::rm_const_and_ref<T1>::type; using type = typename std::decay<T1>::type;
}; };
template <class T0, typename T1> template <class T0, typename T1>
struct deduce_ref_type<T0&, T1> { struct deduce_ref_type<T0&, T1> {
using type = typename detail::rm_const_and_ref<T1>::type&; using type = typename std::decay<T1>::type&;
}; };
template <class T0, typename T1> template <class T0, typename T1>
struct deduce_ref_type<const T0&, T1> { struct deduce_ref_type<const T0&, T1> {
using type = const typename detail::rm_const_and_ref<T1>::type&; using type = const typename std::decay<T1>::type&;
}; };
/** /**
...@@ -210,7 +185,7 @@ class is_forward_iterator { ...@@ -210,7 +185,7 @@ class is_forward_iterator {
static bool sfinae_fun( static bool sfinae_fun(
C* iter, C* iter,
// check for 'C::value_type C::operator*()' returning a non-void type // check for 'C::value_type C::operator*()' returning a non-void type
typename rm_const_and_ref<decltype(*(*iter))>::type* = 0, typename std::decay<decltype(*(*iter))>::type* = 0,
// check for 'C& C::operator++()' // check for 'C& C::operator++()'
typename std::enable_if< typename std::enable_if<
std::is_same<C&, decltype(++(*iter))>::value>::type* = 0, std::is_same<C&, decltype(++(*iter))>::value>::type* = 0,
...@@ -242,12 +217,12 @@ class is_iterable { ...@@ -242,12 +217,12 @@ class is_iterable {
static bool sfinae_fun( static bool sfinae_fun(
const C* cc, const C* cc,
// check for 'C::begin()' returning a forward iterator // check for 'C::begin()' returning a forward iterator
typename std::enable_if< typename std::enable_if<is_forward_iterator<decltype(cc->begin())>::value>::
detail::is_forward_iterator<decltype(cc->begin())>::value>::type* = type* = 0,
0,
// check for 'C::end()' returning the same kind of forward iterator // check for 'C::end()' returning the same kind of forward iterator
typename std::enable_if<std::is_same< typename std::enable_if<std::is_same<decltype(cc->begin()),
decltype(cc->begin()), decltype(cc->end())>::value>::type* = 0) { decltype(cc->end())>::value>::type
* = 0) {
return true; return true;
} }
...@@ -257,7 +232,7 @@ class is_iterable { ...@@ -257,7 +232,7 @@ class is_iterable {
using result_type = decltype(sfinae_fun(static_cast<const T*>(nullptr))); using result_type = decltype(sfinae_fun(static_cast<const T*>(nullptr)));
public: public:
static constexpr bool value = detail::is_primitive<T>::value == false && static constexpr bool value = is_primitive<T>::value == false &&
std::is_same<bool, result_type>::value; std::is_same<bool, result_type>::value;
}; };
...@@ -358,7 +333,7 @@ struct get_callable_trait_helper<false, false, C> { ...@@ -358,7 +333,7 @@ struct get_callable_trait_helper<false, false, C> {
template <class T> template <class T>
struct get_callable_trait { struct get_callable_trait {
// type without cv qualifiers // type without cv qualifiers
using bare_type = typename rm_const_and_ref<T>::type; using bare_type = typename std::decay<T>::type;
// if T is a function pointer, this type identifies the function // if T is a function pointer, this type identifies the function
using signature_type = typename std::remove_pointer<bare_type>::type; using signature_type = typename std::remove_pointer<bare_type>::type;
using type = using type =
...@@ -392,7 +367,7 @@ struct is_callable { ...@@ -392,7 +367,7 @@ struct is_callable {
static void _fun(void*) { } static void _fun(void*) { }
using pointer = typename rm_const_and_ref<T>::type*; using pointer = typename std::decay<T>::type*;
using result_type = decltype(_fun(static_cast<pointer>(nullptr))); using result_type = decltype(_fun(static_cast<pointer>(nullptr)));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -54,7 +54,7 @@ struct deduce_signature_helper<std::tuple<Rs...>, type_list<Ts...>> { ...@@ -54,7 +54,7 @@ struct deduce_signature_helper<std::tuple<Rs...>, type_list<Ts...>> {
template <class T> template <class T>
struct deduce_signature { struct deduce_signature {
using result_ = typename implicit_conversions<typename T::result_type>::type; using result_ = typename implicit_conversions<typename T::result_type>::type;
using arg_t = typename tl_map<typename T::arg_types, rm_const_and_ref>::type; using arg_t = typename tl_map<typename T::arg_types, std::decay>::type;
using type = typename deduce_signature_helper<result_, arg_t>::type; using type = typename deduce_signature_helper<result_, arg_t>::type;
}; };
...@@ -72,7 +72,7 @@ inline void assert_types() { ...@@ -72,7 +72,7 @@ inline void assert_types() {
using arg_types = using arg_types =
typename tl_map< typename tl_map<
typename get_callable_trait<F>::arg_types, typename get_callable_trait<F>::arg_types,
rm_const_and_ref std::decay
>::type; >::type;
static constexpr size_t fun_args = tl_size<arg_types>::value; static constexpr size_t fun_args = tl_size<arg_types>::value;
static_assert(fun_args <= tl_size<OutputList>::value, static_assert(fun_args <= tl_size<OutputList>::value,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -88,7 +88,7 @@ struct types_array_impl { ...@@ -88,7 +88,7 @@ struct types_array_impl {
static constexpr bool builtin_only = true; static constexpr bool builtin_only = true;
inline bool is_pure() const { return true; } inline bool is_pure() const { return true; }
// all types are builtin, perform lookup on constuction // all types are builtin, perform lookup on constuction
const uniform_type_info* data[sizeof...(T)]; const uniform_type_info* data[sizeof...(T) == 0 ? 1 : sizeof...(T)];
types_array_impl() : data{ta_util<caf_tinf, true, T>::get()...} {} types_array_impl() : data{ta_util<caf_tinf, true, T>::get()...} {}
inline const uniform_type_info* operator[](size_t p) const { inline const uniform_type_info* operator[](size_t p) const {
return data[p]; return data[p];
...@@ -103,7 +103,7 @@ struct types_array_impl<false, T...> { ...@@ -103,7 +103,7 @@ struct types_array_impl<false, T...> {
static constexpr bool builtin_only = false; static constexpr bool builtin_only = false;
inline bool is_pure() const { return false; } inline bool is_pure() const { return false; }
// contains std::type_info for all non-builtin types // contains std::type_info for all non-builtin types
const std::type_info* tinfo_data[sizeof...(T)]; const std::type_info* tinfo_data[sizeof...(T) == 0 ? 1 : sizeof...(T)];
// contains uniform_type_infos for builtin types and lazy initializes // contains uniform_type_infos for builtin types and lazy initializes
// non-builtin types at runtime // non-builtin types at runtime
mutable std::atomic<const uniform_type_info*> data[sizeof...(T)]; mutable std::atomic<const uniform_type_info*> data[sizeof...(T)];
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
...@@ -52,7 +52,8 @@ class event_based_actor ...@@ -52,7 +52,8 @@ class event_based_actor
/** /**
* Forwards the last received message to `whom`. * Forwards the last received message to `whom`.
*/ */
void forward_to(const actor& whom); void forward_to(const actor& whom,
message_priority = message_priority::normal);
event_based_actor() = default; event_based_actor() = default;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* * * *
* Distributed under the terms and conditions of the BSD 3-Clause License or * * 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 * * (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. * * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* * * *
* If you did not receive a copy of the license files, see * * If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and * * http://opensource.org/licenses/BSD-3-Clause and *
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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