|
3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
|
Like MultiEvent, an Event can be bound to multiple function, but this class is also serializable in the editor. More...
#include <Event.hpp>


Classes | |
| class | ConstIterator |
| Wraps the vector iterator with a const iterator to prevent modification of the bound functions. More... | |
Public Types | |
| using | Iterator = std::vector<MemberFunctionInvoker>::iterator |
Public Member Functions | |
| Event () | |
| Constructs a empty Event. | |
| template<typename R, typename O, typename F, typename ... Args> | |
| Event (O *object, O::F fn) | |
| Constructs a Event with the given method. | |
| Event (const Event &other) | |
| Deep clone Event ctor. | |
| Event (Event &&other)=default | |
| Move constructor for this Event. | |
| Event & | operator= (const Event &other) |
| Creates a deep clone of the Event. | |
| Event & | operator= (Event &&)=default |
| template<typename R, typename F, typename ... Args> | |
| void | Bind (F fn) |
| Binds the given function to this event. | |
| template<typename R, typename O, typename F, typename ... Args> | |
| void | Bind (O *object, F fn) |
| Binds a member function to this event. | |
| void | Bind (std::unique_ptr< IReflectedFunction > &&fn, size_t objID, size_t fnID) |
| Binds an typeless function to this event. | |
| void | BindIncomplete (size_t objID, size_t fnID) |
| Binds an function by finding it in the ObjectList and reflection metadata. | |
| template<typename R, typename ... Args> | |
| R | operator() (int index, Args &&...args) |
| Calls the index-th bound function. | |
| template<typename R> | |
| std::vector< R > | InvokeAll (std::span< Any > args) |
| Invokes all functions. | |
| void | InvokeAll (std::span< Any > args=std::span< Any >()) |
| Invokes all functions ignoring the return value. | |
| void | Unbind (void *fnPtr) |
| Unbinds the given function pointer. | |
| void | Unbind (size_t idx) |
| Unbinds the idx-th function. | |
| void | Bind (std::function< Any(std::vector< Any >)> fn) override |
| Binds the given function pointer to this event. | |
| Any | operator() (std::vector< Any > &args) override |
| Calls all the functions with the specified argument pack. | |
| void | Reset () noexcept override |
| Clears all the bound functions. | |
| const void * | operator[] (size_t i) const |
| Returns an raw pointer to the i-th bound function. | |
| const MemberFunctionInvoker & | At (size_t i) const |
| Returns an invoker at the specified index. | |
| size_t | Count () const noexcept |
| Returns the number of bound functions. | |
| ConstIterator | cbegin () const |
| Const begin iterator for this event. | |
| ConstIterator | cend () const |
| Const end iterator for this event. | |
| Iterator | begin () |
| Begin iterator for this event. | |
| Iterator | end () |
| End iterator for this event. | |
| const Reflection::IReflectedFunction * | ReflFnAt (size_t index) |
| Returns the metadata of the index-th function bound in this Event instance. | |
| Event | Clone () const |
Same as Event e = other.. | |
| ~Event ()=default | |
| Public Member Functions inherited from Engine3DRadSpace.Reflection::IEvent | |
| virtual | ~IEvent ()=default |
Additional Inherited Members | |
| Protected Member Functions inherited from Engine3DRadSpace.Reflection::IEvent | |
| IEvent ()=default | |
Like MultiEvent, an Event can be bound to multiple function, but this class is also serializable in the editor.
| using Engine3DRadSpace.Reflection::Event::Iterator = std::vector<MemberFunctionInvoker>::iterator |
| Event::Event | ( | ) |
Constructs a empty Event.
|
inline |
Constructs a Event with the given method.
| R | Return type |
| O | Class type of the method |
| F | Method type |
| ...Args | Argument pack for the method |
| object | object instance |
| fn | member function pointer |
| Event::Event | ( | const Event & | other | ) |
Deep clone Event ctor.
| other | From |
|
default |
Move constructor for this Event.
| other |
|
default |
| const Event::MemberFunctionInvoker & Event::At | ( | size_t | i | ) | const |
Returns an invoker at the specified index.
| i | index |
| Event::Iterator Event::begin | ( | ) |
Begin iterator for this event.
|
inline |
Binds the given function to this event.
| R | Return type |
| F | Function type |
| ...Args | Function parameter pack |
| fn | Function pointer |
|
inline |
Binds a member function to this event.
| R | Return type |
| O | Object type |
| F | Function type |
| ...Args | Argument pack |
| object | Object pointer |
| fn | Member function pointer |
Binds the given function pointer to this event.
| fn | Type erased function |
Implements Engine3DRadSpace.Reflection::IEvent.
| void Event::Bind | ( | std::unique_ptr< IReflectedFunction > && | fn, |
| size_t | objID, | ||
| size_t | fnID ) |
Binds an typeless function to this event.
| fn | Function reflection data |
| objID | Object ID in the ObjectList. |
| fnID | Function ID |
| void Event::BindIncomplete | ( | size_t | objID, |
| size_t | fnID ) |
Binds an function by finding it in the ObjectList and reflection metadata.
| objID | object ID from an object list |
| fnID | function ID in metadata |
| Event::ConstIterator Event::cbegin | ( | ) | const |
Const begin iterator for this event.
| Event::ConstIterator Event::cend | ( | ) | const |
Const end iterator for this event.
| Event Event::Clone | ( | ) | const |
Same as Event e = other..
|
noexcept |
Returns the number of bound functions.
| Event::Iterator Event::end | ( | ) |
End iterator for this event.
|
inline |
Invokes all functions.
| R | Return type |
| args | Type erased argument pack |
|
inline |
Invokes all functions ignoring the return value.
| args | Type erased argument pack |
|
inline |
Calls the index-th bound function.
| R | Return type |
| ...Args | Argument pack |
| index | Index of the function |
| ...args | Argument pack |
Calls all the functions with the specified argument pack.
| args | type erased argument pack |
Implements Engine3DRadSpace.Reflection::IEvent.
Creates a deep clone of the Event.
| other | From |
| const void * Event::operator[] | ( | size_t | i | ) | const |
Returns an raw pointer to the i-th bound function.
| i | index |
| const IReflectedFunction * Event::ReflFnAt | ( | size_t | index | ) |
Returns the metadata of the index-th function bound in this Event instance.
| index |
|
overridevirtualnoexcept |
Clears all the bound functions.
Implements Engine3DRadSpace.Reflection::IEvent.
| void Event::Unbind | ( | size_t | idx | ) |
Unbinds the idx-th function.
| idx | 0 < idx < Count(). |
| void Event::Unbind | ( | void * | fnPtr | ) |
Unbinds the given function pointer.
| fnPtr | Function pointer. |