CFx SDK Documentation
2023 SP0
|
Namespaces | |
detail | |
Classes | |
class | connection |
class | signal_base |
class | scoped_connection |
struct | signal_traits |
struct | signal_traits< R(Args...)> |
class | signal |
class | signal_base< SignalTraits, Allocator, R(Args...)> |
class | basic_slot |
class | basic_slot< R(Args...), SlotID > |
class | slot_list |
class | offset_iterator |
class | slot_iterator |
class | trackable_allocator |
struct | trackable_delete |
class | trackable_lock |
Typedefs | |
template<class Handler , class SignalTraits = signal_traits<Handler>, class Allocator = std::allocator<std::function<Handler>>> | |
using | signal_t = signal< Handler, SignalTraits, Allocator > |
template<class T , class Observer , class Deleter = std::default_delete<T>> | |
using | trackable_ptr = std::unique_ptr< T, trackable_delete< T, Observer, Deleter > > |
Functions | |
template<class connection > | |
scoped_connection< connection > | make_scoped_connection (connection &&target) |
template<class Handler , class SignalTraits , class Allocator > | |
void | swap (signal< Handler, SignalTraits, Allocator > &lhs, signal< Handler, SignalTraits, Allocator > &rhs) |
template<class Handler , class ThreadPolicy , class Allocator > | |
void | swap (signal< Handler, ThreadPolicy, Allocator > &lhs, signal< Handler, ThreadPolicy, Allocator > &rhs) |
template<class T , class Observer , class Deleter = std::default_delete<T>, class TrackableDeleter = trackable_delete<T, Observer, Deleter>, class... Args> | |
std::shared_ptr< T > | make_trackable (TrackableDeleter deleter, Args &&... args) |
template<class T , class Observer , class Deleter = std::default_delete<T>, class TrackableDeleter = trackable_delete<T, Observer, Deleter>, class... Args> | |
std::shared_ptr< T > | make_trackable (Observer observer, Args &&... args) |
template<class T , class Observer , class Deleter = std::default_delete<T>, class TrackableDeleter = trackable_delete<T, Observer, Deleter>, class... Args> | |
std::shared_ptr< T > | make_trackable (Observer observer, Deleter deleter, Args &&... args) |
template<class T , class Observer , class Allocator = std::allocator<T>, class TrackableAllocator = trackable_allocator<T, Observer, Allocator>, class... Args> | |
std::shared_ptr< T > | allocate_trackable (TrackableAllocator allocator, Args &&... args) |
template<class T , class Observer , class Allocator = std::allocator<T>, class TrackableAllocator = trackable_allocator<T, Observer, Allocator>, class... Args> | |
std::shared_ptr< T > | allocate_trackable (Observer observer, Args &&... args) |
template<class T , class Observer , class Allocator = std::allocator<T>, class TrackableAllocator = trackable_allocator<T, Observer, Allocator>, class... Args> | |
std::shared_ptr< T > | allocate_trackable (Observer observer, Allocator allocator, Args &&... args) |
Slimmer Signals Copyright (c) 2014 Christopher Tarquini
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Slimmer Signals Inspired by Boost::Signals2 and ssig
Main Differences between this library and all the other signal libraries:
While still being light-weight it still supports:
connection.disconnect()/connection.connected() can be called after the signal stops existing There's a small overhead because of the use of a shared_ptr for each slot, however, my average use-case Involves adding 1-2 slots per signal so the overhead is neglible, especially if you use a custom allocator such as boost:pool
To keep it simple I left out support for slots that return values, though it shouldn't be too hard to implement. I've also left thread safety as something to be handled by higher level libraries Much in the spirit of other STL containers. My reasoning is that even with thread safety sort of baked in The user would still be responsible making sure slots don't do anything funny if they are executed on different threads All the mechanics for this would complicate the library and really not solve much of anything while also slowing down the library for applications where signals/slots are only used from a single thread
Plus it makes things like adding slots to multiple signals really slow because you have to lock each and every time You'd be better off using your own syncronization methods to setup all your singals at once and releasing your lock after you're done
using slimsig::signal_t = typedef signal<Handler, SignalTraits, Allocator> |
using slimsig::trackable_ptr = typedef std::unique_ptr<T, trackable_delete<T, Observer, Deleter> > |
Definition at line 84 of file tracked_connect.h.
std::shared_ptr<T> slimsig::allocate_trackable | ( | Observer | observer, |
Allocator | allocator, | ||
Args &&... | args | ||
) |
Definition at line 107 of file tracked_connect.h.
std::shared_ptr<T> slimsig::allocate_trackable | ( | Observer | observer, |
Args &&... | args | ||
) |
Definition at line 103 of file tracked_connect.h.
std::shared_ptr<T> slimsig::allocate_trackable | ( | TrackableAllocator | allocator, |
Args &&... | args | ||
) |
Definition at line 99 of file tracked_connect.h.
scoped_connection<connection> slimsig::make_scoped_connection | ( | connection && | target | ) |
Definition at line 117 of file connection.h.
std::shared_ptr<T> slimsig::make_trackable | ( | Observer | observer, |
Args &&... | args | ||
) |
Definition at line 91 of file tracked_connect.h.
std::shared_ptr<T> slimsig::make_trackable | ( | Observer | observer, |
Deleter | deleter, | ||
Args &&... | args | ||
) |
Definition at line 95 of file tracked_connect.h.
std::shared_ptr<T> slimsig::make_trackable | ( | TrackableDeleter | deleter, |
Args &&... | args | ||
) |
Definition at line 87 of file tracked_connect.h.
void slimsig::swap | ( | signal< Handler, SignalTraits, Allocator > & | lhs, |
signal< Handler, SignalTraits, Allocator > & | rhs | ||
) |
void slimsig::swap | ( | signal< Handler, ThreadPolicy, Allocator > & | lhs, |
signal< Handler, ThreadPolicy, Allocator > & | rhs | ||
) |
Definition at line 362 of file signal_base.h.