├── .gitattributes ├── .gitignore ├── Bench.h ├── CMakeLists.txt ├── LICENSE ├── README.md ├── main.cpp ├── signal-slot-benchmarks ├── CMakeLists.txt ├── README.md ├── benchmark.cpp ├── benchmark.hpp ├── benchmark │ ├── cpp │ │ ├── benchmark_aco.cpp │ │ ├── benchmark_asg.cpp │ │ ├── benchmark_bs2.cpp │ │ ├── benchmark_cls.cpp │ │ ├── benchmark_cps.cpp │ │ ├── benchmark_cps_st.cpp │ │ ├── benchmark_css.cpp │ │ ├── benchmark_dob.cpp │ │ ├── benchmark_evl.cpp │ │ ├── benchmark_fts.cpp │ │ ├── benchmark_ics.cpp │ │ ├── benchmark_jls.cpp │ │ ├── benchmark_jos.cpp │ │ ├── benchmark_ksc.cpp │ │ ├── benchmark_lfs.cpp │ │ ├── benchmark_lss.cpp │ │ ├── benchmark_mws.cpp │ │ ├── benchmark_nes.cpp │ │ ├── benchmark_nls.cpp │ │ ├── benchmark_nls_st.cpp │ │ ├── benchmark_nod.cpp │ │ ├── benchmark_nod_st.cpp │ │ ├── benchmark_nss_st.cpp │ │ ├── benchmark_nss_sts.cpp │ │ ├── benchmark_nss_ts.cpp │ │ ├── benchmark_nss_tss.cpp │ │ ├── benchmark_psg.cpp │ │ ├── benchmark_pss.cpp │ │ ├── benchmark_pss_st.cpp │ │ ├── benchmark_sss.cpp │ │ ├── benchmark_vdk.cpp │ │ ├── benchmark_wnk.cpp │ │ └── benchmark_yas.cpp │ ├── hpp │ │ ├── benchmark_aco.hpp │ │ ├── benchmark_asg.hpp │ │ ├── benchmark_bs2.hpp │ │ ├── benchmark_cls.hpp │ │ ├── benchmark_cps.hpp │ │ ├── benchmark_cps_st.hpp │ │ ├── benchmark_css.hpp │ │ ├── benchmark_dob.hpp │ │ ├── benchmark_evl.hpp │ │ ├── benchmark_fts.hpp │ │ ├── benchmark_ics.hpp │ │ ├── benchmark_jls.hpp │ │ ├── benchmark_jos.hpp │ │ ├── benchmark_ksc.hpp │ │ ├── benchmark_lfs.hpp │ │ ├── benchmark_lss.hpp │ │ ├── benchmark_mws.hpp │ │ ├── benchmark_nes.hpp │ │ ├── benchmark_nls.hpp │ │ ├── benchmark_nls_st.hpp │ │ ├── benchmark_nod.hpp │ │ ├── benchmark_nod_st.hpp │ │ ├── benchmark_nss_st.hpp │ │ ├── benchmark_nss_sts.hpp │ │ ├── benchmark_nss_ts.hpp │ │ ├── benchmark_nss_tss.hpp │ │ ├── benchmark_psg.hpp │ │ ├── benchmark_pss.hpp │ │ ├── benchmark_pss_st.hpp │ │ ├── benchmark_sss.hpp │ │ ├── benchmark_vdk.hpp │ │ ├── benchmark_wnk.hpp │ │ └── benchmark_yas.hpp │ └── lib │ │ ├── Ansoulom │ │ └── cpp-observe │ │ │ └── cpp_observe.hpp │ │ ├── CppFakeIt │ │ ├── LICENSE │ │ ├── README.md │ │ ├── docs │ │ │ ├── bind_weak.md │ │ │ ├── migration-from-boost-signals2.md │ │ │ ├── simple-examples.md │ │ │ └── why-fastsignals.md │ │ └── libfastsignals │ │ │ ├── CMakeLists.txt │ │ │ ├── include │ │ │ ├── bind_weak.h │ │ │ ├── combiners.h │ │ │ ├── function.h │ │ │ ├── function_detail.h │ │ │ ├── lfs_connection.h │ │ │ ├── msvc_autolink.h │ │ │ ├── signal.h │ │ │ ├── signal_impl.h │ │ │ ├── spin_mutex.h │ │ │ └── type_traits.h │ │ │ ├── libfastsignals.vcxproj │ │ │ ├── libfastsignals.vcxproj.filters │ │ │ └── src │ │ │ ├── function_detail.cpp │ │ │ ├── lfs_connection.cpp │ │ │ └── signal_impl.cpp │ │ ├── Kosta-Github │ │ └── signals-cpp │ │ │ ├── LICENSE.txt │ │ │ ├── README.md │ │ │ └── signals-cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── config.hpp │ │ │ ├── connection.hpp │ │ │ ├── connections.hpp │ │ │ ├── signal.hpp │ │ │ └── signals.hpp │ │ ├── Montellese │ │ └── cpp-signal │ │ │ └── cpp-signal.h │ │ ├── NoAvailableAlias │ │ └── nano-signal-slot │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── nano_function.hpp │ │ │ ├── nano_mutex.hpp │ │ │ ├── nano_observer.hpp │ │ │ └── nano_signal_slot.hpp │ │ ├── Nuclex │ │ ├── Config.h │ │ └── Events │ │ │ ├── Delegate.h │ │ │ ├── EmptyDelegateCallError.h │ │ │ └── Event.h │ │ ├── amc522 │ │ └── signal11 │ │ │ ├── README.md │ │ │ └── Signal.h │ │ ├── copperspice │ │ └── cs_signal │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── src │ │ │ ├── cs_internal.h │ │ │ ├── cs_macro.h │ │ │ ├── cs_signal.cpp │ │ │ ├── cs_signal.h │ │ │ ├── cs_slot.cpp │ │ │ ├── cs_slot.h │ │ │ ├── rcu_guarded.hpp │ │ │ └── rcu_list.hpp │ │ ├── cpp11nullptr │ │ └── lsignal │ │ │ ├── LICENCE │ │ │ ├── README.md │ │ │ └── lsignal.h │ │ ├── dacap │ │ ├── LICENSE.txt │ │ ├── README.md │ │ └── obs │ │ │ ├── dacap_connection.cpp │ │ │ ├── dacap_connection.h │ │ │ ├── dacap_signal.h │ │ │ ├── observable.h │ │ │ ├── observers.h │ │ │ ├── safe_list.h │ │ │ └── slot.h │ │ ├── eviltwin │ │ └── observer.hpp │ │ ├── fr00b0 │ │ └── nod │ │ │ ├── README.md │ │ │ ├── include │ │ │ └── nod │ │ │ │ └── nod.hpp │ │ │ └── tools │ │ │ └── linux_x64 │ │ │ └── premake5 │ │ ├── fteng │ │ └── signals.hpp │ │ ├── i42output │ │ ├── LICENSE │ │ ├── README.md │ │ ├── include │ │ │ └── neolib │ │ │ │ ├── allocator.hpp │ │ │ │ ├── async_task.hpp │ │ │ │ ├── async_thread.hpp │ │ │ │ ├── detail_memory.hpp │ │ │ │ ├── event.hpp │ │ │ │ ├── i_lifetime.hpp │ │ │ │ ├── i_task.hpp │ │ │ │ ├── i_thread.hpp │ │ │ │ ├── lifetime.hpp │ │ │ │ ├── lockable.hpp │ │ │ │ ├── locking_policy.hpp │ │ │ │ ├── memory.hpp │ │ │ │ ├── message_queue.hpp │ │ │ │ ├── mutex.hpp │ │ │ │ ├── neolib.hpp │ │ │ │ ├── noncopyable.hpp │ │ │ │ ├── raii.hpp │ │ │ │ ├── signal.hpp │ │ │ │ ├── signal_interface.hpp │ │ │ │ ├── singleton.hpp │ │ │ │ ├── slot.hpp │ │ │ │ ├── slot_interface.hpp │ │ │ │ ├── task.hpp │ │ │ │ ├── thread.hpp │ │ │ │ ├── timer.hpp │ │ │ │ ├── variant.hpp │ │ │ │ ├── waitable.hpp │ │ │ │ ├── waitable_event.hpp │ │ │ │ └── win32_message_queue.hpp │ │ └── src │ │ │ ├── async_task.cpp │ │ │ ├── async_thread.cpp │ │ │ ├── event.cpp │ │ │ ├── thread.cpp │ │ │ ├── timer.cpp │ │ │ ├── waitable_event.cpp │ │ │ └── win32_message_queue.cpp │ │ ├── iscool │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── iscool │ │ │ │ ├── context.h │ │ │ │ ├── copy.h │ │ │ │ ├── detail │ │ │ │ ├── copy.tpp │ │ │ │ └── optional_or_else.tpp │ │ │ │ ├── digits.h │ │ │ │ ├── enum_equals.h │ │ │ │ ├── enum_equals.tpp │ │ │ │ ├── none.h │ │ │ │ ├── none_t.h │ │ │ │ ├── optional.h │ │ │ │ ├── optional.impl.tpp │ │ │ │ ├── optional_or_else.h │ │ │ │ ├── profile │ │ │ │ ├── detail │ │ │ │ │ └── output_function.h │ │ │ │ ├── output_delegate.h │ │ │ │ ├── profile_data.h │ │ │ │ ├── profiler.h │ │ │ │ ├── scoped_profiler.h │ │ │ │ └── setup.h │ │ │ │ ├── signals │ │ │ │ ├── bounce.h │ │ │ │ ├── connection.h │ │ │ │ ├── declare_signal.h │ │ │ │ ├── detail │ │ │ │ │ ├── any_tuple_has_type_at_index.h │ │ │ │ │ ├── any_tuple_has_type_at_index.tests.h │ │ │ │ │ ├── any_tuple_is_masked.h │ │ │ │ │ ├── any_tuple_is_masked.tests.h │ │ │ │ │ ├── find_signal_type_from_tuple_element.h │ │ │ │ │ ├── get.tpp │ │ │ │ │ ├── get_from_tuple_element.tpp │ │ │ │ │ ├── no_tuple_is_masked.h │ │ │ │ │ ├── no_tuple_is_masked.tests.h │ │ │ │ │ ├── relay.tpp │ │ │ │ │ ├── resolve_identifier.h │ │ │ │ │ ├── signal.h │ │ │ │ │ ├── signal.impl.tpp │ │ │ │ │ ├── signal_collection_from_tuple.h │ │ │ │ │ ├── slot.h │ │ │ │ │ ├── statistics_function.h │ │ │ │ │ ├── tuple_is_masked.h │ │ │ │ │ └── tuple_is_masked.tests.h │ │ │ │ ├── find_signal_type_from_tuple_element.h │ │ │ │ ├── get.h │ │ │ │ ├── get_from_tuple_element.h │ │ │ │ ├── identifier.h │ │ │ │ ├── implement_signal.h │ │ │ │ ├── one_shot_signal.h │ │ │ │ ├── one_shot_signal.impl.tpp │ │ │ │ ├── one_shot_signal_pool.h │ │ │ │ ├── one_shot_signal_pool.impl.tpp │ │ │ │ ├── relay.h │ │ │ │ ├── scoped_connection.h │ │ │ │ ├── shared_connection.h │ │ │ │ ├── shared_connection_set.h │ │ │ │ ├── signal.h │ │ │ │ ├── signal.impl.tpp │ │ │ │ ├── signal_collection.h │ │ │ │ ├── signal_collection_from_tuple.h │ │ │ │ ├── signal_from_tuple_arguments.h │ │ │ │ ├── statistics_data.h │ │ │ │ ├── statistics_sink.h │ │ │ │ └── void_signal_function.h │ │ │ │ └── time │ │ │ │ ├── backward_duration_to_unit_change.h │ │ │ │ ├── days.h │ │ │ │ ├── detail │ │ │ │ ├── backward_duration_to_unit_change.tpp │ │ │ │ ├── now.tpp │ │ │ │ └── round.tpp │ │ │ │ ├── now.h │ │ │ │ └── round.h │ │ └── src │ │ │ └── iscool │ │ │ ├── digits.cpp │ │ │ ├── none.cpp │ │ │ ├── optional.cpp │ │ │ ├── profile │ │ │ ├── detail │ │ │ │ └── output_function.cpp │ │ │ ├── profile_data.cpp │ │ │ ├── profiler.cpp │ │ │ ├── scoped_profiler.cpp │ │ │ └── setup.cpp │ │ │ └── signals │ │ │ ├── connection.cpp │ │ │ ├── detail │ │ │ ├── slot.cpp │ │ │ └── statistics_function.cpp │ │ │ ├── scoped_connection.cpp │ │ │ ├── shared_connection.cpp │ │ │ ├── shared_connection_set.cpp │ │ │ ├── signal.cpp │ │ │ ├── statistics_data.cpp │ │ │ └── statistics_sink.cpp │ │ ├── jeffomatic │ │ └── jl_signal │ │ │ ├── README.md │ │ │ └── src │ │ │ ├── DoublyLinkedList.h │ │ │ ├── DoublyLinkedListTest.cpp │ │ │ ├── FastDelegate.h │ │ │ ├── ObjectPool.cpp │ │ │ ├── ObjectPool.h │ │ │ ├── ObjectPoolScopedAllocator.h │ │ │ ├── ObjectPoolTest.cpp │ │ │ ├── ScopedAllocator.h │ │ │ ├── Signal.h │ │ │ ├── SignalBase.cpp │ │ │ ├── SignalBase.h │ │ │ ├── SignalDefinitions.h │ │ │ ├── SignalTest.cpp │ │ │ ├── StaticSignalConnectionAllocators.h │ │ │ └── Utils.h │ │ ├── joanrieu │ │ └── signal11 │ │ │ ├── LICENSE.md │ │ │ ├── README.md │ │ │ └── signal11.h │ │ ├── larspensjo │ │ └── SimpleSignal │ │ │ ├── README.md │ │ │ └── SimpleSignal.h │ │ ├── miguelmartin │ │ └── Wink-Signals │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── examples │ │ │ ├── Benchmark.cpp │ │ │ └── Makefile │ │ │ └── wink │ │ │ ├── detail │ │ │ ├── FastDelegate.h │ │ │ └── FastDelegateBind.h │ │ │ ├── event_queue.hpp │ │ │ ├── signal.hpp │ │ │ └── slot.hpp │ │ ├── mwthinker │ │ └── Signal │ │ │ ├── LICENSE.txt │ │ │ ├── README.md │ │ │ └── src │ │ │ └── mw │ │ │ ├── signal.h │ │ │ └── signals │ │ │ ├── connection.cpp │ │ │ └── connection.h │ │ ├── palacaze │ │ └── sigslot │ │ │ ├── LICENSE │ │ │ ├── include │ │ │ └── sigslot │ │ │ │ └── signal.hpp │ │ │ └── readme.md │ │ ├── pbhogan │ │ └── Signals │ │ │ ├── Delegate.h │ │ │ ├── README.markdown │ │ │ └── Signal.h │ │ ├── supergrover │ │ └── sigslot │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── src │ │ │ ├── signal.cpp │ │ │ └── signal.h │ │ ├── vdksoft │ │ └── signals │ │ │ ├── LICENSE-2.0.txt │ │ │ ├── README.md │ │ │ ├── doc │ │ │ └── signals.pdf │ │ │ └── include │ │ │ └── signals.h │ │ └── yassi │ │ └── yassi.h ├── benchmark_utility.hpp ├── results_gcc │ └── README.md ├── results_msvc │ └── README.md └── vs │ ├── packages.config │ ├── signal-slot-benchmarks.sln │ ├── signal-slot-benchmarks.vcxproj │ └── signal-slot-benchmarks.vcxproj.filters └── signals.hpp /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9) 2 | project (Signals) 3 | 4 | add_executable(Signals 5 | main.cpp 6 | signals.hpp 7 | Bench.h 8 | ) 9 | set_target_properties(Signals PROPERTIES 10 | CXX_STANDARD 17 11 | CXX_STANDARD_REQUIRED ON 12 | CXX_EXTENSIONS OFF 13 | ) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Fei Teng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_aco.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_aco.hpp" 2 | 3 | NOINLINE(void Aco::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Aco::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Aco::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Aco::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Aco::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Aco::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Aco::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Aco::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Aco::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Aco::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_asg.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_asg.hpp" 2 | 3 | NOINLINE(void Asg::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Asg::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Asg::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Asg::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Asg::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Asg::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Asg::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Asg::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Asg::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Asg::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_bs2.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_bs2.hpp" 2 | 3 | NOINLINE(void Bs2::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Bs2::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Bs2::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Bs2::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Bs2::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Bs2::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Bs2::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Bs2::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Bs2::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Bs2::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_cls.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_cls.hpp" 2 | 3 | NOINLINE(void Cls::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Cls::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Cls::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Cls::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Cls::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Cls::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Cls::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Cls::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Cls::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Cls::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_cps.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_cps.hpp" 2 | 3 | NOINLINE(void Cps::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Cps::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Cps::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Cps::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Cps::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Cps::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Cps::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Cps::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Cps::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Cps::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_cps_st.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_cps_st.hpp" 2 | 3 | NOINLINE(void Cps_st::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Cps_st::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Cps_st::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Cps_st::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Cps_st::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Cps_st::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Cps_st::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Cps_st::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Cps_st::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Cps_st::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_dob.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_dob.hpp" 2 | 3 | NOINLINE(void Dob::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Dob::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Dob::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Dob::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Dob::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Dob::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Dob::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Dob::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Dob::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Dob::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_evl.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_evl.hpp" 2 | 3 | NOINLINE(void Evl::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Evl::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Evl::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Evl::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Evl::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Evl::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Evl::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Evl::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Evl::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Evl::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_fts.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_fts.hpp" 2 | 3 | NOINLINE(void Fts::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Fts::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Fts::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Fts::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Fts::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Fts::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Fts::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Fts::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Fts::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Fts::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_ics.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_ics.hpp" 2 | 3 | #include 4 | 5 | NOINLINE(void Ics::initialize()) 6 | { 7 | // NOOP 8 | } 9 | NOINLINE(void Ics::validate_assert(std::size_t N)) 10 | { 11 | return Benchmark::validation_assert(N); 12 | } 13 | NOINLINE(double Ics::construction(std::size_t N, std::size_t limit)) 14 | { 15 | return Benchmark::construction(N, limit); 16 | } 17 | NOINLINE(double Ics::destruction(std::size_t N, std::size_t limit)) 18 | { 19 | return Benchmark::destruction(N, limit); 20 | } 21 | NOINLINE(double Ics::connection(std::size_t N, std::size_t limit)) 22 | { 23 | return Benchmark::connection(N, limit); 24 | } 25 | NOINLINE(double Ics::disconnect(std::size_t N, std::size_t limit)) 26 | { 27 | return Benchmark::disconnect(N, limit); 28 | } 29 | NOINLINE(double Ics::reconnect(std::size_t N, std::size_t limit)) 30 | { 31 | return Benchmark::reconnect(N, limit); 32 | } 33 | NOINLINE(double Ics::emission(std::size_t N, std::size_t limit)) 34 | { 35 | return Benchmark::emission(N, limit); 36 | } 37 | NOINLINE(double Ics::combined(std::size_t N, std::size_t limit)) 38 | { 39 | return Benchmark::combined(N, limit); 40 | } 41 | NOINLINE(double Ics::threaded(std::size_t N, std::size_t limit)) 42 | { 43 | // NOT IMPLEMENTED FOR THIS LIB 44 | return 0.0; 45 | } 46 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_jls.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_jls.hpp" 2 | 3 | NOINLINE(void Jls::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Jls::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Jls::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Jls::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Jls::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Jls::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Jls::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Jls::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Jls::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Jls::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_jos.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_jos.hpp" 2 | 3 | NOINLINE(void Jos::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Jos::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Jos::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Jos::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Jos::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Jos::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Jos::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Jos::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Jos::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Jos::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_ksc.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_ksc.hpp" 2 | 3 | NOINLINE(void Ksc::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Ksc::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Ksc::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Ksc::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Ksc::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Ksc::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Ksc::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Ksc::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Ksc::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Ksc::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_lfs.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_lfs.hpp" 2 | 3 | NOINLINE(void Lfs::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Lfs::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Lfs::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Lfs::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Lfs::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Lfs::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Lfs::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Lfs::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Lfs::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Lfs::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_lss.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_lss.hpp" 2 | 3 | NOINLINE(void Lss::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Lss::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Lss::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Lss::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Lss::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Lss::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Lss::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Lss::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Lss::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Lss::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_mws.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_mws.hpp" 2 | 3 | NOINLINE(void Mws::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Mws::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Mws::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Mws::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Mws::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Mws::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Mws::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Mws::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Mws::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Mws::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nes.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nes.hpp" 2 | 3 | NOINLINE(void Nes::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Nes::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nes::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nes::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nes::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nes::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nes::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nes::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nes::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nes::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nls.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nls.hpp" 2 | 3 | NOINLINE(void Nls::initialize()) 4 | { 5 | neolib::event_system::set_multi_threaded(); 6 | } 7 | NOINLINE(void Nls::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nls::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nls::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nls::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nls::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nls::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nls::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nls::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nls::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nls_st.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nls_st.hpp" 2 | 3 | NOINLINE(void Nls_st::initialize()) 4 | { 5 | neolib::event_system::set_single_threaded(); 6 | } 7 | NOINLINE(void Nls_st::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nls_st::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nls_st::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nls_st::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nls_st::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nls_st::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nls_st::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nls_st::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nls_st::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nod.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nod.hpp" 2 | 3 | NOINLINE(void Nod::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Nod::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nod::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nod::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nod::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nod::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nod::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nod::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nod::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nod::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nod_st.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nod_st.hpp" 2 | 3 | NOINLINE(void Nod_st::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Nod_st::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nod_st::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nod_st::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nod_st::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nod_st::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nod_st::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nod_st::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nod_st::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nod_st::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return 0.0; 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nss_st.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nss_st.hpp" 2 | 3 | NOINLINE(void Nss_st::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Nss_st::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nss_st::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nss_st::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nss_st::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nss_st::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nss_st::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nss_st::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nss_st::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nss_st::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nss_sts.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nss_sts.hpp" 2 | 3 | NOINLINE(void Nss_sts::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Nss_sts::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nss_sts::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nss_sts::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nss_sts::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nss_sts::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nss_sts::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nss_sts::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nss_sts::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nss_sts::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nss_ts.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nss_ts.hpp" 2 | 3 | NOINLINE(void Nss_ts::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Nss_ts::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nss_ts::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nss_ts::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nss_ts::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nss_ts::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nss_ts::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nss_ts::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nss_ts::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nss_ts::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_nss_tss.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_nss_tss.hpp" 2 | 3 | NOINLINE(void Nss_tss::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Nss_tss::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Nss_tss::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Nss_tss::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Nss_tss::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Nss_tss::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Nss_tss::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Nss_tss::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Nss_tss::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Nss_tss::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_psg.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_psg.hpp" 2 | 3 | NOINLINE(void Psg::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Psg::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Psg::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Psg::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Psg::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Psg::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Psg::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Psg::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Psg::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Psg::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_pss.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_pss.hpp" 2 | 3 | NOINLINE(void Pss::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Pss::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Pss::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Pss::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Pss::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Pss::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Pss::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Pss::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Pss::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Pss::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | return Benchmark::threaded(N, limit); 42 | } 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_pss_st.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_pss_st.hpp" 2 | 3 | NOINLINE(void Pss_st::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Pss_st::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Pss_st::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Pss_st::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Pss_st::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Pss_st::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Pss_st::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Pss_st::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Pss_st::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Pss_st::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_sss.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_sss.hpp" 2 | 3 | NOINLINE(void Sss::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Sss::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Sss::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Sss::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Sss::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Sss::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Sss::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Sss::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Sss::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Sss::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_vdk.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_vdk.hpp" 2 | 3 | NOINLINE(void Vdk::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Vdk::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Vdk::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Vdk::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Vdk::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Vdk::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Vdk::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Vdk::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Vdk::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Vdk::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_wnk.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_wnk.hpp" 2 | 3 | NOINLINE(void Wnk::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Wnk::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Wnk::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Wnk::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Wnk::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Wnk::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Wnk::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Wnk::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Wnk::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Wnk::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/cpp/benchmark_yas.cpp: -------------------------------------------------------------------------------- 1 | #include "../hpp/benchmark_yas.hpp" 2 | 3 | NOINLINE(void Yas::initialize()) 4 | { 5 | // NOOP 6 | } 7 | NOINLINE(void Yas::validate_assert(std::size_t N)) 8 | { 9 | return Benchmark::validation_assert(N); 10 | } 11 | NOINLINE(double Yas::construction(std::size_t N, std::size_t limit)) 12 | { 13 | return Benchmark::construction(N, limit); 14 | } 15 | NOINLINE(double Yas::destruction(std::size_t N, std::size_t limit)) 16 | { 17 | return Benchmark::destruction(N, limit); 18 | } 19 | NOINLINE(double Yas::connection(std::size_t N, std::size_t limit)) 20 | { 21 | return Benchmark::connection(N, limit); 22 | } 23 | NOINLINE(double Yas::disconnect(std::size_t N, std::size_t limit)) 24 | { 25 | return Benchmark::disconnect(N, limit); 26 | } 27 | NOINLINE(double Yas::reconnect(std::size_t N, std::size_t limit)) 28 | { 29 | return Benchmark::reconnect(N, limit); 30 | } 31 | NOINLINE(double Yas::emission(std::size_t N, std::size_t limit)) 32 | { 33 | return Benchmark::emission(N, limit); 34 | } 35 | NOINLINE(double Yas::combined(std::size_t N, std::size_t limit)) 36 | { 37 | return Benchmark::combined(N, limit); 38 | } 39 | NOINLINE(double Yas::threaded(std::size_t N, std::size_t limit)) 40 | { 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | return 0.0; 43 | } 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_asg.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/amc522/signal11/Signal.h" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Asg 8 | { 9 | Signal11::ConnectionScope reg; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = Signal11::Signal; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.reg += subject.connect(&foo, &Foo::handler); 24 | } 25 | template 26 | static void emit_method(Subject& subject, Rng& rng) 27 | { 28 | subject.emit(rng); 29 | } 30 | 31 | // Used for switching policies at runtime 32 | static void initialize(); 33 | 34 | static void validate_assert(std::size_t); 35 | static double construction(std::size_t, std::size_t); 36 | static double destruction(std::size_t, std::size_t); 37 | static double connection(std::size_t, std::size_t); 38 | static double disconnect(std::size_t, std::size_t); 39 | static double reconnect(std::size_t, std::size_t); 40 | static double emission(std::size_t, std::size_t); 41 | static double combined(std::size_t, std::size_t); 42 | 43 | // NOT IMPLEMENTED FOR THIS LIB 44 | static double threaded(std::size_t, std::size_t); 45 | 46 | // The following is used for report outputs 47 | static constexpr const char* C_LIB_NAME = "amc522 Signal11"; 48 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/amc522/Signal11"; 49 | static constexpr const char* C_LIB_FILE = "benchmark_asg"; 50 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "X"; 51 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 52 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 53 | 54 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 55 | }; 56 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_bs2.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Bs2 : public boost::signals2::trackable 8 | { 9 | NOINLINE(void handler(Rng& rng)) 10 | { 11 | volatile std::size_t a = rng(); (void)a; 12 | } 13 | 14 | public: 15 | 16 | using Signal = boost::signals2::signal; 17 | 18 | template 19 | static void connect_method(Subject& subject, Foo& foo) 20 | { 21 | subject.connect(std::bind(&Foo::handler, &foo, std::placeholders::_1)); 22 | } 23 | template 24 | static void emit_method(Subject& subject, Rng& rng) 25 | { 26 | subject(rng); 27 | } 28 | 29 | // Used for switching policies at runtime 30 | static void initialize(); 31 | 32 | static void validate_assert(std::size_t); 33 | static double construction(std::size_t, std::size_t); 34 | static double destruction(std::size_t, std::size_t); 35 | static double connection(std::size_t, std::size_t); 36 | static double disconnect(std::size_t, std::size_t); 37 | static double reconnect(std::size_t, std::size_t); 38 | static double emission(std::size_t, std::size_t); 39 | static double combined(std::size_t, std::size_t); 40 | static double threaded(std::size_t, std::size_t); 41 | 42 | // The following is used for report outputs 43 | static constexpr const char* C_LIB_NAME = "* Boost Signals2"; 44 | static constexpr const char* C_LIB_SOURCE_URL = "http://www.boost.org/doc/libs/1_58_0/doc/html/signals2.html"; 45 | static constexpr const char* C_LIB_FILE = "benchmark_bs2"; 46 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "-"; 47 | static constexpr const char* C_LIB_DATA_STRUCTURE = "?"; 48 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "X"; 49 | 50 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 51 | }; 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_dob.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/dacap/obs/dacap_connection.h" 4 | #include "../lib/dacap/obs/dacap_signal.h" 5 | 6 | #include "../../benchmark.hpp" 7 | 8 | class Dob 9 | { 10 | obs::scoped_connection reg; 11 | 12 | NOINLINE(void handler(Rng& rng)) 13 | { 14 | volatile std::size_t a = rng(); (void)a; 15 | } 16 | 17 | public: 18 | 19 | using Signal = obs::signal; 20 | 21 | template 22 | static void connect_method(Subject& subject, Foo& foo) 23 | { 24 | foo.reg = subject.connect(&Foo::handler, &foo); 25 | } 26 | template 27 | static void emit_method(Subject& subject, Rng& rng) 28 | { 29 | subject(rng); 30 | } 31 | 32 | // Used for switching policies at runtime 33 | static void initialize(); 34 | 35 | static void validate_assert(std::size_t); 36 | static double construction(std::size_t, std::size_t); 37 | static double destruction(std::size_t, std::size_t); 38 | static double connection(std::size_t, std::size_t); 39 | static double disconnect(std::size_t, std::size_t); 40 | static double reconnect(std::size_t, std::size_t); 41 | static double emission(std::size_t, std::size_t); 42 | static double combined(std::size_t, std::size_t); 43 | static double threaded(std::size_t, std::size_t); 44 | 45 | // The following is used for report outputs 46 | static constexpr const char* C_LIB_NAME = "* dacap observable"; 47 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/dacap/observable"; 48 | static constexpr const char* C_LIB_FILE = "benchmark_dob"; 49 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "-"; 50 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 51 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "X"; 52 | 53 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 54 | }; 55 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_evl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/eviltwin/observer.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Evl 8 | { 9 | obs::detail::UniversalPtr reg; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = obs::Subject; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.reg = subject.registerObserver( 24 | std::bind(&Foo::handler, &foo, std::placeholders::_1) 25 | ); 26 | } 27 | template 28 | static void emit_method(Subject& subject, Rng& rng) 29 | { 30 | subject(rng); 31 | } 32 | 33 | // Used for switching policies at runtime 34 | static void initialize(); 35 | 36 | static void validate_assert(std::size_t); 37 | static double construction(std::size_t, std::size_t); 38 | static double destruction(std::size_t, std::size_t); 39 | static double connection(std::size_t, std::size_t); 40 | static double disconnect(std::size_t, std::size_t); 41 | static double reconnect(std::size_t, std::size_t); 42 | static double emission(std::size_t, std::size_t); 43 | static double combined(std::size_t, std::size_t); 44 | 45 | // NOT IMPLEMENTED FOR THIS LIB 46 | static double threaded(std::size_t, std::size_t); 47 | 48 | static constexpr const char* C_LIB_NAME = "EvilTwin Observer"; 49 | static constexpr const char* C_LIB_SOURCE_URL = "http://eviltwingames.com/blog/the-observer-pattern-revisited/"; 50 | static constexpr const char* C_LIB_FILE = "benchmark_evl"; 51 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "X"; 52 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 53 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 54 | 55 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 56 | }; 57 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_fts.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/fteng/signals.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Fts 8 | { 9 | NOINLINE(void handler(Rng& rng)) 10 | { 11 | volatile std::size_t a = rng(); (void)a; 12 | } 13 | 14 | public: 15 | 16 | using Signal = fteng::signal; 17 | 18 | template 19 | static void connect_method(Subject& subject, Foo& foo) 20 | { 21 | subject.template connect<&Foo::handler>(&foo); 22 | } 23 | template 24 | static void emit_method(Subject& subject, Rng& rng) 25 | { 26 | subject(rng); 27 | } 28 | 29 | // Used for switching policies at runtime 30 | static void initialize(); 31 | 32 | static void validate_assert(std::size_t); 33 | static double construction(std::size_t, std::size_t); 34 | static double destruction(std::size_t, std::size_t); 35 | static double connection(std::size_t, std::size_t); 36 | static double disconnect(std::size_t, std::size_t); 37 | static double reconnect(std::size_t, std::size_t); 38 | static double emission(std::size_t, std::size_t); 39 | static double combined(std::size_t, std::size_t); 40 | static double threaded(std::size_t, std::size_t); 41 | 42 | // The following is used for report outputs 43 | static constexpr const char* C_LIB_NAME = "FTeng Signals"; 44 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/TheWisp/signals"; 45 | static constexpr const char* C_LIB_FILE = "benchmark_fts"; 46 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "X"; 47 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 48 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 49 | 50 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 51 | }; 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_ics.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Ics 8 | { 9 | NOINLINE(void handler(Rng& rng)) 10 | { 11 | volatile std::size_t a = rng(); (void)a; 12 | } 13 | 14 | public: 15 | 16 | using Signal = iscool::signals::signal; 17 | 18 | template 19 | static void connect_method(Subject& subject, Foo& foo) 20 | { 21 | subject.connect(std::bind(&Foo::handler, &foo, std::placeholders::_1)); 22 | } 23 | template 24 | static void emit_method(Subject& subject, Rng& rng) 25 | { 26 | subject(rng); 27 | } 28 | 29 | // Used for switching policies at runtime 30 | static void initialize(); 31 | 32 | static void validate_assert(std::size_t); 33 | static double construction(std::size_t, std::size_t); 34 | static double destruction(std::size_t, std::size_t); 35 | static double connection(std::size_t, std::size_t); 36 | static double disconnect(std::size_t, std::size_t); 37 | static double reconnect(std::size_t, std::size_t); 38 | static double emission(std::size_t, std::size_t); 39 | static double combined(std::size_t, std::size_t); 40 | static double threaded(std::size_t, std::size_t); 41 | 42 | // The following is used for report outputs 43 | static constexpr const char* C_LIB_NAME = "iscool::signals"; 44 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/IsCoolEntertainment/iscool-core/"; 45 | static constexpr const char* C_LIB_FILE = "benchmark_ics"; 46 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "-"; 47 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 48 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 49 | 50 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 51 | }; 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_jls.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/jeffomatic/jl_signal/src/Signal.h" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Jls : public jl::SignalObserver 8 | { 9 | NOINLINE(void handler(Rng& rng)) 10 | { 11 | volatile std::size_t a = rng(); (void)a; 12 | } 13 | 14 | public: 15 | 16 | using Signal = jl::Signal; 17 | 18 | template 19 | static void connect_method(Subject& subject, Foo& foo) 20 | { 21 | subject.Connect(&foo, &Foo::handler); 22 | } 23 | template 24 | static void emit_method(Subject& subject, Rng& rng) 25 | { 26 | subject.Emit(rng); 27 | } 28 | 29 | // Used for switching policies at runtime 30 | static void initialize(); 31 | 32 | static void validate_assert(std::size_t); 33 | static double construction(std::size_t, std::size_t); 34 | static double destruction(std::size_t, std::size_t); 35 | static double connection(std::size_t, std::size_t); 36 | static double disconnect(std::size_t, std::size_t); 37 | static double reconnect(std::size_t, std::size_t); 38 | static double emission(std::size_t, std::size_t); 39 | static double combined(std::size_t, std::size_t); 40 | 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | static double threaded(std::size_t, std::size_t); 43 | 44 | static constexpr const char* C_LIB_NAME = "jeffomatic jl_signal"; 45 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/jeffomatic/jl_signal"; 46 | static constexpr const char* C_LIB_FILE = "benchmark_jls"; 47 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "-"; 48 | static constexpr const char* C_LIB_DATA_STRUCTURE = "doubly linked list"; 49 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 50 | 51 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 52 | }; 53 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_nls.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/i42output/include/neolib/event.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Nls 8 | { 9 | neolib::sink reg; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = neolib::event; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.reg += subject(std::bind(&Foo::handler, &foo, std::placeholders::_1)); 24 | } 25 | template 26 | static void emit_method(Subject& subject, Rng& rng) 27 | { 28 | subject.trigger(rng); 29 | } 30 | 31 | // Used for switching policies at runtime 32 | static void initialize(); 33 | 34 | static void validate_assert(std::size_t); 35 | static double construction(std::size_t, std::size_t); 36 | static double destruction(std::size_t, std::size_t); 37 | static double connection(std::size_t, std::size_t); 38 | static double disconnect(std::size_t, std::size_t); 39 | static double reconnect(std::size_t, std::size_t); 40 | static double emission(std::size_t, std::size_t); 41 | static double combined(std::size_t, std::size_t); 42 | static double threaded(std::size_t, std::size_t); 43 | 44 | static constexpr const char* C_LIB_NAME = "* neolib event"; 45 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/i42output/neolib"; 46 | static constexpr const char* C_LIB_FILE = "benchmark_nls"; 47 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "-"; 48 | static constexpr const char* C_LIB_DATA_STRUCTURE = "**std::unordered_map"; 49 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "X"; 50 | 51 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 52 | }; 53 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_nls_st.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/i42output/include/neolib/event.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Nls_st 8 | { 9 | neolib::sink reg; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = neolib::event; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.reg += subject(std::bind(&Foo::handler, &foo, std::placeholders::_1)); 24 | } 25 | template 26 | static void emit_method(Subject& subject, Rng& rng) 27 | { 28 | subject.trigger(rng); 29 | } 30 | 31 | // Used for switching policies at runtime 32 | static void initialize(); 33 | 34 | static void validate_assert(std::size_t); 35 | static double construction(std::size_t, std::size_t); 36 | static double destruction(std::size_t, std::size_t); 37 | static double connection(std::size_t, std::size_t); 38 | static double disconnect(std::size_t, std::size_t); 39 | static double reconnect(std::size_t, std::size_t); 40 | static double emission(std::size_t, std::size_t); 41 | static double combined(std::size_t, std::size_t); 42 | 43 | // NOT IMPLEMENTED FOR THIS LIB 44 | static double threaded(std::size_t, std::size_t); 45 | 46 | static constexpr const char* C_LIB_NAME = "neolib event"; 47 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/i42output/neolib"; 48 | static constexpr const char* C_LIB_FILE = "benchmark_nls_st"; 49 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "-"; 50 | static constexpr const char* C_LIB_DATA_STRUCTURE = "**std::unordered_map"; 51 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 52 | 53 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 54 | }; 55 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_nod.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/fr00b0/nod/include/nod/nod.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Nod 8 | { 9 | nod::scoped_connection reg; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = nod::signal; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.reg = subject.connect(std::bind(&Foo::handler, &foo, std::placeholders::_1)); 24 | } 25 | template 26 | static void emit_method(Subject& subject, Rng& rng) 27 | { 28 | subject(rng); 29 | } 30 | 31 | // Used for switching policies at runtime 32 | static void initialize(); 33 | 34 | static void validate_assert(std::size_t); 35 | static double construction(std::size_t, std::size_t); 36 | static double destruction(std::size_t, std::size_t); 37 | static double connection(std::size_t, std::size_t); 38 | static double disconnect(std::size_t, std::size_t); 39 | static double reconnect(std::size_t, std::size_t); 40 | static double emission(std::size_t, std::size_t); 41 | static double combined(std::size_t, std::size_t); 42 | static double threaded(std::size_t, std::size_t); 43 | 44 | static constexpr const char* C_LIB_NAME = "* fr00b0 nod"; 45 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/fr00b0/nod"; 46 | static constexpr const char* C_LIB_FILE = "benchmark_nod"; 47 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "X"; 48 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 49 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "X"; 50 | 51 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 52 | }; 53 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_nod_st.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/fr00b0/nod/include/nod/nod.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Nod_st 8 | { 9 | nod::scoped_connection reg; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = nod::unsafe_signal; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.reg = subject.connect(std::bind(&Foo::handler, &foo, std::placeholders::_1)); 24 | } 25 | template 26 | static void emit_method(Subject& subject, Rng& rng) 27 | { 28 | subject(rng); 29 | } 30 | 31 | // Used for switching policies at runtime 32 | static void initialize(); 33 | 34 | static void validate_assert(std::size_t); 35 | static double construction(std::size_t, std::size_t); 36 | static double destruction(std::size_t, std::size_t); 37 | static double connection(std::size_t, std::size_t); 38 | static double disconnect(std::size_t, std::size_t); 39 | static double reconnect(std::size_t, std::size_t); 40 | static double emission(std::size_t, std::size_t); 41 | static double combined(std::size_t, std::size_t); 42 | static double threaded(std::size_t, std::size_t); 43 | 44 | static constexpr const char* C_LIB_NAME = "fr00b0 nod"; 45 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/fr00b0/nod"; 46 | static constexpr const char* C_LIB_FILE = "benchmark_nod_st"; 47 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "X"; 48 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 49 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 50 | 51 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 52 | }; 53 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_pss.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/palacaze/sigslot/include/sigslot/signal.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Pss 8 | { 9 | sigslot::scoped_connection conn; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = sigslot::signal; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.conn = subject.connect_scoped(&Foo::handler, &foo); 24 | } 25 | template 26 | static void emit_method(Subject& subject, Rng& rng) 27 | { 28 | subject(rng); 29 | } 30 | 31 | // Used for switching policies at runtime 32 | static void initialize(); 33 | 34 | static void validate_assert(std::size_t); 35 | static double construction(std::size_t, std::size_t); 36 | static double destruction(std::size_t, std::size_t); 37 | static double connection(std::size_t, std::size_t); 38 | static double disconnect(std::size_t, std::size_t); 39 | static double reconnect(std::size_t, std::size_t); 40 | static double emission(std::size_t, std::size_t); 41 | static double combined(std::size_t, std::size_t); 42 | static double threaded(std::size_t, std::size_t); 43 | 44 | static constexpr const char* C_LIB_NAME = "* palacaze sigslot"; 45 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/palacaze/sigslot"; 46 | static constexpr const char* C_LIB_FILE = "benchmark_pss"; 47 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "X"; 48 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 49 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "X"; 50 | 51 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 52 | }; 53 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_pss_st.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/palacaze/sigslot/include/sigslot/signal.hpp" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Pss_st 8 | { 9 | sigslot::scoped_connection conn; 10 | 11 | NOINLINE(void handler(Rng& rng)) 12 | { 13 | volatile std::size_t a = rng(); (void)a; 14 | } 15 | 16 | public: 17 | 18 | using Signal = sigslot::signal_st; 19 | 20 | template 21 | static void connect_method(Subject& subject, Foo& foo) 22 | { 23 | foo.conn = subject.connect_scoped(&Foo::handler, &foo); 24 | } 25 | template 26 | static void emit_method(Subject& subject, Rng& rng) 27 | { 28 | subject(rng); 29 | } 30 | 31 | // Used for switching policies at runtime 32 | static void initialize(); 33 | 34 | static void validate_assert(std::size_t); 35 | static double construction(std::size_t, std::size_t); 36 | static double destruction(std::size_t, std::size_t); 37 | static double connection(std::size_t, std::size_t); 38 | static double disconnect(std::size_t, std::size_t); 39 | static double reconnect(std::size_t, std::size_t); 40 | static double emission(std::size_t, std::size_t); 41 | static double combined(std::size_t, std::size_t); 42 | 43 | // NOT IMPLEMENTED FOR THIS LIB 44 | static double threaded(std::size_t, std::size_t); 45 | 46 | static constexpr const char* C_LIB_NAME = "palacaze sigslot"; 47 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/palacaze/sigslot"; 48 | static constexpr const char* C_LIB_FILE = "benchmark_pss_st"; 49 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "X"; 50 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::vector"; 51 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 52 | 53 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 54 | }; 55 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/hpp/benchmark_sss.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../lib/supergrover/sigslot/src/signal.h" 4 | 5 | #include "../../benchmark.hpp" 6 | 7 | class Sss : public SigSlotBase 8 | { 9 | NOINLINE(void handler(Rng& rng)) 10 | { 11 | volatile std::size_t a = rng(); (void)a; 12 | } 13 | 14 | public: 15 | 16 | using Signal = ::Signal; 17 | 18 | template 19 | static void connect_method(Subject& subject, Foo& foo) 20 | { 21 | subject.bind(&Foo::handler, &foo); 22 | } 23 | template 24 | static void emit_method(Subject& subject, Rng& rng) 25 | { 26 | subject.emit(rng); 27 | } 28 | 29 | // Used for switching policies at runtime 30 | static void initialize(); 31 | 32 | static void validate_assert(std::size_t); 33 | static double construction(std::size_t, std::size_t); 34 | static double destruction(std::size_t, std::size_t); 35 | static double connection(std::size_t, std::size_t); 36 | static double disconnect(std::size_t, std::size_t); 37 | static double reconnect(std::size_t, std::size_t); 38 | static double emission(std::size_t, std::size_t); 39 | static double combined(std::size_t, std::size_t); 40 | 41 | // NOT IMPLEMENTED FOR THIS LIB 42 | static double threaded(std::size_t, std::size_t); 43 | 44 | static constexpr const char* C_LIB_NAME = "supergrover sigslot"; 45 | static constexpr const char* C_LIB_SOURCE_URL = "https://github.com/supergrover/sigslot"; 46 | static constexpr const char* C_LIB_FILE = "benchmark_sss"; 47 | static constexpr const char* C_LIB_IS_HEADER_ONLY = "-"; 48 | static constexpr const char* C_LIB_DATA_STRUCTURE = "std::list"; 49 | static constexpr const char* C_LIB_IS_THREAD_SAFE = "-"; 50 | 51 | static constexpr const std::size_t C_LIB_SIZEOF_SIGNAL = sizeof(Signal); 52 | }; 53 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 iSpring Solutions Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/README.md: -------------------------------------------------------------------------------- 1 | # FastSignals 2 | 3 | Yet another C++ signals and slots library 4 | 5 | * Works as drop-in replacement for Boost.Signals2 with the same API 6 | * Has better performance and more compact binary code 7 | * Thread-safe in most operations, including concurrent connects/disconnects/emits 8 | * Implemented with compact, pure C++17 code 9 | 10 | [![Build Status](https://travis-ci.org/ispringteam/FastSignals.svg?branch=master)](https://travis-ci.org/ispringteam/FastSignals) 11 | [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) 12 | 13 | ## Documentation 14 | 15 | * [Why FastSignals?](docs/why-fastsignals.md) 16 | * [Simple Examples](docs/simple-examples.md) 17 | * [Migration from Boost.Signals2](docs/migration-from-boost-signals2.md) 18 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/docs/simple-examples.md: -------------------------------------------------------------------------------- 1 | # Simple Examples 2 | 3 | >If you are not familar with Boost.Signals2, please read [Boost.Signals2: Connections](https://theboostcpplibraries.com/boost.signals2-connections) 4 | 5 | ## Example with signal<> and connection 6 | 7 | ```cpp 8 | // Creates signal and connects 1 slot, calls 2 times, disconnects, calls again. 9 | // Outputs: 10 | // 13 11 | // 17 12 | #include "libfastsignals/signal.h" 13 | 14 | using namespace is::signals; 15 | 16 | int main() 17 | { 18 | signal valueChanged; 19 | connection conn; 20 | conn = valueChanged.connect([](int value) { 21 | cout << value << endl; 22 | }); 23 | valueChanged(13); 24 | valueChanged(17); 25 | conn.disconnect(); 26 | valueChanged(42); 27 | } 28 | ``` 29 | 30 | ## Example with scoped_connection 31 | 32 | ```cpp 33 | // Creates signal and connects 1 slot, calls 2 times, calls again after scoped_connection destroyed. 34 | // - note: scoped_connection closes connection in destructor 35 | // Outputs: 36 | // 13 37 | // 17 38 | #include "libfastsignals/signal.h" 39 | 40 | using namespace is::signals; 41 | 42 | int main() 43 | { 44 | signal valueChanged; 45 | { 46 | scoped_connection conn; 47 | conn = valueChanged.connect([](int value) { 48 | cout << value << endl; 49 | }); 50 | valueChanged(13); 51 | valueChanged(17); 52 | } 53 | valueChanged(42); 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/docs/why-fastsignals.md: -------------------------------------------------------------------------------- 1 | # Why FastSignals? 2 | 3 | FastSignals is a C++17 signals/slots implementation which API is compatible with Boost.Signals2. 4 | 5 | FastSignals pros: 6 | 7 | * Faster than Boost.Signals2 8 | * Has more compact binary code 9 | * Has the same API as Boost.Signals2 10 | 11 | FastSignals cons: 12 | 13 | * Supports only C++17 compatible compilers: Visual Studio 2017, modern Clang, modern GCC 14 | * Lacks a few rarely used features presented in Boost.Signals2 15 | * No access to connection from slot with `signal::connect_extended` method 16 | * No connected object tracking with `slot::track` method 17 | * Use [bind_weak](bind_weak.md) instead 18 | * No temporary signal blocking with `shared_connection_block` class 19 | * Cannot disconnect equivalent slots since no `disconnect(slot)` function overload 20 | * Any other API difference is a bug - please report it! 21 | 22 | See also [Migration from Boost.Signals2](migration-from-boost-signals2.md). 23 | 24 | ## Benchmark results 25 | 26 | Directory `tests/libfastsignals_bench` contains simple benchmark with compares two signal/slot implementations: 27 | 28 | * Boost.Signals2 29 | * libfastsignals 30 | 31 | Benchmark compairs performance when signal emitted frequently with 0, 1 and 8 active connections. In these cases libfastsignals is 3-6 times faster. 32 | 33 | ``` 34 | *** Results: 35 | measure emit_boost emit_fastsignals 36 | emit_boost/0 1.00 3.00 37 | emit_boost/1 1.00 5.76 38 | emit_boost/8 1.00 3.70 39 | *** 40 | ``` 41 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB LIBFASTSIGNALS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") 3 | add_library(libfastsignals ${LIBFASTSIGNALS_SRC}) 4 | custom_enable_cxx17(libfastsignals) 5 | target_include_directories(libfastsignals INTERFACE "${CMAKE_SOURCE_DIR}") 6 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/include/combiners.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace is::signals 6 | { 7 | 8 | /** 9 | * This results combiner reduces results collection into last value of this collection. 10 | * In other words, it keeps only result of the last slot call. 11 | */ 12 | template 13 | class optional_last_value 14 | { 15 | public: 16 | using result_type = std::optional; 17 | 18 | template 19 | void operator()(TRef&& value) 20 | { 21 | m_result = std::forward(value); 22 | } 23 | 24 | result_type get_value() const 25 | { 26 | return m_result; 27 | } 28 | 29 | private: 30 | result_type m_result = {}; 31 | }; 32 | 33 | template <> 34 | class optional_last_value 35 | { 36 | public: 37 | using result_type = void; 38 | }; 39 | 40 | } // namespace is::signals 41 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/include/function.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "function_detail.h" 4 | 5 | namespace is::signals 6 | { 7 | // Derive your class from not_directly_callable to prevent function from wrapping it using its template constructor 8 | // Useful if your class provides custom operator for casting to function 9 | struct not_directly_callable 10 | { 11 | }; 12 | 13 | template 14 | using enable_if_callable_t = typename std::enable_if_t< 15 | !std::is_same_v, Function> && !std::is_base_of_v> && std::is_same_v, Return>>; 16 | 17 | template 18 | class function; 19 | 20 | // Compact function class - causes minimal code bloat when compiled. 21 | // Replaces std::function in this library. 22 | template 23 | class function 24 | { 25 | public: 26 | function() = default; 27 | 28 | function(const function& other) = default; 29 | function(function&& other) noexcept = default; 30 | function& operator=(const function& other) = default; 31 | function& operator=(function&& other) noexcept = default; 32 | 33 | template , Return, Arguments...>> 34 | function(Fn&& function) noexcept(detail::is_noexcept_packed_function_init) 35 | { 36 | m_packed.init(std::forward(function)); 37 | } 38 | 39 | Return operator()(Arguments&&... args) const 40 | { 41 | auto& proxy = m_packed.get(); 42 | return proxy(std::forward(args)...); 43 | } 44 | 45 | detail::packed_function release() noexcept 46 | { 47 | return std::move(m_packed); 48 | } 49 | 50 | private: 51 | detail::packed_function m_packed; 52 | }; 53 | 54 | } // namespace is::signals 55 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/include/msvc_autolink.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#if defined(_MSC_VER) 4 | // 5 | //# if defined(__clang__) 6 | //# if defined(_DEBUG) && defined(_WIN64) 7 | //# pragma comment(lib, "libfastsignalsd-llvm-x64.lib") 8 | //# elif defined(_DEBUG) 9 | //# pragma comment(lib, "libfastsignalsd-llvm-x32.lib") 10 | //# elif defined(_WIN64) 11 | //# pragma comment(lib, "libfastsignals-llvm-x64.lib") 12 | //# else 13 | //# pragma comment(lib, "libfastsignals-llvm-x32.lib") 14 | //# endif 15 | //# elif _MSC_VER <= 1900 16 | //# error this library needs Visual Studio 2017 and higher 17 | //# elif _MSC_VER < 2000 18 | //# if defined(_DEBUG) && defined(_WIN64) 19 | //# pragma comment(lib, "libfastsignalsd-v141-x64.lib") 20 | //# elif defined(_DEBUG) 21 | //# pragma comment(lib, "libfastsignalsd-v141-x32.lib") 22 | //# elif defined(_WIN64) 23 | //# pragma comment(lib, "libfastsignals-v141-x64.lib") 24 | //# else 25 | //# pragma comment(lib, "libfastsignals-v141-x32.lib") 26 | //# endif 27 | //# else 28 | //# error unknown Visual Studio version, auto-linking setup failed 29 | //# endif 30 | // 31 | //#endif 32 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/include/signal_impl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "function_detail.h" 4 | #include "spin_mutex.h" 5 | #include 6 | #include 7 | 8 | namespace is::signals::detail 9 | { 10 | 11 | class signal_impl 12 | { 13 | public: 14 | uint64_t add(packed_function fn); 15 | 16 | void remove(uint64_t id) noexcept; 17 | 18 | void remove_all() noexcept; 19 | 20 | size_t count() const noexcept; 21 | 22 | template 23 | Result invoke(Args... args) const 24 | { 25 | packed_function slot; 26 | size_t slotIndex = 0; 27 | uint64_t slotId = 1; 28 | 29 | if constexpr (std::is_same_v) 30 | { 31 | while (get_next_slot(slot, slotIndex, slotId)) 32 | { 33 | slot.get()(std::forward(args)...); 34 | } 35 | } 36 | else 37 | { 38 | Combiner combiner; 39 | while (get_next_slot(slot, slotIndex, slotId)) 40 | { 41 | combiner(slot.get()(std::forward(args)...)); 42 | } 43 | return combiner.get_value(); 44 | } 45 | } 46 | 47 | private: 48 | bool get_next_slot(packed_function& slot, size_t& expectedIndex, uint64_t& nextId) const; 49 | 50 | mutable spin_mutex m_mutex; 51 | std::vector m_functions; 52 | std::vector m_ids; 53 | uint64_t m_nextId = 1; 54 | }; 55 | 56 | using signal_impl_ptr = std::shared_ptr; 57 | using signal_impl_weak_ptr = std::weak_ptr; 58 | 59 | } // namespace is::signals::detail 60 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/include/spin_mutex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace is::signals::detail 5 | { 6 | 7 | class spin_mutex 8 | { 9 | public: 10 | spin_mutex() = default; 11 | spin_mutex(const spin_mutex&) = delete; 12 | spin_mutex& operator=(const spin_mutex&) = delete; 13 | spin_mutex(spin_mutex&&) = delete; 14 | spin_mutex& operator=(spin_mutex&&) = delete; 15 | 16 | inline bool try_lock() noexcept 17 | { 18 | return !m_busy.test_and_set(std::memory_order_acquire); 19 | } 20 | 21 | inline void lock() noexcept 22 | { 23 | while (!try_lock()) 24 | { 25 | /* do nothing */; 26 | } 27 | } 28 | 29 | inline void unlock() noexcept 30 | { 31 | m_busy.clear(std::memory_order_release); 32 | } 33 | 34 | private: 35 | std::atomic_flag m_busy = ATOMIC_FLAG_INIT; 36 | }; 37 | 38 | } // namespace is::signals::detail 39 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/include/type_traits.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace is::signals 4 | { 5 | namespace detail 6 | { 7 | 8 | template 9 | struct signal_arg 10 | { 11 | using type = const T&; 12 | }; 13 | 14 | template 15 | struct signal_arg 16 | { 17 | using type = U&; 18 | }; 19 | } // namespace detail 20 | 21 | template 22 | using signal_arg_t = typename detail::signal_arg::type; 23 | 24 | } // namespace is::signals 25 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/CppFakeIt/libfastsignals/libfastsignals.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | include 6 | 7 | 8 | include 9 | 10 | 11 | include 12 | 13 | 14 | include 15 | 16 | 17 | include 18 | 19 | 20 | include 21 | 22 | 23 | include 24 | 25 | 26 | include 27 | 28 | 29 | include 30 | 31 | 32 | include 33 | 34 | 35 | 36 | 37 | {474d3307-8dbe-47d6-a12f-35f944912d9d} 38 | 39 | 40 | {ac074187-2f8f-44b9-a170-24568deb06e6} 41 | 42 | 43 | 44 | 45 | src 46 | 47 | 48 | src 49 | 50 | 51 | src 52 | 53 | 54 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/Kosta-Github/signals-cpp/LICENSE.txt: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2013 by Konstantin (Kosta) Baumann & Autodesk Inc. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/Kosta-Github/signals-cpp/signals-cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(signals-cpp CXX) 4 | message("configure: signals-cpp library") 5 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/Kosta-Github/signals-cpp/signals-cpp/config.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2013 by Konstantin (Kosta) Baumann & Autodesk Inc. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | #pragma once 25 | 26 | #if defined(_MSC_VER) && (_MSC_VER < 1900) 27 | # define SIGNALS_CPP_NOEXCEPT throw() 28 | #else // defined(_MSC_VER) && (_MSC_VER < 1900) 29 | # define SIGNALS_CPP_NOEXCEPT noexcept 30 | #endif // defined(_MSC_VER) && (_MSC_VER < 1900) 31 | 32 | #if defined(_MSC_VER) && (_MSC_VER < 1900) 33 | # define SIGNALS_CPP_NEED_EXPLICIT_MOVE 34 | #endif // defined(_MSC_VER) && (_MSC_VER < 1900) 35 | 36 | #if defined(__clang__) || (defined(_MSC_VER) && (_MSC_VER >= 1900)) 37 | # define SIGNALS_CPP_HAVE_VARIADIC_TEMPLATES 38 | #endif 39 | 40 | namespace signals { } 41 | namespace sigs = signals; 42 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/Kosta-Github/signals-cpp/signals-cpp/signals.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2013 by Konstantin (Kosta) Baumann & Autodesk Inc. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | #pragma once 25 | 26 | #include "config.hpp" 27 | #include "connection.hpp" 28 | #include "connections.hpp" 29 | #include "signal.hpp" 30 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/NoAvailableAlias/nano-signal-slot/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2019 ApEk, NoAvailableAlias, Nano-signal-slot Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/copperspice/cs_signal/LICENSE: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | 8 | 2. Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 13 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 16 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 22 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/copperspice/cs_signal/README.md: -------------------------------------------------------------------------------- 1 | ## CsSignal 2 | 3 | ### Introduction 4 | 5 | CsSignal is a library for thread aware Signal/Slot delivery. This library does not depend upon 6 | CopperSpice or any other libraries. 7 | 8 | One of the major benefits of CsSignal is how the library delivers signals in a multithreaded 9 | application. Signals can be delivered using a queued connection or a blocking queued connection. 10 | 11 | In the CsSignal library signals and slots are both methods whereas in many other signal/slot 12 | libraries each signal is a separate object. 13 | 14 | 15 | ### System Requirements 16 | 17 | To use CsSignal you will need a C++14 compiler and a C++14 standard library. 18 | 19 | Currently uses the Autotools build system for building and running the unit test suite. The library has been tested with 20 | clang sanitizer and a major code review. 21 | 22 | 23 | ### Documentation 24 | 25 | Class level documentation for CsSignal is available on the CopperSpice website: 26 | 27 | www.copperspice.com/docs/cs_signal/index.html 28 | 29 | 30 | ### Presentations 31 | 32 | Multiple videos discussing Signals and Slots can be found on the following pages: 33 | 34 | www.youtube.com/copperspice
35 | www.copperspice.com/presentations.html 36 | 37 | 38 | ### Authors / Contributors 39 | 40 | * **Ansel Sermersheim** 41 | * **Barbara Geller** 42 | 43 | 44 | ### License 45 | 46 | This library is released under the BSD 2-clause license. For more information refer to the LICENSE file provided with this 47 | project. 48 | 49 | 50 | ### References 51 | 52 | * Website: www.copperspice.com 53 | * Email: info@copperspice.com 54 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/copperspice/cs_signal/src/cs_macro.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * 3 | * Copyright (c) 2015-2018 Barbara Geller 4 | * Copyright (c) 2015-2018 Ansel Sermersheim 5 | * All rights reserved. 6 | * 7 | * This file is part of libCsSignal 8 | * 9 | * libCsSignal is free software, released under the BSD 2-Clause license. 10 | * For license details refer to LICENSE provided with this project. 11 | * 12 | ***********************************************************************/ 13 | 14 | #ifndef LIB_CS_MACRO_H 15 | #define LIB_CS_MACRO_H 16 | 17 | #ifdef _WIN32 18 | 19 | #ifdef BUILDING_LIB_CS_SIGNAL 20 | # define LIB_SIG_EXPORT __declspec(dllexport) 21 | #else 22 | # define LIB_SIG_EXPORT __declspec(dllimport) 23 | #endif 24 | 25 | #else 26 | # define LIB_SIG_EXPORT 27 | 28 | #endif 29 | 30 | 31 | // ** signal macros 32 | #define SIGNAL_1(...) \ 33 | __VA_ARGS__ { 34 | // do not remove the "{", this is required for part two of the macro 35 | 36 | #define SIGNAL_2(signalName, ...) \ 37 | activate(*this, &std::remove_reference::type::signalName, ##__VA_ARGS__); \ 38 | } 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/cpp11nullptr/lsignal/LICENCE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015 Ievgen Polyvanyi 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/dacap/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016-2018 David Capello 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/dacap/README.md: -------------------------------------------------------------------------------- 1 | Observable Library 2 | ================== 3 | 4 | *Copyright (C) 2016-2018 David Capello* 5 | 6 | [![Build Status](https://travis-ci.org/dacap/observable.svg)](https://travis-ci.org/dacap/observable) 7 | [![Build status](https://ci.appveyor.com/api/projects/status/jcur6dbi1vw6hrbw?svg=true)](https://ci.appveyor.com/project/dacap/observable) 8 | [![MIT Licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt) 9 | 10 | Library to use the observer pattern in C++11 programs with 11 | observable/observer classes or signals/slots. 12 | 13 | Features 14 | -------- 15 | 16 | * Generate an observable notification/signal from multiple threads 17 | * Add/remove observers/slots from multiple threads 18 | * Erase/disconnect an observer/slot from the same observable notification/signal 19 | * Reconnect an observer in the same notification 20 | 21 | Observable 22 | ---------- 23 | 24 | An observable `Widget`: 25 | 26 | ```cpp 27 | #include "obs.h" 28 | 29 | class WidgetObserver { 30 | public: 31 | virtual ~WidgetObserver() = 0; 32 | virtual void onClick() { } 33 | }; 34 | 35 | class Widget : public obs::observable { 36 | public: 37 | void processClick() { 38 | notify_observers(&WidgetObserver::onClick); 39 | } 40 | }; 41 | ``` 42 | 43 | An example 44 | 45 | ```cpp 46 | #include "obs.h" 47 | 48 | class ObserveClick : public WidgetObserver { 49 | public: 50 | void onClick() override { 51 | // Do something... 52 | } 53 | }; 54 | 55 | ... 56 | ObserveClick observer; 57 | Widget button; 58 | button.add_observer(&observer); 59 | ``` 60 | 61 | Signal 62 | ------ 63 | 64 | ```cpp 65 | #include "obs.h" 66 | 67 | int main() { 68 | obs::signal sig; 69 | sig.connect([](int x, int y){ ... }); 70 | sig(1, 2); // Generate signal 71 | } 72 | ``` 73 | 74 | Tested Compilers 75 | ---------------- 76 | 77 | * Visual Studio 2015 78 | * Xcode 7.3.1 (`-std=c++11`) 79 | * GCC 4.8.4 (`-std=c++11`) 80 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/dacap/obs/dacap_connection.cpp: -------------------------------------------------------------------------------- 1 | // Observable Library 2 | // Copyright (c) 2016 David Capello 3 | // 4 | // This file is released under the terms of the MIT license. 5 | // Read LICENSE.txt for more information. 6 | 7 | #include "dacap_connection.h" 8 | #include "dacap_signal.h" 9 | 10 | namespace obs { 11 | 12 | void connection::disconnect() { 13 | if (!m_slot) 14 | return; 15 | 16 | assert(m_signal); 17 | if (m_signal) 18 | m_signal->disconnect_slot(m_slot); 19 | 20 | delete m_slot; 21 | m_slot = nullptr; 22 | } 23 | 24 | } // namespace obs 25 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/dacap/obs/dacap_connection.h: -------------------------------------------------------------------------------- 1 | // Observable Library 2 | // Copyright (c) 2016 David Capello 3 | // 4 | // This file is released under the terms of the MIT license. 5 | // Read LICENSE.txt for more information. 6 | 7 | #ifndef OBS_CONNETION_H_INCLUDED 8 | #define OBS_CONNETION_H_INCLUDED 9 | #pragma once 10 | 11 | namespace obs { 12 | 13 | class signal_base; 14 | class slot_base; 15 | 16 | class connection { 17 | public: 18 | connection() : m_signal(nullptr), 19 | m_slot(nullptr) { 20 | } 21 | 22 | connection(signal_base* sig, 23 | slot_base* slot) : 24 | m_signal(sig), 25 | m_slot(slot) { 26 | } 27 | 28 | void disconnect(); 29 | 30 | operator bool() { 31 | return (m_slot != nullptr); 32 | } 33 | 34 | private: 35 | signal_base* m_signal; 36 | slot_base* m_slot; 37 | }; 38 | 39 | class scoped_connection { 40 | public: 41 | scoped_connection() { 42 | } 43 | 44 | scoped_connection(const connection& conn) : m_conn(conn) { 45 | } 46 | 47 | scoped_connection& operator=(const connection& conn) { 48 | m_conn.disconnect(); 49 | m_conn = conn; 50 | return *this; 51 | } 52 | 53 | ~scoped_connection() { 54 | m_conn.disconnect(); 55 | } 56 | 57 | private: 58 | connection m_conn; 59 | }; 60 | 61 | } // namespace obs 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/dacap/obs/observable.h: -------------------------------------------------------------------------------- 1 | // Observable Library 2 | // Copyright (c) 2016 David Capello 3 | // 4 | // This file is released under the terms of the MIT license. 5 | // Read LICENSE.txt for more information. 6 | 7 | #ifndef OBS_OBSERVABLE_H_INCLUDED 8 | #define OBS_OBSERVABLE_H_INCLUDED 9 | #pragma once 10 | 11 | #include "observers.h" 12 | 13 | namespace obs { 14 | 15 | template 16 | class observable { 17 | public: 18 | 19 | void add_observer(Observer* observer) { 20 | m_observers.add_observer(observer); 21 | } 22 | 23 | void remove_observer(Observer* observer) { 24 | m_observers.remove_observer(observer); 25 | } 26 | 27 | void notify_observers(void (Observer::*method)()) { 28 | m_observers.notify_observers(method); 29 | } 30 | 31 | template 32 | void notify_observers(void (Observer::*method)(Args...), Args ...args) { 33 | m_observers.template notify_observers(method, std::forward(args)...); 34 | } 35 | 36 | private: 37 | observers m_observers; 38 | }; 39 | 40 | } // namespace obs 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/dacap/obs/observers.h: -------------------------------------------------------------------------------- 1 | // Observable Library 2 | // Copyright (c) 2016 David Capello 3 | // 4 | // This file is released under the terms of the MIT license. 5 | // Read LICENSE.txt for more information. 6 | 7 | #ifndef OBS_OBSERVERS_H_INCLUDED 8 | #define OBS_OBSERVERS_H_INCLUDED 9 | #pragma once 10 | 11 | #include "safe_list.h" 12 | 13 | namespace obs { 14 | 15 | template 16 | class observers { 17 | public: 18 | typedef T observer_type; 19 | typedef safe_list list_type; 20 | typedef typename list_type::iterator iterator; 21 | 22 | bool empty() const { return m_observers.empty(); } 23 | std::size_t size() const { return m_observers.size(); } 24 | 25 | void add_observer(observer_type* observer) { 26 | m_observers.push_back(observer); 27 | } 28 | 29 | void remove_observer(observer_type* observer) { 30 | m_observers.erase(observer); 31 | } 32 | 33 | template 34 | void notify_observers(void (observer_type::*method)(Args...), Args ...args) { 35 | for (auto observer : m_observers) { 36 | if (observer) 37 | (observer->*method)(std::forward(args)...); 38 | } 39 | } 40 | 41 | private: 42 | list_type m_observers; 43 | }; 44 | 45 | } // namespace obs 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/dacap/obs/slot.h: -------------------------------------------------------------------------------- 1 | // Observable Library 2 | // Copyright (c) 2016 David Capello 3 | // 4 | // This file is released under the terms of the MIT license. 5 | // Read LICENSE.txt for more information. 6 | 7 | #ifndef OBS_SLOT_H_INCLUDED 8 | #define OBS_SLOT_H_INCLUDED 9 | #pragma once 10 | 11 | #include 12 | #include 13 | 14 | namespace obs { 15 | 16 | class slot_base { 17 | public: 18 | slot_base() { } 19 | virtual ~slot_base() { } 20 | 21 | // Disable copy 22 | slot_base(const slot_base&) = delete; 23 | slot_base& operator=(const slot_base&) = delete; 24 | }; 25 | 26 | // Generic slot 27 | template 28 | class slot { }; 29 | 30 | template 31 | class slot : public slot_base { 32 | public: 33 | template 34 | slot(F&& f) : f(std::forward(f)) { } 35 | slot(const slot& s) { (void)s; } 36 | virtual ~slot() { } 37 | 38 | template 39 | R operator()(Args2&&...args) { 40 | assert(f); 41 | return f(std::forward(args)...); 42 | } 43 | 44 | private: 45 | std::function f; 46 | }; 47 | 48 | template 49 | class slot : public slot_base { 50 | public: 51 | template 52 | slot(F&& f) : f(std::forward(f)) { } 53 | slot(const slot& s) { (void)s; } 54 | virtual ~slot() { } 55 | 56 | template 57 | void operator()(Args2&&...args) { 58 | assert(f); 59 | f(std::forward(args)...); 60 | } 61 | 62 | private: 63 | std::function f; 64 | }; 65 | 66 | } // namespace obs 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/fr00b0/nod/tools/linux_x64/premake5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheWisp/signals/7ff59d1bc6387337ef34856a450be34cfa2c9e51/signal-slot-benchmarks/benchmark/lib/fr00b0/nod/tools/linux_x64/premake5 -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/i42output/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-present, Leigh Johnston. 2 | 3 | All Rights Reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Leigh Johnston nor the names of any 17 | other contributors to this software may be used to endorse or 18 | promote products derived from this software without specific prior 19 | written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 22 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 23 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/i42output/README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | "neolib" is a cross-platform C++ utility library. 3 | 4 | # Dependencies 5 | * Boost 6 | * OpenSSL 7 | * zlib 8 | 9 | # Features 10 | * vecarray container, see http://i42.co.uk/stuff/vecarray.htm 11 | * segmented_array container, see http://i42.co.uk/stuff/segmented_array.htm 12 | * NoFussXML, see http://i42.co.uk/stuff/NoFussXML.htm 13 | * neosigslot, see http://i42.co.uk/stuff/neosigslot.htm 14 | * packet stream network library (based on Boost.Asio) 15 | * plugin framework; uses interfaces (vtables) similar to Microsoft's COM with support for containers/iterators. 16 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/i42output/src/win32_message_queue.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/neolib/neolib.hpp" 2 | #include "../include/neolib/win32_message_queue.hpp" 3 | 4 | namespace neolib 5 | { 6 | std::map win32_message_queue::sTimerMap; 7 | 8 | win32_message_queue::win32_message_queue(async_task& aIoTask, std::function aIdleFunction, bool aCreateTimer) : 9 | iIoTask(aIoTask), 10 | iIdleFunction(aIdleFunction) 11 | { 12 | if (aCreateTimer) 13 | { 14 | iTimer = ::SetTimer(NULL, 0, 10, &win32_message_queue::timer_proc); 15 | sTimerMap[iTimer] = this; 16 | } 17 | push_context(); 18 | } 19 | 20 | win32_message_queue::~win32_message_queue() 21 | { 22 | for (auto& t : sTimerMap) 23 | ::KillTimer(NULL, t.first); 24 | } 25 | 26 | void win32_message_queue::push_context() 27 | { 28 | iInIdle.push_back(false); 29 | } 30 | 31 | void win32_message_queue::pop_context() 32 | { 33 | iInIdle.pop_back(); 34 | } 35 | 36 | bool win32_message_queue::have_message() const 37 | { 38 | MSG msg; 39 | return ::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) != 0; 40 | } 41 | 42 | int win32_message_queue::get_message() const 43 | { 44 | MSG msg; 45 | int result = ::GetMessage(&msg, NULL, 0, 0); 46 | if (result) 47 | { 48 | if (result != -1) 49 | { 50 | ::TranslateMessage(&msg); 51 | ::DispatchMessage(&msg); 52 | } 53 | } 54 | return result; 55 | } 56 | 57 | void win32_message_queue::bump() 58 | { 59 | ::PostMessage(NULL, WM_NULL, 0, 0); 60 | } 61 | 62 | void win32_message_queue::idle() 63 | { 64 | if (!iInIdle.back() && iIdleFunction) 65 | { 66 | iInIdle.back() = true; 67 | iIdleFunction(); 68 | iInIdle.back() = false; 69 | } 70 | } 71 | 72 | void CALLBACK win32_message_queue::timer_proc(HWND, UINT, UINT_PTR aId, DWORD) 73 | { 74 | win32_message_queue& instance = *sTimerMap[aId]; 75 | instance.idle(); 76 | } 77 | } -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | file(GLOB_RECURSE SOURCE_FILES *.cpp) 3 | add_library(iscool_signals STATIC ${SOURCE_FILES}) 4 | target_include_directories(iscool_signals PUBLIC include) 5 | set_property(TARGET iscool_signals PROPERTY CXX_STANDARD 11) 6 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/copy.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_COPY_H 17 | #define ISCOOL_COPY_H 18 | 19 | namespace iscool 20 | { 21 | template< typename T > 22 | T copy( const T& value ); 23 | } 24 | 25 | #include "iscool/detail/copy.tpp" 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/detail/copy.tpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_COPY_TPP 17 | #define ISCOOL_COPY_TPP 18 | 19 | template< typename T > 20 | T iscool::copy( const T& value ) 21 | { 22 | return value; 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/detail/optional_or_else.tpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_OPTIONAL_OR_ELSE_TPP 17 | #define ISCOOL_OPTIONAL_OR_ELSE_TPP 18 | 19 | template< typename T > 20 | T iscool::optional_or_else 21 | ( const optional< T >& optional, const T& fallback ) 22 | { 23 | return optional ? *optional : fallback; 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/digits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_CORE_DIGITS_H 17 | #define ISCOOL_CORE_DIGITS_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | std::uint8_t digits( std::int64_t value ); 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/enum_equals.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_ENUM_EQUALS_H 17 | #define ISCOOL_ENUM_EQUALS_H 18 | 19 | namespace iscool 20 | { 21 | template< typename Enum > 22 | bool enum_equals( int lhs, Enum rhs ); 23 | 24 | template< typename Enum > 25 | bool enum_equals( Enum lhs, int rhs ); 26 | } 27 | 28 | #include "iscool/enum_equals.tpp" 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/enum_equals.tpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_ENUM_EQUALS_TPP 17 | #define ISCOOL_ENUM_EQUALS_TPP 18 | 19 | template< typename Enum > 20 | bool iscool::enum_equals( int lhs, Enum rhs ) 21 | { 22 | return lhs == static_cast< int >( rhs ); 23 | } 24 | 25 | template< typename Enum > 26 | bool iscool::enum_equals( Enum lhs, int rhs ) 27 | { 28 | return enum_equals( rhs, lhs ); 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/none.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_NONE_H 17 | #define ISCOOL_NONE_H 18 | 19 | #include "iscool/none_t.h" 20 | 21 | namespace iscool 22 | { 23 | extern const none_t none; 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/none_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_NONE_T_H 17 | #define ISCOOL_NONE_T_H 18 | 19 | namespace iscool 20 | { 21 | struct none_t 22 | { 23 | struct init_tag{}; 24 | explicit none_t( init_tag ) { }; 25 | }; 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/optional_or_else.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_OPTIONAL_OR_ELSE_H 17 | #define ISCOOL_OPTIONAL_OR_ELSE_H 18 | 19 | #include "iscool/optional.h" 20 | 21 | namespace iscool 22 | { 23 | template< typename T > 24 | T optional_or_else 25 | ( const optional< T >& optional, const T& fallback ); 26 | } 27 | 28 | #include "iscool/detail/optional_or_else.tpp" 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/detail/output_function.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_PROFILE_DETAIL_OUTPUT_FUNCTION_H 17 | #define ISCOOL_PROFILE_DETAIL_OUTPUT_FUNCTION_H 18 | 19 | #include "iscool/profile/output_delegate.h" 20 | 21 | namespace iscool 22 | { 23 | namespace profile 24 | { 25 | namespace detail 26 | { 27 | extern output_delegate output_function; 28 | } 29 | } 30 | } 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/output_delegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_PROFILE_PRINT_DELEGATE_H 17 | #define ISCOOL_PROFILE_PRINT_DELEGATE_H 18 | 19 | #include 20 | 21 | #include "iscool/profile/profile_data.h" 22 | 23 | namespace iscool 24 | { 25 | namespace profile 26 | { 27 | typedef boost::function< void( profile_data ) > output_delegate; 28 | } 29 | } 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/profile_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_PROFILE_PROFILE_DATA_H 17 | #define ISCOOL_PROFILE_PROFILE_DATA_H 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace iscool 24 | { 25 | namespace profile 26 | { 27 | struct profile_data 28 | { 29 | profile_data(); 30 | profile_data 31 | ( const std::string& new_name, 32 | const std::chrono::milliseconds& new_start, 33 | const std::chrono::milliseconds& new_end, 34 | const std::vector< std::string >& new_tags ); 35 | 36 | std::string name; 37 | std::chrono::milliseconds start; 38 | std::chrono::milliseconds end; 39 | std::vector< std::string > tags; 40 | }; 41 | } 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/profiler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_PROFILE_PROFILER_H 17 | #define ISCOOL_PROFILE_PROFILER_H 18 | 19 | #include "iscool/optional.h" 20 | #include 21 | #include 22 | #include 23 | 24 | namespace iscool 25 | { 26 | namespace profile 27 | { 28 | class profiler 29 | { 30 | public: 31 | explicit profiler( const std::string& name ); 32 | 33 | void append_tag( const std::string& tag ); 34 | void clear_tags(); 35 | 36 | bool started() const; 37 | 38 | void start(); 39 | void end(); 40 | 41 | private: 42 | const std::string _name; 43 | std::vector< std::string > _tags; 44 | iscool::optional< std::chrono::milliseconds > _start; 45 | }; 46 | } 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/scoped_profiler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_PROFILE_SCOPED_PROFILER_H 17 | #define ISCOOL_PROFILE_SCOPED_PROFILER_H 18 | 19 | #include "iscool/profile/profiler.h" 20 | 21 | namespace iscool 22 | { 23 | namespace profile 24 | { 25 | class scoped_profiler 26 | { 27 | public: 28 | explicit scoped_profiler( const std::string& name ); 29 | ~scoped_profiler(); 30 | 31 | void append_tag( const std::string& tag ); 32 | private: 33 | profiler _profiler; 34 | }; 35 | } 36 | } 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/setup.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_PROFILE_SETUP_H 17 | #define ISCOOL_PROFILE_SETUP_H 18 | 19 | #include "iscool/profile/output_delegate.h" 20 | 21 | namespace iscool 22 | { 23 | namespace profile 24 | { 25 | void initialize( output_delegate delegate ); 26 | void finalize(); 27 | } 28 | } 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/connection.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_CONNECTION_H 17 | #define ISCOOL_SIGNALS_CONNECTION_H 18 | 19 | #include "iscool/signals/detail/slot.h" 20 | 21 | #include 22 | 23 | namespace iscool 24 | { 25 | namespace signals 26 | { 27 | class connection 28 | { 29 | public: 30 | connection(); 31 | explicit connection( const std::weak_ptr< detail::slot >& slot ); 32 | connection( const connection& that ); 33 | connection( connection&& that ); 34 | ~connection(); 35 | 36 | connection& operator=( const connection& that ); 37 | connection& operator=( connection&& that ); 38 | 39 | bool operator==( const connection& that ) const; 40 | bool operator!=( const connection& that ) const; 41 | 42 | bool connected() const; 43 | void disconnect() const; 44 | 45 | private: 46 | std::weak_ptr< detail::slot > _slot; 47 | }; 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/detail/no_tuple_is_masked.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_DETAIL_NO_TUPLE_IS_MASKED_H 17 | #define ISCOOL_SIGNALS_DETAIL_NO_TUPLE_IS_MASKED_H 18 | 19 | #include "iscool/signals/detail/any_tuple_is_masked.h" 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | namespace detail 26 | { 27 | template< typename... Tuple > 28 | struct no_tuple_is_masked 29 | { 30 | enum 31 | { 32 | value = 33 | !any_tuple_is_masked< std::tuple<>, Tuple... >::value 34 | }; 35 | }; 36 | } 37 | } 38 | } 39 | 40 | #include "iscool/signals/detail/no_tuple_is_masked.tests.h" 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/detail/no_tuple_is_masked.tests.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_DETAIL_NO_TUPLE_IS_MASKED_TESTS_H 17 | #define ISCOOL_SIGNALS_DETAIL_NO_TUPLE_IS_MASKED_TESTS_H 18 | 19 | namespace iscool 20 | { 21 | namespace signals 22 | { 23 | namespace detail 24 | { 25 | static_assert 26 | ( no_tuple_is_masked 27 | < 28 | std::tuple< int, float, bool >, 29 | std::tuple< float, bool, double >, 30 | std::tuple< int, float, int >, 31 | std::tuple< bool, int, double > 32 | >::value, 33 | "Failed to see that no tuple is masked." ); 34 | 35 | static_assert 36 | ( !no_tuple_is_masked 37 | < 38 | std::tuple< int, float, bool >, 39 | std::tuple< float, bool, double >, 40 | std::tuple< int, float, double >, 41 | std::tuple< bool, int, double > 42 | >::value, 43 | "Failed to find a masked tuple." ); 44 | } 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/detail/resolve_identifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_DETAIL_RESOLVE_IDENTIFIER_H 17 | #define ISCOOL_SIGNALS_DETAIL_RESOLVE_IDENTIFIER_H 18 | 19 | namespace iscool 20 | { 21 | namespace signals 22 | { 23 | namespace detail 24 | { 25 | template< typename T > 26 | struct resolve_identifier 27 | { 28 | static const char* name() { return T::name(); } 29 | }; 30 | 31 | template<> 32 | struct resolve_identifier< void > 33 | { 34 | static const char* name() { return "unnamed_signal"; } 35 | }; 36 | } 37 | } 38 | } 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/detail/signal_collection_from_tuple.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_DETAIL_SIGNAL_COLLECTION_FROM_TUPLE_H 17 | #define ISCOOL_SIGNALS_DETAIL_SIGNAL_COLLECTION_FROM_TUPLE_H 18 | 19 | #include "iscool/signals/signal_from_tuple_arguments.h" 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | namespace detail 26 | { 27 | template< typename... Tuple > 28 | class signal_collection_from_tuple; 29 | 30 | template<> 31 | class signal_collection_from_tuple<> 32 | { 33 | 34 | }; 35 | 36 | template< typename HeadTuple, typename... OtherTuples > 37 | class signal_collection_from_tuple< HeadTuple, OtherTuples... >: 38 | public signal_collection_from_tuple< OtherTuples... > 39 | { 40 | public: 41 | typedef 42 | typename signal_from_tuple_arguments< HeadTuple >::type 43 | signal_type; 44 | 45 | signal_type signal_instance; 46 | }; 47 | } 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/detail/slot.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_DETAIL_SLOT_H 17 | #define ISCOOL_SIGNALS_DETAIL_SLOT_H 18 | 19 | #include 20 | #include 21 | 22 | namespace iscool 23 | { 24 | namespace signals 25 | { 26 | namespace detail 27 | { 28 | class slot 29 | { 30 | public: 31 | slot(); 32 | ~slot(); 33 | 34 | bool connected() const; 35 | void disconnect(); 36 | 37 | private: 38 | bool _connected; 39 | }; 40 | } 41 | } 42 | } 43 | 44 | extern template 45 | class std::shared_ptr< iscool::signals::detail::slot >; 46 | 47 | extern template 48 | class std::vector< std::shared_ptr< iscool::signals::detail::slot > >; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/detail/statistics_function.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_STATISTICS_FUNCTION_H 17 | #define ISCOOL_SIGNALS_STATISTICS_FUNCTION_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | class statistics_data; 26 | 27 | namespace detail 28 | { 29 | extern 30 | boost::function< void( const statistics_data& ) > 31 | statistics_function; 32 | } 33 | } 34 | } 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/get.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_GET_H 17 | #define ISCOOL_SIGNALS_GET_H 18 | 19 | #include "iscool/signals/signal_collection.h" 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | template< typename SearchedType, typename... SignalArgument > 26 | signal< void ( SearchedType ) >& 27 | get( signal_collection< SignalArgument... >& collection ); 28 | 29 | template< typename SearchedType, typename... SignalArgument > 30 | const signal< void ( SearchedType ) >& 31 | get( const signal_collection< SignalArgument... >& collection ); 32 | } 33 | } 34 | 35 | #include "iscool/signals/detail/get.tpp" 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/get_from_tuple_element.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_GET_FROM_TUPLE_ELEMENT_H 17 | #define ISCOOL_SIGNALS_GET_FROM_TUPLE_ELEMENT_H 18 | 19 | #include "iscool/signals/find_signal_type_from_tuple_element.h" 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | template< typename SearchedType, std::size_t I, typename... Tuple > 26 | typename 27 | find_signal_type_from_tuple_element 28 | < 29 | SearchedType, 30 | I, 31 | signal_collection_from_tuple< Tuple... > 32 | >::type& 33 | get_from_tuple_element 34 | ( signal_collection_from_tuple< Tuple... >& collection ); 35 | 36 | template< typename SearchedType, std::size_t I, typename... Tuple > 37 | const typename 38 | find_signal_type_from_tuple_element 39 | < 40 | SearchedType, 41 | I, 42 | signal_collection_from_tuple< Tuple... > 43 | >::type& 44 | get_from_tuple_element 45 | ( const signal_collection_from_tuple< Tuple... >& collection ); 46 | } 47 | } 48 | 49 | #include "iscool/signals/detail/get_from_tuple_element.tpp" 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/implement_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_IMPLEMENT_SIGNAL_H 17 | #define ISCOOL_SIGNALS_IMPLEMENT_SIGNAL_H 18 | 19 | #include "iscool/signals/declare_signal.h" 20 | #include "iscool/signals/signal.impl.tpp" 21 | 22 | #include 23 | 24 | #define DETAIL_IMPLEMENT_SIGNAL( SCOPE, NAME, MEMBER, TYPENAME ) \ 25 | ::iscool::signals::connection \ 26 | BOOST_PP_REMOVE_PARENS( SCOPE )::DETAIL_SIGNAL_CONNECT_FUNCTION_NAME \ 27 | ( NAME ) \ 28 | ( const DETAIL_SIGNAL_FUNCTION_TYPE_NAME( NAME )& function ) const \ 29 | { \ 30 | return MEMBER.connect( function ); \ 31 | } 32 | 33 | #define IMPLEMENT_SIGNAL( SCOPE, NAME, MEMBER ) \ 34 | DETAIL_IMPLEMENT_SIGNAL( SCOPE, NAME, MEMBER, ) 35 | 36 | #define IMPLEMENT_SIGNAL_IN_TEMPLATE( SCOPE, NAME, MEMBER ) \ 37 | DETAIL_IMPLEMENT_SIGNAL( SCOPE, NAME, MEMBER, typename ) 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/one_shot_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_ONE_SHOT_SIGNAL_H 17 | #define ISCOOL_SIGNALS_ONE_SHOT_SIGNAL_H 18 | 19 | #include "iscool/signals/signal.h" 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | template< typename Signature > 26 | class one_shot_signal 27 | { 28 | public: 29 | typedef signal< Signature > signal_type; 30 | typedef typename signal_type::result_type result_type; 31 | 32 | public: 33 | connection connect( const boost::function< Signature >& f ); 34 | 35 | template< typename... Arg > 36 | result_type operator()( Arg... arg ); 37 | 38 | void disconnect_all_slots(); 39 | bool empty() const; 40 | 41 | private: 42 | signal_type _impl; 43 | }; 44 | } 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/one_shot_signal.impl.tpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_ONE_SHOT_SIGNAL_IMPL_TPP 17 | #define ISCOOL_SIGNALS_ONE_SHOT_SIGNAL_IMPL_TPP 18 | 19 | #include "iscool/signals/signal.impl.tpp" 20 | 21 | template< typename Signature > 22 | iscool::signals::connection 23 | iscool::signals::one_shot_signal< Signature >::connect 24 | ( const boost::function< Signature >& f ) 25 | { 26 | return _impl.connect( f ); 27 | } 28 | 29 | template< typename Signature > 30 | template< typename... Arg > 31 | typename iscool::signals::one_shot_signal< Signature >::result_type 32 | iscool::signals::one_shot_signal< Signature >::operator()( Arg... arg ) 33 | { 34 | signal_type s; 35 | s.swap( _impl ); 36 | return s( arg... ); 37 | } 38 | 39 | template< typename Signature > 40 | void iscool::signals::one_shot_signal< Signature >::disconnect_all_slots() 41 | { 42 | _impl.disconnect_all_slots(); 43 | } 44 | 45 | template< typename Signature > 46 | bool iscool::signals::one_shot_signal< Signature >::empty() const 47 | { 48 | return _impl.empty(); 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/one_shot_signal_pool.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_SIGNAL_POOL_H 17 | #define ISCOOL_SIGNALS_SIGNAL_POOL_H 18 | 19 | #include "iscool/memory/dynamic_pool.h" 20 | #include "iscool/memory/pool_signal_traits.h" 21 | 22 | namespace iscool 23 | { 24 | namespace signals 25 | { 26 | template< typename T > 27 | class one_shot_signal_pool 28 | { 29 | 30 | public: 31 | typedef 32 | iscool::memory::dynamic_pool 33 | < 34 | iscool::signals::signal< T >, 35 | iscool::memory::pool_signal_traits 36 | < 37 | iscool::signals::signal< T > 38 | > 39 | > 40 | pool_type; 41 | 42 | 43 | public: 44 | explicit one_shot_signal_pool( std::size_t pool_size ); 45 | ~one_shot_signal_pool(); 46 | 47 | typename pool_type::slot pick_available(); 48 | 49 | template< typename... Args > 50 | void trigger( std::size_t id, Args&&... args ); 51 | 52 | void clear(); 53 | private: 54 | pool_type _pool; 55 | 56 | }; 57 | } 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/one_shot_signal_pool.impl.tpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_SIGNAL_POOL_IMPL_TPP 17 | #define ISCOOL_SIGNALS_SIGNAL_POOL_IMPL_TPP 18 | 19 | template< typename T > 20 | iscool::signals::one_shot_signal_pool< T >::one_shot_signal_pool 21 | ( std::size_t pool_size ) 22 | : _pool( pool_size ) 23 | { 24 | 25 | } 26 | 27 | template< typename T > 28 | iscool::signals::one_shot_signal_pool< T >::~one_shot_signal_pool() = default; 29 | 30 | template< typename T > 31 | typename iscool::signals::one_shot_signal_pool< T >::pool_type::slot 32 | iscool::signals::one_shot_signal_pool< T >::pick_available() 33 | { 34 | return _pool.pick_available(); 35 | } 36 | 37 | template< typename T > 38 | template< typename... Args > 39 | void iscool::signals::one_shot_signal_pool< T >::trigger 40 | ( std::size_t id, Args&&... args ) 41 | { 42 | _pool.get( id )( std::forward< Args >( args )... ); 43 | _pool.release( id ); 44 | } 45 | 46 | template< typename T > 47 | void iscool::signals::one_shot_signal_pool< T >::clear() 48 | { 49 | _pool.clear(); 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/relay.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_RELAY_H 17 | #define ISCOOL_SIGNALS_RELAY_H 18 | 19 | #include "iscool/signals/signal.h" 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | template< typename Signature > 26 | typename signal< Signature >::slot_function_type 27 | relay( const signal< Signature >& s ); 28 | } 29 | } 30 | 31 | #include "iscool/signals/detail/relay.tpp" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/shared_connection.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_SHARED_CONNECTION_H 17 | #define ISCOOL_SIGNALS_SHARED_CONNECTION_H 18 | 19 | #include "iscool/signals/connection.h" 20 | #include "iscool/signals/scoped_connection.h" 21 | 22 | namespace iscool 23 | { 24 | namespace signals 25 | { 26 | class shared_connection 27 | { 28 | private: 29 | typedef std::shared_ptr< scoped_connection > connection_pointer; 30 | 31 | public: 32 | shared_connection(); 33 | shared_connection( const connection& c ); 34 | ~shared_connection(); 35 | 36 | bool connected() const; 37 | void disconnect(); 38 | 39 | bool operator==( const shared_connection& that ) const; 40 | bool operator!=( const shared_connection& that ) const; 41 | 42 | private: 43 | connection_pointer _connection; 44 | }; 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/shared_connection_set.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_SHARED_CONNECTION_SET_H 17 | #define ISCOOL_SIGNALS_SHARED_CONNECTION_SET_H 18 | 19 | #include "iscool/signals/shared_connection.h" 20 | 21 | #include 22 | 23 | namespace iscool 24 | { 25 | namespace signals 26 | { 27 | class shared_connection_set 28 | { 29 | private: 30 | typedef std::vector< shared_connection > connection_collection; 31 | 32 | public: 33 | shared_connection_set(); 34 | ~shared_connection_set(); 35 | 36 | void insert( shared_connection c ); 37 | void insert( shared_connection_set that ); 38 | 39 | void clear(); 40 | bool empty() const; 41 | 42 | private: 43 | connection_collection _connections; 44 | }; 45 | } 46 | } 47 | 48 | extern template class std::vector< iscool::signals::shared_connection >; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/signal_collection.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_SIGNAL_COLLECTION_H 17 | #define ISCOOL_SIGNALS_SIGNAL_COLLECTION_H 18 | 19 | #include "iscool/signals/signal.h" 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | template< typename... SignalArgument > 26 | class signal_collection; 27 | 28 | template<> 29 | class signal_collection<> 30 | { 31 | 32 | }; 33 | 34 | template< typename SignalArgument, typename... OtherArguments > 35 | class signal_collection< SignalArgument, OtherArguments... >: 36 | public signal_collection< OtherArguments... > 37 | { 38 | public: 39 | signal< void ( SignalArgument ) > signal_instance; 40 | }; 41 | } 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/signal_collection_from_tuple.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_SIGNAL_COLLECTION_FROM_TUPLE_H 17 | #define ISCOOL_SIGNALS_SIGNAL_COLLECTION_FROM_TUPLE_H 18 | 19 | #include "iscool/signals/detail/no_tuple_is_masked.h" 20 | #include "iscool/signals/detail/signal_collection_from_tuple.h" 21 | 22 | namespace iscool 23 | { 24 | namespace signals 25 | { 26 | template< typename... Tuple > 27 | class signal_collection_from_tuple: 28 | public detail::signal_collection_from_tuple< Tuple... > 29 | { 30 | static_assert 31 | ( detail::no_tuple_is_masked< Tuple... >::value, 32 | "Some tuples cannot be reached." ); 33 | }; 34 | } 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/signal_from_tuple_arguments.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_SIGNAL_FROM_TUPLE_ARGUMENTS_H 17 | #define ISCOOL_SIGNALS_SIGNAL_FROM_TUPLE_ARGUMENTS_H 18 | 19 | #include "iscool/signals/signal.h" 20 | 21 | #include 22 | 23 | namespace iscool 24 | { 25 | namespace signals 26 | { 27 | template< typename T > 28 | class signal_from_tuple_arguments; 29 | 30 | template< typename... Arg > 31 | class signal_from_tuple_arguments< std::tuple< Arg... > > 32 | { 33 | public: 34 | typedef signal< void( Arg... ) > type; 35 | }; 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/statistics_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_STATISTICS_DATA_H 17 | #define ISCOOL_SIGNALS_STATISTICS_DATA_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | class statistics_data 26 | { 27 | public: 28 | statistics_data 29 | ( const std::string& signal_identifier, std::size_t slot_count ); 30 | ~statistics_data(); 31 | 32 | public: 33 | std::string signal_identifier; 34 | std::size_t slot_count; 35 | }; 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/statistics_sink.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_STATISTICS_SINK_H 17 | #define ISCOOL_SIGNALS_STATISTICS_SINK_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | class statistics_data; 26 | 27 | void set_statistics_sink 28 | ( const boost::function< void( const statistics_data& ) >& sink ); 29 | void clear_statistics_sink(); 30 | } 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/signals/void_signal_function.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_SIGNALS_VOID_SIGNAL_FUNCTION_H 17 | #define ISCOOL_SIGNALS_VOID_SIGNAL_FUNCTION_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | namespace signals 24 | { 25 | typedef boost::function< void() > void_signal_function; 26 | } 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/time/backward_duration_to_unit_change.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_TIME_BACKWARD_DURATION_TO_UNIT_CHANGE_H 17 | #define ISCOOL_TIME_BACKWARD_DURATION_TO_UNIT_CHANGE_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | namespace time 24 | { 25 | template< class TargetDuration, class Rep, class Period > 26 | TargetDuration 27 | backward_duration_to_unit_change 28 | ( const std::chrono::duration< Rep, Period >& duration ); 29 | } 30 | } 31 | 32 | #include "iscool/time/detail/backward_duration_to_unit_change.tpp" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/time/days.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_TIME_DAYS_H 17 | #define ISCOOL_TIME_DAYS_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | namespace time 24 | { 25 | typedef std::chrono::duration 26 | < 27 | int, 28 | std::ratio_multiply 29 | < 30 | std::chrono::hours::period, 31 | std::ratio< 24 > 32 | >::type 33 | > 34 | days; 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/time/detail/now.tpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_TIME_DETAIL_NOW_TPP 17 | #define ISCOOL_TIME_DETAIL_NOW_TPP 18 | 19 | #include 20 | 21 | template 22 | Duration iscool::time::now() 23 | { 24 | return std::chrono::duration_cast< Duration > 25 | ( std::chrono::system_clock::now().time_since_epoch() ); 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/time/detail/round.tpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_TIME_ROUND_TPP 17 | #define ISCOOL_TIME_ROUND_TPP 18 | 19 | template 20 | TargetDuration 21 | iscool::time::round( std::chrono::duration< Rep, Period > duration ) 22 | { 23 | const TargetDuration floor 24 | ( std::chrono::duration_cast< TargetDuration >( duration ) ); 25 | const TargetDuration ceil( floor + TargetDuration( 1 ) ); 26 | 27 | const auto underestimation( duration - floor ); 28 | const auto overestimation( ceil - duration ); 29 | 30 | if ( underestimation == overestimation ) 31 | { 32 | if ( floor.count() % 2 == 1 ) 33 | return ceil; 34 | 35 | return floor; 36 | } 37 | else if ( underestimation < overestimation ) 38 | return floor; 39 | 40 | return ceil; 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/time/now.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_TIME_NOW_H 17 | #define ISCOOL_TIME_NOW_H 18 | 19 | namespace iscool 20 | { 21 | namespace time 22 | { 23 | template 24 | Duration now(); 25 | } 26 | } 27 | 28 | #include "iscool/time/detail/now.tpp" 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/time/round.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #ifndef ISCOOL_TIME_ROUND_H 17 | #define ISCOOL_TIME_ROUND_H 18 | 19 | #include 20 | 21 | namespace iscool 22 | { 23 | namespace time 24 | { 25 | template< class TargetDuration, class Rep, class Period > 26 | TargetDuration round( std::chrono::duration< Rep, Period > duration ); 27 | } 28 | } 29 | 30 | #include "iscool/time/detail/round.tpp" 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/digits.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/digits.h" 17 | 18 | #include 19 | 20 | std::uint8_t iscool::digits( std::int64_t value ) 21 | { 22 | std::uint8_t result( 1 ); 23 | 24 | if ( value < 0 ) 25 | { 26 | ++result; 27 | 28 | if ( value == std::numeric_limits< std::int64_t >::min() ) 29 | value = -( value + 1 ); 30 | else 31 | value = -value; 32 | } 33 | 34 | while ( value >= 10 ) 35 | { 36 | ++result; 37 | value /= 10; 38 | } 39 | 40 | return result; 41 | } 42 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/none.h" 17 | 18 | const iscool::none_t iscool::none( ( iscool::none_t::init_tag() ) ); 19 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/optional.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/optional.h" 17 | 18 | #include "iscool/optional.impl.tpp" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | template class iscool::optional< bool >; 25 | template class iscool::optional< char >; 26 | template class iscool::optional< unsigned char >; 27 | template class iscool::optional< int >; 28 | template class iscool::optional< unsigned int >; 29 | template class iscool::optional< long >; 30 | template class iscool::optional< unsigned long >; 31 | template class iscool::optional< long long >; 32 | template class iscool::optional< unsigned long long >; 33 | template class iscool::optional< float >; 34 | template class iscool::optional< double >; 35 | 36 | template class iscool::optional< std::chrono::milliseconds >; 37 | template class iscool::optional< std::chrono::seconds >; 38 | 39 | template class iscool::optional< std::string >; 40 | 41 | template class iscool::optional< std::vector< char > >; 42 | template class iscool::optional< std::vector< unsigned long > >; 43 | template class iscool::optional< std::vector< unsigned long long > >; 44 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/profile/detail/output_function.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/profile/detail/output_function.h" 17 | 18 | iscool::profile::output_delegate iscool::profile::detail::output_function; 19 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/profile/profile_data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/profile/profile_data.h" 17 | 18 | iscool::profile::profile_data::profile_data() 19 | : start( std::chrono::milliseconds( 0 ) ), 20 | end( std::chrono::milliseconds( 0 ) ) 21 | {} 22 | 23 | iscool::profile::profile_data::profile_data 24 | ( const std::string& new_name, const std::chrono::milliseconds& new_start, 25 | const std::chrono::milliseconds& new_end, 26 | const std::vector< std::string >& new_tags ) 27 | : name( new_name ), 28 | start( new_start ), 29 | end( new_end ), 30 | tags( new_tags ) 31 | { 32 | } 33 | 34 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/profile/profiler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/profile/profiler.h" 17 | 18 | #include "iscool/time/now.h" 19 | #include "iscool/profile/detail/output_function.h" 20 | 21 | iscool::profile::profiler::profiler 22 | ( const std::string& name ) 23 | : _name( name ) 24 | { 25 | } 26 | 27 | void iscool::profile::profiler::append_tag( const std::string& tag ) 28 | { 29 | _tags.push_back( tag ); 30 | } 31 | 32 | void iscool::profile::profiler::clear_tags() 33 | { 34 | _tags.clear(); 35 | } 36 | 37 | bool iscool::profile::profiler::started() const 38 | { 39 | return !!_start; 40 | } 41 | 42 | void iscool::profile::profiler::start() 43 | { 44 | _start = iscool::time::now< std::chrono::milliseconds >(); 45 | } 46 | 47 | void iscool::profile::profiler::end() 48 | { 49 | assert( _start ); 50 | const std::chrono::milliseconds end 51 | ( iscool::time::now< std::chrono::milliseconds >() ); 52 | const profile_data result( _name, *_start, end, _tags ); 53 | _start.reset(); 54 | 55 | if( !detail::output_function.empty() ) 56 | detail::output_function( result ); 57 | } 58 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/profile/scoped_profiler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/profile/scoped_profiler.h" 17 | 18 | iscool::profile::scoped_profiler::scoped_profiler 19 | ( const std::string& name ) 20 | : _profiler( name ) 21 | { 22 | _profiler.start(); 23 | } 24 | 25 | iscool::profile::scoped_profiler::~scoped_profiler() 26 | { 27 | _profiler.end(); 28 | } 29 | 30 | void iscool::profile::scoped_profiler::append_tag( const std::string& tag ) 31 | { 32 | _profiler.append_tag( tag ); 33 | } 34 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/profile/setup.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/profile/setup.h" 17 | 18 | #include "iscool/profile/detail/output_function.h" 19 | 20 | void iscool::profile::initialize( output_delegate delegate ) 21 | { 22 | assert( !detail::output_function ); 23 | assert( delegate ); 24 | 25 | detail::output_function = delegate; 26 | } 27 | 28 | void iscool::profile::finalize() 29 | { 30 | detail::output_function = output_delegate(); 31 | } 32 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/signals/detail/slot.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/signals/detail/slot.h" 17 | 18 | template class std::shared_ptr< iscool::signals::detail::slot >; 19 | template class std::vector< std::shared_ptr< iscool::signals::detail::slot > >; 20 | 21 | iscool::signals::detail::slot::slot() 22 | : _connected( true ) 23 | { 24 | 25 | } 26 | 27 | iscool::signals::detail::slot::~slot() = default; 28 | 29 | bool iscool::signals::detail::slot::connected() const 30 | { 31 | return _connected; 32 | } 33 | 34 | void iscool::signals::detail::slot::disconnect() 35 | { 36 | _connected = false; 37 | } 38 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/signals/detail/statistics_function.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/signals/detail/statistics_function.h" 17 | 18 | boost::function< void( const iscool::signals::statistics_data& ) > 19 | iscool::signals::detail::statistics_function; 20 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/signals/shared_connection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/signals/shared_connection.h" 17 | 18 | iscool::signals::shared_connection::shared_connection() 19 | : _connection( nullptr ) 20 | { 21 | 22 | } 23 | 24 | iscool::signals::shared_connection::shared_connection( const connection& c ) 25 | : _connection( std::make_shared< scoped_connection >( c ) ) 26 | { 27 | 28 | } 29 | 30 | iscool::signals::shared_connection::~shared_connection() = default; 31 | 32 | bool iscool::signals::shared_connection::connected() const 33 | { 34 | return ( _connection != nullptr ) && _connection->connected(); 35 | } 36 | 37 | void iscool::signals::shared_connection::disconnect() 38 | { 39 | if ( _connection == nullptr ) 40 | return; 41 | 42 | _connection->disconnect(); 43 | _connection = nullptr; 44 | } 45 | 46 | bool iscool::signals::shared_connection::operator== 47 | ( const shared_connection& that ) const 48 | { 49 | if ( ( _connection == nullptr ) && ( that._connection == nullptr ) ) 50 | return true; 51 | 52 | if ( ( _connection == nullptr ) || ( that._connection == nullptr ) ) 53 | return false; 54 | 55 | return *_connection == *that._connection; 56 | } 57 | 58 | bool iscool::signals::shared_connection::operator!= 59 | ( const shared_connection& that ) const 60 | { 61 | return !( *this == that ); 62 | } 63 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/signals/shared_connection_set.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/signals/shared_connection_set.h" 17 | 18 | #include 19 | #include 20 | 21 | template class std::vector< iscool::signals::shared_connection >; 22 | 23 | iscool::signals::shared_connection_set::shared_connection_set() = default; 24 | iscool::signals::shared_connection_set::~shared_connection_set() = default; 25 | 26 | void iscool::signals::shared_connection_set::insert( shared_connection c ) 27 | { 28 | assert( std::find( _connections.begin(), _connections.end(), c ) 29 | == _connections.end() ); 30 | _connections.push_back( c ); 31 | } 32 | 33 | void 34 | iscool::signals::shared_connection_set::insert( shared_connection_set that ) 35 | { 36 | for ( const shared_connection& c : that._connections ) 37 | insert( c ); 38 | } 39 | 40 | void iscool::signals::shared_connection_set::clear() 41 | { 42 | for ( shared_connection& connection : _connections ) 43 | connection.disconnect(); 44 | 45 | _connections.clear(); 46 | } 47 | 48 | bool iscool::signals::shared_connection_set::empty() const 49 | { 50 | return _connections.empty(); 51 | } 52 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/signals/signal.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/signals/signal.h" 17 | #include "iscool/signals/signal.impl.tpp" 18 | 19 | template class iscool::signals::signal< void() >; 20 | template class iscool::signals::signal< void( bool ) >; 21 | template class iscool::signals::signal< void( int ) >; 22 | template class iscool::signals::signal< void( float ) >; 23 | template class iscool::signals::signal< void( std::uint32_t ) >; 24 | template class iscool::signals::signal< void( std::uint64_t ) >; 25 | template class iscool::signals::signal< void( std::string ) >; 26 | template class iscool::signals::signal< void( const std::string& ) >; 27 | 28 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/signals/statistics_data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/signals/statistics_data.h" 17 | 18 | iscool::signals::statistics_data::statistics_data 19 | ( const std::string& signal_identifier, std::size_t slot_count ) 20 | : signal_identifier( signal_identifier ), 21 | slot_count( slot_count ) 22 | { 23 | 24 | } 25 | 26 | iscool::signals::statistics_data::~statistics_data() = default; 27 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/iscool/src/iscool/signals/statistics_sink.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018-present IsCool Entertainment 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | #include "iscool/signals/statistics_sink.h" 17 | 18 | #include "iscool/signals/detail/statistics_function.h" 19 | 20 | void iscool::signals::set_statistics_sink 21 | ( const boost::function< void( const statistics_data& ) >& sink ) 22 | { 23 | assert( sink ); 24 | detail::statistics_function = sink; 25 | } 26 | 27 | void iscool::signals::clear_statistics_sink() 28 | { 29 | detail::statistics_function = 30 | boost::function< void( const statistics_data& ) >(); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/jeffomatic/jl_signal/src/ScopedAllocator.h: -------------------------------------------------------------------------------- 1 | #ifndef _JL_SCOPED_ALLOCATOR_H_ 2 | #define _JL_SCOPED_ALLOCATOR_H_ 3 | 4 | // Scoped allocators will most likely be used with placement new, e.g.: 5 | // Foo* pFoo = new( pFooAllocator->Alloc(sizeof(Foo)) ) Foo(); 6 | // To use placement new, we need to include the standard 'new' header. 7 | #include 8 | 9 | namespace jl { 10 | 11 | /** 12 | * An interface for very basic, stateful allocators. No array allocation. 13 | */ 14 | class ScopedAllocator 15 | { 16 | public: 17 | virtual ~ScopedAllocator() {}; 18 | virtual void* Alloc( size_t nBytes ) = 0; 19 | virtual void Free( void* pObject ) = 0; 20 | }; 21 | 22 | } // namespace jl 23 | 24 | #endif // ! defined( _JL_SCOPED_ALLOCATOR_H_ ) 25 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/jeffomatic/jl_signal/src/SignalBase.cpp: -------------------------------------------------------------------------------- 1 | #include "Signal.h" 2 | 3 | using namespace jl; 4 | 5 | ScopedAllocator* jl::SignalObserver::s_pCommonAllocator = NULL; 6 | ScopedAllocator* SignalBase::s_pCommonAllocator = NULL; 7 | 8 | jl::SignalObserver::~SignalObserver() 9 | { 10 | DisconnectAllSignals(); 11 | } 12 | 13 | void jl::SignalObserver::DisconnectSignal( SignalBase* pSignal ) 14 | { 15 | for ( SignalList::iterator i = m_oSignals.begin(); i.isValid(); ) 16 | { 17 | if ( *i == pSignal ) 18 | { 19 | JL_SIGNAL_LOG( "Observer %p disconnecting signal %p", this, pSignal ); 20 | i->OnObserverDisconnect( this ); 21 | break; 22 | } 23 | else 24 | { 25 | ++i; 26 | } 27 | } 28 | } 29 | 30 | void jl::SignalObserver::DisconnectAllSignals() 31 | { 32 | JL_SIGNAL_LOG( "Observer %p disconnecting all signals\n", this ); 33 | 34 | for ( SignalList::iterator i = m_oSignals.begin(); i.isValid(); ++i ) 35 | { 36 | i->OnObserverDisconnect( this ); 37 | } 38 | 39 | m_oSignals.Clear(); 40 | } 41 | 42 | void jl::SignalObserver::OnSignalConnect( SignalBase* pSignal ) 43 | { 44 | JL_SIGNAL_LOG( "\tObserver %p received connection message from signal %p\n", this, pSignal ); 45 | const bool bAdded = m_oSignals.Add( pSignal ); 46 | JL_ASSERT( bAdded ); 47 | } 48 | 49 | void jl::SignalObserver::OnSignalDisconnect( SignalBase* pSignal ) 50 | { 51 | JL_SIGNAL_LOG( "\tObserver %p received disconnect message from signal %p\n", this, pSignal ); 52 | 53 | OnSignalDisconnectInternal( pSignal ); 54 | 55 | for ( SignalList::iterator i = m_oSignals.begin(); i.isValid(); ) 56 | { 57 | if ( *i == pSignal ) 58 | { 59 | JL_SIGNAL_LOG( "\t\tRemoving connection to signal %p\n", pSignal ); 60 | m_oSignals.Remove( i ); 61 | } 62 | else 63 | { 64 | ++i; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/jeffomatic/jl_signal/src/StaticSignalConnectionAllocators.h: -------------------------------------------------------------------------------- 1 | #ifndef _JL_STATIC_SIGNAL_CONNECTION_ALLOCATORS_H_ 2 | #define _JL_STATIC_SIGNAL_CONNECTION_ALLOCATORS_H_ 3 | 4 | #include "ObjectPoolScopedAllocator.h" 5 | #include "SignalDefinitions.h" 6 | 7 | namespace jl { 8 | 9 | typedef Signal0 TDummySignal; 10 | 11 | template< unsigned _Size > 12 | class StaticSignalConnectionAllocator : public StaticObjectPoolAllocator< TDummySignal::eAllocationSize, _Size > 13 | { 14 | }; 15 | 16 | template< unsigned _Size > 17 | class StaticObserverConnectionAllocator : public StaticObjectPoolAllocator< SignalObserver::eAllocationSize, _Size > 18 | { 19 | }; 20 | 21 | } // namespace jl 22 | 23 | #endif // ! defined( _JL_STATIC_SIGNAL_CONNECTION_ALLOCATORS_H_ ) -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/jeffomatic/jl_signal/src/Utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _JL_UTILS_H_ 2 | #define _JL_UTILS_H_ 3 | 4 | ///////////// 5 | // I. Asserts 6 | 7 | #include 8 | 9 | // To disable runtime asserts, either: 10 | // 1. Define JL_DISABLE_ASSERT as a global compiler macro, 11 | // 2. Comment out JL_ENABLE_ASSERT below 12 | #define JL_ENABLE_ASSERT 13 | 14 | #if defined( JL_ENABLE_ASSERT ) && ! defined ( JL_DISABLE_ASSERT ) 15 | #define JL_ASSERT( _Expr ) assert( _Expr ) 16 | #else 17 | #define JL_ASSERT( _Expr ) 18 | #endif 19 | 20 | // A handy compile-time assert 21 | #define JL_COMPILER_ASSERT( _Expr, _Message ) typedef int JL_COMPILER_ASSERT_##_Message[ _Expr ? 0 : -1 ] 22 | 23 | ////////////////////////////// 24 | // II. Miscellaneous utilities 25 | 26 | #define JL_ARRAY_SIZE( _a ) ( sizeof(_a) / sizeof((_a)[0]) ) 27 | #define JL_UNUSED( _a ) (void)( _a ) 28 | 29 | namespace jl { 30 | 31 | template< typename _to, typename _from > 32 | _to BruteForceCast( _from p ) 33 | { 34 | union 35 | { 36 | _from from; 37 | _to to; 38 | } conversion; 39 | conversion.from = p; 40 | return conversion.to; 41 | } 42 | 43 | } // namespace jl 44 | 45 | #endif // ! defined( _JL_UTILS_H_ ) -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/joanrieu/signal11/LICENSE.md: -------------------------------------------------------------------------------- 1 | Please refer to `signal11.h`. 2 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/joanrieu/signal11/README.md: -------------------------------------------------------------------------------- 1 | signal11 2 | ======== 3 | 4 | Description 5 | ----------- 6 | 7 | A very simple signal/slot library for C++11. 8 | 9 | Installation 10 | ------------ 11 | 12 | Just copy `signal11.h` in your project. 13 | You probably need to enable the C++11 mode of your compiler, `clang++` and `g++` use `-std=c++11`. 14 | 15 | Usage 16 | ----- 17 | 18 | signal11 signal; 19 | 20 | Declares a signal taking three arguments of types `A`, `B` and `C`. 21 | There is no limit on the amount of arguments. 22 | 23 | signal.connect(function); 24 | 25 | Connects `function` (anything accepted by `std::function`) to the signal. 26 | `function(a, b, c)` will be called anytime `signal(a, b, c)` is called. 27 | 28 | auto connection = signal.connect(function); 29 | // ... 30 | signal.disconnect(connection); 31 | 32 | Prevent `function` from being called anymore. 33 | 34 | signal.connect_oneshot(function); 35 | 36 | Like `connect` but `function` will be disconnected as soon as it has been called once. 37 | 38 | For a more in-depth example, see `example.cpp`. 39 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/larspensjo/SimpleSignal/README.md: -------------------------------------------------------------------------------- 1 | # High performance C++11 signals 2 | See [Performance of a C++11 Signal System](http://www.testbit.eu/2013/cpp11-signal-system-performance/) for 3 | the original source code, as well as performance measurements compared to other signalling systems. 4 | 5 | The original author, Tim Janik, licensed the source code to the public domain [CC0 1.0 Universal (CC0 1.0)](http://creativecommons.org/publicdomain/zero/1.0/). 6 | ## Declare a signal 7 | This example declares a signal 'sig' that takes three arguments and returns a char. 8 | ```c++ 9 | Simple::Signal sig; 10 | ``` 11 | ## Connect to a signal 12 | This example connects 'sig' to a static function. 13 | It is also possible to connect to member functions or lambda functions. 14 | ```c++ 15 | static char float_callback (float f, int, std::string) { 16 | // ... 17 | return 0; 18 | } 19 | 20 | void Init() { 21 | sig.connect(float_callback); 22 | } 23 | ``` 24 | ## Fire a signal 25 | ```c++ 26 | void func() { 27 | // ... 28 | sig.emit(1.0f, 7, "xxxx"); 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/miguelmartin/Wink-Signals/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2014 Miguel Martin (miguel@miguel-martin.com) 2 | 3 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | 1. The origin of this software must not be misrepresented; 8 | you must not claim that you wrote the original software. 9 | If you use this software in a product, an acknowledgment 10 | in the product documentation would be appreciated but is not required. 11 | 12 | 2. Altered source versions must be plainly marked as such, 13 | and must not be misrepresented as being the original software. 14 | 15 | 3. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/miguelmartin/Wink-Signals/examples/Makefile: -------------------------------------------------------------------------------- 1 | CXX=c++ 2 | CXX_ARGS=-I ../ -std=c++11 3 | 4 | benchmark: 5 | @echo "Compiling benchmark..." 6 | @$(CXX) $(CXX_ARGS) -o benchmark -O3 7 | @echo "Running benchmark..." 8 | @./benchmark 9 | clean: 10 | rm ./benchmark 11 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/mwthinker/Signal/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2014 Marcus Welander 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/mwthinker/Signal/README.md: -------------------------------------------------------------------------------- 1 | Signal 2 | ====== 3 | Is a simple Signal/Slot library inspired by the corresponding boost library. 4 | 5 | The compiler must support variadic template and support some parts of C++11 6 | standard. While using Visual Studio, it must be at least version 12 or higher. 7 | 8 |

Open source

9 | The project is under the MIT license (see LICENSE.txt). 10 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/mwthinker/Signal/src/mw/signal.h: -------------------------------------------------------------------------------- 1 | #ifndef MW_SIGNAL_H 2 | #define MW_SIGNAL_H 3 | 4 | #include "signals/connection.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace mw { 11 | 12 | // Is a class that holds functions. A slot/callbacks class. 13 | template 14 | class Signal : public signals::SignalInterface { 15 | public: 16 | typedef std::function Callback; 17 | 18 | inline Signal() { 19 | id_ = 0; 20 | } 21 | 22 | ~Signal() { 23 | clear(); 24 | } 25 | 26 | signals::Connection connect(Callback callback) { 27 | ConnectionInfoPtr c = std::make_shared(++id_, this); 28 | functions_.push_back(Pair(callback, c)); 29 | return signals::Connection(c); 30 | } 31 | 32 | inline void operator()(A... a) { 33 | for (Pair& pair : functions_) { 34 | pair.callback_(a...); 35 | } 36 | } 37 | 38 | inline void clear() { 39 | for (Pair& pair : functions_) { 40 | pair.connectionInfo_->signal_ = nullptr; 41 | } 42 | } 43 | 44 | inline int size() const { 45 | return functions_.size(); 46 | } 47 | 48 | private: 49 | typedef std::shared_ptr ConnectionInfoPtr; 50 | 51 | void disconnect(int id) override { 52 | functions_.remove_if([&](Pair& pair) { 53 | if (pair.connectionInfo_->id_ == id) { 54 | pair.connectionInfo_->signal_ = nullptr; 55 | return true; 56 | } 57 | return false; 58 | }); 59 | } 60 | 61 | struct Pair { 62 | Pair(const Callback& callback, const ConnectionInfoPtr& connectionInfo) : callback_(callback), connectionInfo_(connectionInfo) { 63 | } 64 | 65 | ConnectionInfoPtr connectionInfo_; 66 | Callback callback_; 67 | }; 68 | 69 | int id_; // The id mapped to last added function. 70 | std::list functions_; // All mapped callbacks. 71 | }; 72 | 73 | } // Namespace mw. 74 | 75 | #endif // MW_SIGNAL_H 76 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/mwthinker/Signal/src/mw/signals/connection.cpp: -------------------------------------------------------------------------------- 1 | #include "connection.h" 2 | #include "signal.h" 3 | 4 | namespace mw { 5 | 6 | namespace signals { 7 | 8 | void Connection::disconnect() { 9 | if (connectionInfo_ && connectionInfo_->signal_ != nullptr) { 10 | connectionInfo_->signal_->disconnect(connectionInfo_->id_); 11 | } 12 | } 13 | 14 | bool Connection::connected() const { 15 | return connectionInfo_ && connectionInfo_->signal_ != nullptr; 16 | } 17 | 18 | Connection::Connection(const ConnectionInfoPtr& c) { 19 | connectionInfo_ = c; 20 | } 21 | 22 | } // Namespace signals. 23 | 24 | } // Namespace mw. 25 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/mwthinker/Signal/src/mw/signals/connection.h: -------------------------------------------------------------------------------- 1 | #ifndef MW_SIGNALS_CONNECTION_H 2 | #define MW_SIGNALS_CONNECTION_H 3 | 4 | #include 5 | 6 | namespace mw { 7 | 8 | template 9 | class Signal; 10 | 11 | namespace signals { 12 | 13 | class Connection; 14 | 15 | // Is used by mw::signal. Is not to be used elsewhere. 16 | class SignalInterface { 17 | protected: 18 | friend class Connection; 19 | 20 | inline SignalInterface() { 21 | } 22 | 23 | inline ~SignalInterface() { 24 | } 25 | 26 | private: 27 | SignalInterface(const SignalInterface&) = delete; 28 | SignalInterface& operator=(const SignalInterface& SignalInterface) = delete; 29 | 30 | virtual void disconnect(int id) = 0; 31 | }; 32 | 33 | // Used internally in mw::Signal to remember a connection made. 34 | struct ConnectionInfo { 35 | inline ConnectionInfo(int id, SignalInterface* signal) : signal_(signal), id_(id) { 36 | } 37 | 38 | SignalInterface* signal_; 39 | const int id_; 40 | }; 41 | 42 | // A connection Object remembers a connection and gives infomation 43 | // if the connection is active or not. 44 | class Connection { 45 | public: 46 | template friend class mw::Signal; 47 | 48 | // Creates a empty connection. By default the connection is not active. 49 | inline Connection() { 50 | } 51 | 52 | // Disconnect the active connection. The callback associated to this connection 53 | // will disconnect from the corresponding slot. 54 | void disconnect(); 55 | 56 | // Returns true if the connection is still active else false. 57 | bool connected() const; 58 | 59 | private: 60 | typedef std::shared_ptr ConnectionInfoPtr; 61 | 62 | // Is called from mw::Signal to bind a connection. 63 | Connection(const ConnectionInfoPtr& c); 64 | 65 | ConnectionInfoPtr connectionInfo_; 66 | }; 67 | 68 | } // Namespace signals. 69 | 70 | } // Namespace mw. 71 | 72 | #endif // MW_SIGNALS_CONNECTION_H 73 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/palacaze/sigslot/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Pierre-Antoine Lacaze 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/supergrover/sigslot/README.md: -------------------------------------------------------------------------------- 1 | sigslot 2 | ======= 3 | 4 | C++11 signal/slot implementation 5 | 6 | ## Requirements ## 7 | * c++11 8 | 9 | ## How to use ## 10 | For a code sample, see test.cpp 11 | 12 | ``` 13 | class Emitter 14 | { 15 | public: 16 | Signal the_signal; 17 | 18 | void do_emit(int value) 19 | { 20 | the_signal.emit(value); 21 | } 22 | }; 23 | ``` 24 | 25 | The only thing required for a class to emit signals, is to declare a field of the Signal<> type. The template arguments will be the parameter types of the slots to be bound to the signal. 26 | 27 | ``` 28 | class Receiver: public Object 29 | { 30 | public: 31 | void slot(int v) 32 | { 33 | cout << "Yay! " << v << endl; 34 | } 35 | }; 36 | ``` 37 | 38 | The only thing required for a class to be able to bind to signals, is for it to derive from Object. After that, every method of the object can be bound to signals. 39 | 40 | ``` 41 | int main(int argc, char* argv[]) 42 | { 43 | // Create both an emitting and receiving instance 44 | Emitter em; 45 | Receiver recv; 46 | 47 | // Bind the slot to the signal 48 | em.the_signal.bind(&Receiver::slot, &recv); 49 | 50 | // Emit 51 | em.do_emit(42); 52 | 53 | return EXIT_SUCCESS; 54 | } 55 | ``` 56 | 57 | Here we instantiate both classes, bind the signal and emit it. 58 | 59 | 60 | ## Donations ## 61 | 62 | Like it? 63 | 64 | If you find this useful, please consider donating to BTC: 1Pck5gui4iXhTQUiUc3qFD7uPbj1cn5ZSB 65 | 66 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/benchmark/lib/vdksoft/signals/doc/signals.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheWisp/signals/7ff59d1bc6387337ef34856a450be34cfa2c9e51/signal-slot-benchmarks/benchmark/lib/vdksoft/signals/doc/signals.pdf -------------------------------------------------------------------------------- /signal-slot-benchmarks/vs/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /signal-slot-benchmarks/vs/signal-slot-benchmarks.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.2042 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "signal-slot-benchmarks", "signal-slot-benchmarks.vcxproj", "{AC15350A-7C96-4147-9E43-F3704433B527}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {AC15350A-7C96-4147-9E43-F3704433B527}.Debug|x64.ActiveCfg = Debug|x64 17 | {AC15350A-7C96-4147-9E43-F3704433B527}.Debug|x64.Build.0 = Debug|x64 18 | {AC15350A-7C96-4147-9E43-F3704433B527}.Debug|x86.ActiveCfg = Debug|Win32 19 | {AC15350A-7C96-4147-9E43-F3704433B527}.Debug|x86.Build.0 = Debug|Win32 20 | {AC15350A-7C96-4147-9E43-F3704433B527}.Release|x64.ActiveCfg = Release|x64 21 | {AC15350A-7C96-4147-9E43-F3704433B527}.Release|x64.Build.0 = Release|x64 22 | {AC15350A-7C96-4147-9E43-F3704433B527}.Release|x86.ActiveCfg = Release|Win32 23 | {AC15350A-7C96-4147-9E43-F3704433B527}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {9F99E7B6-6FE9-4071-BD78-F783D4FF4E7F} 30 | EndGlobalSection 31 | EndGlobal 32 | --------------------------------------------------------------------------------