{"id":25852570,"url":"https://github.com/wye-sh/wheel","last_synced_at":"2026-06-10T11:31:13.654Z","repository":{"id":279845026,"uuid":"940175050","full_name":"wye-sh/wheel","owner":"wye-sh","description":"Wye-Homologous Event Emitter Library","archived":false,"fork":false,"pushed_at":"2025-08-02T17:21:50.000Z","size":96,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-02T19:35:01.530Z","etag":null,"topics":["cpp","cpp20","event-emitter","signals"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wye-sh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-27T18:26:39.000Z","updated_at":"2025-08-02T17:20:27.000Z","dependencies_parsed_at":"2025-02-28T03:08:57.509Z","dependency_job_id":"91e6add7-8122-4f3e-99fd-61c40775f079","html_url":"https://github.com/wye-sh/wheel","commit_stats":null,"previous_names":["wye-sh/wheel"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/wye-sh/wheel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wye-sh%2Fwheel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wye-sh%2Fwheel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wye-sh%2Fwheel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wye-sh%2Fwheel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wye-sh","download_url":"https://codeload.github.com/wye-sh/wheel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wye-sh%2Fwheel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34151271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp20","event-emitter","signals"],"created_at":"2025-03-01T14:20:09.917Z","updated_at":"2026-06-10T11:31:13.644Z","avatar_url":"https://github.com/wye-sh.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WHEEL\r\n\r\nWHEEL (Wye-Homologous Event Emitter Library) is a lightweight, type-safe C++\r\nevent system designed to provide flexible event handling with minimal overhead\r\nand thread-safe operation.\r\n\r\n## Table of Contents\r\n- [Overview](#overview)\r\n- [Installation](#installation)\r\n  - [Options](#options)\r\n- [Quick Start](#quick-start)\r\n- [Examples](#examples)\r\n- [Documentation](#documentation)\r\n\r\n## Overview\r\n\r\nBuilt on an emitter-based architecture, the library allows you to register,\r\nextend, manage, and emit strongly-typed events. Each event in an emitter can\r\nhave multiple callbacks, which can be ordered by weight to control execution\r\npriority. Events support metadata attachment to callbacks, enabling custom data\r\nto flow between event creators and handlers. Additionally, the interceptor\r\nsystem lets event creators customize how callbacks are executed, providing even\r\nfiner control over event handling.\r\n\r\n## Installation\r\n\r\nIf you're using CMake, add the following to your `CMakeLists.txt`:\r\n```cmake\r\ninclude(FetchContent)\r\nFetchContent_Declare(\r\n  wheel\r\n  GIT_REPOSITORY https://github.com/wye-sh/wheel\r\n  GIT_TAG v2.0.2 # (latest version)\r\n)\r\nFetchContent_MakeAvailable(wheel);\r\n\r\n# Link against wheel in your project\r\ntarget_link_libraries(\u003cyour_target\u003e PRIVATE wheel)\r\n```\r\n\r\nAlternatively, clone the repository along with its dependencies (check the\r\n`CMakeLists.txt` for details) and place the headers on your include path.\r\n\r\n### Options\r\n\r\nYou have the opportunity for further customization before your call to\r\n`FetchContent_MakeAvailable()`.\r\n```cmake\r\n# If on, enables faster pointer address comparison for `type_info` objects,\r\n# which assumes that only one library instance is linked\r\nset(RTTI_POINTER_COMPARISON_MODE \u003cOFF|ON\u003e) # Default: ON\r\n```\r\nThese dependencies can also be configured:\r\n- [APORT](https://github.com/wye-sh/aport)\r\n\r\n## Quick Start\r\n\r\nTo get started:\r\n\r\n```cpp\r\n// Create emitter that can store multiple events\r\nwheel::emitter Events;\r\n\r\n// Alternatively, specify a default type for automatic event creation\r\n// (autovivification) when one that does not exist is accessed.\r\n// # wheel::emitter\u003cvoid (int)\u003e Events;\r\n\r\n// Add \"key-down\" event that takes a `char32_t`\r\nEvents.create\u003cvoid (char32_t)\u003e(\"key-down\");\r\n\r\n// Insert a handler\r\nEvents[\"key-down\"] = [](char32_t Codepoint) {\r\n  printf(\"[1]: Key Down: %c\", (char) Codepoint);\r\n};\r\n\r\n// Save handle to most recently added handler\r\nwheel::handle Handle = *Events;\r\n\r\n// Insert a weighted handler (default weight is zero)\r\nEvents[\"key-down\"].insert([](char32_t Codepoint) {\r\n  printf(\"[0]: Key Down: %c\", (char) Codepoint);\r\n}, 1);\r\n\r\n// Call all \"key-down\" handlers\r\nEvents[\"key-down\"].emit((char32_t) 'p');\r\n// Output:\r\n// $ [0] Key Down: p\r\n// $ [1] Key Down: p\r\n\r\n// Remove handler using saved handle. The handle we retrieved earlier can be\r\n// used to remove the handler it references from anywhere, including from\r\n// inside itself.\r\nEvents[\"key-down\"].remove(Handle);\r\n\r\n// Call \"key-down\" handlers again\r\nEvents[\"key-down\"].emit((char32_t) 'r');\r\n// Output:\r\n// $ [0] Key Down: r\r\n```\r\n\r\n## Examples\r\n\r\nMore advanced examples:\r\n\r\n### Self-Destruct Event\r\n\r\n```cpp\r\n// Create emitter\r\nwheel::emitter Events;\r\n\r\n// Add event that removes handlers as they are added\r\nEvents\r\n  .create\u003cvoid ()\u003e(\"self-destruct\")\r\n  .set_on_insert([\u0026](wheel::handle \u0026Handle) {\r\n    Events[\"self-destruct\"].remove(Handle);\r\n  })\r\n  .set_on_remove([](wheel::handle \u0026Handle) {\r\n    printf(\"Boom!\\n\");\r\n  });\r\n\r\n// Insert handlers\r\nEvents[\"self-destruct\"] = []() { /* ... */ };\r\n// Output:\r\n// $ Boom!\r\nEvents[\"self-destruct\"] = []() { /* ... */ };\r\n// Output:\r\n// $ Boom!\r\n\r\n// emit() does nothing because there are no handlers\r\nEvents[\"self-destruct\"].emit();\r\n```\r\n\r\n### Repeater Event\r\n\r\n```cpp\r\n// Create emitter\r\nwheel::emitter Events;\r\n\r\n// Add event where handlers run a configurable number of times\r\nEvents\r\n  .create\u003cvoid (int)\u003e(\"repeater\")\r\n  .meta_accepts\u003cint\u003e()\r\n  .set_interceptor\r\n    ([](wheel::handle \u0026Handle, function\u003cvoid (int)\u003e Target, int Unused) {\r\n      auto [ N ] = Events[\"repeater\"].get_meta\u003cint\u003e();\r\n      for (int I = 0; I \u003c N; ++ I)\r\n        Target(I);\r\n    });\r\n\r\n// Insert a handler whose body will be repeated five times\r\nEvents[\"repeater\"](5) = [](int I) {\r\n  printf(\"One: %d/5\\n\", I + 1);\r\n};\r\n\r\n// Insert a handler whose body will be repeated two times\r\nEvents[\"repeater\"](2) = [](int I) {\r\n  printf(\"Two: %d/2\\n\", I + 1);\r\n};\r\n\r\n// Call all \"repeater\" handlers (`int` argument is still required to conform\r\n// with the event type)\r\nEvents[\"repeater\"].emit(0);\r\n// Output:\r\n// $ One: 1/5\r\n// $ One: 2/5\r\n// $ One: 3/5\r\n// $ One: 4/5\r\n// $ One: 5/5\r\n// $ Two: 1/2\r\n// $ Two: 2/2\r\n```\r\n\r\n### Tick Event\r\n\r\n```cpp\r\n// Implement limiter constraining the number of calls to N number of calls over\r\n// a specified time period. We assume that now() is a function that returns the\r\n// current time as a `double` in seconds.\r\nstruct limiter {\r\n  double TimePerCall;\r\n  double PreviousTime;\r\n  \r\n  limiter (int NCalls, int TimePeriod)\r\n    : TimePerCall(TimePeriod / NCalls),\r\n      PreviousTime(now()) {\r\n    // ...\r\n  } // limiter()\r\n\r\n  int n () {\r\n    double Time = now();\r\n    double DeltaTime = Time - PreviousTime;\r\n    int N = floor(DeltaTime / TimePerCall);\r\n    PreviousTime += N * TimePerCall;\r\n    return N;\r\n  } // n()\r\n}; // struct limiter\r\n\r\n// Create emitter\r\nwheel::emitter Events;\r\n\r\n// Add event that is called N times over a specified time period\r\nEvents.create\u003cvoid ()\u003e(\"tick\");\r\n\r\n// Retrieve reference to \"tick\" event for faster access\r\nwheel::emitter\u003c\u003e::event \u0026TickEvent = \u0026hooks[\"tick\"];\r\n\r\n// Implement \"tick\" event\r\nTickEvent\r\n  .meta_accepts\u003cint, double\u003e()\r\n  .set_on_insert([\u0026](wheel::handle \u0026Handle) {\r\n    auto [ N, TimePeriod ] = TickEvent.get_meta\u003cint, double\u003e(Handle);\r\n    TickEvent.set_meta(Handle,limiter_t(N, TimePeriod));\r\n  })\r\n  .set_interceptor([\u0026](wheel::handle \u0026Handle, function\u003cvoid ()\u003e Target) {\r\n    auto \u0026[ Limiter ] = TickEvent.get_meta\u003climiter\u003e(Handle);\r\n    int N = Limiter.n();\r\n    for (int I = 0; I \u003c N; ++ I)\r\n      Target();\r\n  });\r\n\r\n// Add handlers\r\nTickEvent(60, 1.0) = []() { /* Will be called 60 times per second */ };\r\nTickEvent(30, 2.0) = []() { /* Will be called 15 times per second */ };\r\n\r\n// Main loop. We assume the existance of an `IsRunning` boolean that is `true`\r\n// so long as the application is running.\r\nwhile (IsRunning) {\r\n  TickEvent.emit();\r\n}\r\n```\r\n\r\n## Documentation\r\n- namespace wheel\r\n  - [struct wheel::exception](#struct-wheelexception)\r\n  - [struct wheel::wrong_type](#struct-wheelwrong_type)\r\n  - [struct wheel::wrong_arguments](#struct-wheelwrong_arguments)\r\n  - [struct wheel::no_such_event](#struct-wheelno_such_event)\r\n  - [struct wheel::emitter](#struct-wheelemitter)\r\n    - [struct emitter::event](#struct-emitterevent)\r\n      - [using event::weight](#using-eventweight)\r\n      - [using event::on_function](#using-eventon_function)\r\n      - [event::get_function()](#eventget_function)\r\n      - [event::get_meta()](#eventget_meta)\r\n      - [event::set_meta()](#eventset_meta)\r\n      - [event::is_meta_of()](#eventis_meta_of)\r\n      - [event::meta_accepts()](#eventmeta_accepts)\r\n      - [event::meta_accepts_anything()](#eventmeta_accepts_anything)\r\n      - [event::set_on_insert()](#eventset_on_insert)\r\n      - [event::unset_on_insert()](#eventunset_on_insert)\r\n      - [event::set_on_remove()](#eventset_on_remove)\r\n      - [event::unset_on_remove()](#eventunset_on_remove)\r\n      - [event::set_interceptor()](#eventset_interceptor)\r\n      - [event::unset_interceptor()](#eventunset_interceptor)\r\n      - [event::operator()()](#eventoperator)\r\n      - [event::insert()](#eventinsert)\r\n      - [event::operator=()](#eventoperator-1)\r\n      - [event::operator*()](#eventoperator-2)\r\n      - [event::remove()](#eventremove)\r\n      - [event::emit()](#eventemit)\r\n      - [event::clear()](#eventclear)\r\n      - [event::length()](#eventlength)\r\n      - [event::empty()](#eventempty)\r\n    - [emitter::operator*()](#emitteroperator)\r\n    - [emitter::create()](#emittercreate)\r\n    - [emitter::retire()](#emitterretire)\r\n    - [emitter::contains()](#emittercontains)\r\n    - [emitter::operator\\[\\]()](#emitteroperator-1)\r\n  - [using wheel::handle](#using-wheelhandle)\r\n- [with()](#with)\r\n\r\n##\r\n\r\n### struct wheel::exception\r\n```cpp\r\nstruct exception;\r\n```\r\nThis struct serves as the root of the WHEEL exception hierarchy, allowing applications to catch all WHEEL-specific exceptions through a single catch block. All custom exceptions in the WHEEL framework extend this struct.\r\n\r\n##\r\n\r\n### struct wheel::wrong_type\r\n```cpp\r\nstruct wrong_type;\r\n```\r\nThrown when a function of incorrect type is used. Includes details about the actual type that was provided and the accepted types that should have been used instead.\r\n\r\n##\r\n\r\n### struct wheel::wrong_arguments\r\n```cpp\r\nstruct wrong_arguments;\r\n```\r\nThrown when emit() receives arguments contrasting the underlying accepted function type. This could include a mismatch in arity or argument types. This type must be created with the static factory create() method.\r\n\r\n##\r\n\r\n### struct wheel::no_such_event\r\n```cpp\r\nstruct no_such_event;\r\n```\r\nThrown if no event by the given name exists.\r\n\r\n##\r\n\r\n### struct wheel::emitter\r\n```cpp\r\ntemplate\u003ctypename DefaultEventType = void\u003e\r\nstruct emitter;\r\n```\r\nStores multiple event types that are accessible by name, where new such types can be registered, have callbacks added to them, and executed.\r\n\r\n#### Template Parameters\r\n- `DefaultEventType`: If non-void, will create new event on access to an event that does not exist.\r\n\r\n##\r\n\r\n### struct emitter::event\r\n`movable`\r\n```cpp\r\nstruct event;\r\n```\r\nConfigurable event structure enabling callback modification. Events can be configured with before/after hooks that run when callbacks are added or removed, or with an interceptor capable of changing the arguments that are passed through or make the callback run multiple times or not at all.\r\n\r\n##\r\n\r\n### using event::weight\r\n```cpp\r\nusing weight = unsigned short;\r\n```\r\nSpecifies the level of precedence a callback takes in the order of execution when the event is emitted with emit().\r\n\r\n##\r\n\r\n### using event::on_function\r\n```cpp\r\nusing on_function = function\u003cvoid (handle \u0026)\u003e;\r\n```\r\nThe function type used for set_on_insert() and set_on_remove(), which define the behaviour that happens before and respectively after a callback function is added or removed.\r\n\r\n##\r\n\r\n### event::get_function()\r\n```cpp\r\ntemplate\u003ctypename T\u003e\r\nfunction\u003cT\u003e \u0026get_function (handle \u0026Handle);\r\n```\r\nRetrieves function associated with handle.\r\n\r\n#### Template Parameters\r\n- `T`: Type the function is in.\r\n\r\n#### Parameters\r\n- `Handle`: Handle from which a lambda will be retrieved.\r\n\r\n#### Returns\r\nLambda object associated with hanled.\r\n\r\n#### Throws\r\n`wrong_type` if `T` does not match the underlying lambda type.\r\n\r\n##\r\n\r\n### event::get_meta()\r\n```cpp\r\ntemplate\u003ctypename... Args\u003e\r\ntuple\u003cArgs...\u003e \u0026get_meta (handle \u0026Handle);\r\n```\r\nRetrieves metadata tuple with specified types.\r\n\r\n#### Template Parameters\r\n- `Args`: Types that the metadata tuple stores.\r\n\r\n#### Parameters\r\n- `Handle`: Refers to the callback that metadata will be retrieved from.\r\n\r\n#### Returns\r\nMetadata tuple associated with the specified handle.\r\n\r\n#### Throws\r\n`wrong_type` if provided `Args` do not match the underlying types of the metadata for `Handle`.\r\n\r\n##\r\n\r\n### event::set_meta()\r\n```cpp\r\ntemplate\u003ctypename... Args\u003e\r\nvoid set_meta (handle \u0026Handle, Args... Arguments);\r\n```\r\nRegenerate the metadata `tuple` with new values once there is a handle with associated metadata. To generate metadata for the right thereafter inserted callback, instead use operator()().\r\n\r\n#### Parameters\r\n- `Handle`: Refers to the callback for which metadata should be regenerated.\r\n\r\n#### Returns\r\nArguments that the new metadata tuple should be made from.\r\n\r\n##\r\n\r\n### event::is_meta_of()\r\n```cpp\r\ntemplate\u003ctypename... Args\u003e\r\nbool is_meta_of (handle \u0026Handle);\r\n```\r\nChecks if the types of the metadata object associated with `Handle` is the specified arguments `Args`.\r\n\r\n#### Template Parameters\r\n- `Args`: Types we are comparing with the metadata type to see if they match.\r\n\r\n#### Parameters\r\n- `Handle`: Handle associated with a callback function.\r\n\r\n#### Returns\r\n`true` if the types of metadata match `Args` and `false` otherwise.\r\n\r\n##\r\n\r\n### event::meta_accepts()\r\n```cpp\r\ntemplate\u003ctypename... Args\u003e\r\nevent \u0026meta_accepts ();\r\n```\r\nCall this once for each type the metadata can have. If the user has not specified metadata using operator()() that meets the criteria, the insert() and operator=() functions will throw an exception.\r\n\r\n#### Template Parameters\r\n- `Args`: Types of a single accepted metadata type.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::meta_accepts_anything()\r\n```cpp\r\nevent \u0026meta_accepts_anything ();\r\n```\r\nThis only needs to be called if meta_accepts() has already been called, and the desired behaviour is to undo all hitherto specified accepted meta types, making operator() revert to accept any metadata types whatever.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::set_on_insert()\r\n```cpp\r\ntemplate\u003ctypename F\u003e\r\nrequires same_as\u003ctypename function_traits\u003cF\u003e::function, on_function\u003e\r\nevent \u0026set_on_insert (F Function);\r\n```\r\nSets a function that will run whenever a callback function is inserted into the event.\r\n\r\n#### Parameters\r\n- `Function`: Function to be run when a callback is inserted.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::unset_on_insert()\r\n```cpp\r\nevent \u0026unset_on_insert ();\r\n```\r\nUnsets the function previously set through set_on_insert().\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::set_on_remove()\r\n```cpp\r\ntemplate\u003ctypename F\u003e\r\nrequires same_as\u003ctypename function_traits\u003cF\u003e::function, on_function\u003e\r\nevent \u0026set_on_remove (F Function);\r\n```\r\nSets a function that will run right before a callback function is removed from the event.\r\n\r\n#### Parameters\r\n- `Function`: Function to be run when a callback is removed.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::unset_on_remove()\r\n```cpp\r\nevent \u0026unset_on_remove ();\r\n```\r\nUnsets the function previously set through set_on_remove().\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::set_interceptor()\r\n```cpp\r\ntemplate\u003ctypename F\u003e\r\nevent \u0026set_interceptor (F Function);\r\n```\r\nSets a function that will wrap every callback function that is inserted past this point. The handler is inputted as a parameter to the interceptor, so that the interceptor can modify the behaviour surrounding the handler as it sees fit.\r\n\r\n#### Parameters\r\n- `Function`: Interceptor that wraps handlers inserted past this point.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n#### Throws\r\n`wrong_type` if `F` is not of a valid interceptor function type.\r\n\r\n##\r\n\r\n### event::unset_interceptor()\r\n```cpp\r\nevent \u0026unset_interceptor ();\r\n```\r\nUnsets the function previously set through set_interceptor().\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::operator()()\r\n```cpp\r\ntemplate\u003ctypename... Args\u003e\r\nevent \u0026operator() (Args... Arguments);\r\n```\r\nGenerates a metadata `tuple` that can be used to communicate with the event creator. The generated tuple will be attached to the callback that is inserted next.\r\n\r\n#### Parameters\r\n- `Arguments`: Arguments the metadata `tuple` should be created from.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::insert()\r\n`thread-safe`\r\n```cpp\r\ntemplate\u003ctypename F, typename = enable_if_callable\u003cF\u003e\u003e\r\nevent \u0026insert (const F \u0026Function, weight Weight = 0);\r\n```\r\nInserts a callback to be outputted when emit() is called by the event creator.\r\n\r\n#### Parameters\r\n- `Function`: Handler that will become part of the event, that will run whenever emit() is called.\r\n- `Weight`: Priority level for `Function` in the handler list.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n#### Throws\r\n- `wrong_type` if `F` is not of the accepted function type.\r\n- `wrong_type` if the user-provided metadata is of a type that is not accepted.\r\n\r\n##\r\n\r\n### event::operator=()\r\n```cpp\r\ntemplate\u003ctypename F, typename = enable_if_callable\u003cF\u003e\u003e\r\nvoid operator= (const F \u0026Function);\r\n```\r\nSyntactic sugar for callback insertion. Same as insert() but without the possibility of specifying a weight for the callback in the list of handlers.\r\n\r\n#### Parameters\r\n- `Function`: Handler that will become part of the event, that will run whenever emit() is called.\r\n\r\n##\r\n\r\n### event::operator*()\r\n```cpp\r\nhandle operator* ();\r\n```\r\nRetrieves a handle to the last added callback. Following the insertion of a callback into the event is the only opportunity to retrieve such a handle.\r\n\r\n#### Returns\r\nHandle to the last added callback function.\r\n\r\n##\r\n\r\n### event::remove()\r\n`thread-safe`\r\n```cpp\r\nevent \u0026remove (handle \u0026Handle);\r\n```\r\nRemoves a callback function per its handle, which was retrieved by dereferencing `*this` after the handler insertion.\r\n\r\n#### Parameters\r\n- `Handle`: Handle associated with a callback function.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::emit()\r\n`thread-safe`\r\n```cpp\r\ntemplate\u003ctypename... Args\u003e\r\nvoid emit (Args... Arguments);\r\n```\r\nRuns all callback functions (or handlers) of the event.\r\n\r\n#### Parameters\r\n- `Arguments`: Arguments that will be forwarded to all handlers.\r\n\r\n#### Throws\r\n`wrong_arguments` if the arguments inputted do not correspond to the event argument types.\r\n\r\n##\r\n\r\n### event::clear()\r\n`thread-safe`\r\n```cpp\r\nevent \u0026clear ();\r\n```\r\nRemoves all callback functions from this event.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### event::length()\r\n`thread-safe`\r\n```cpp\r\nsize_t length ();\r\n```\r\nThe number of callback functions that are managed and run by the event.\r\n\r\n#### Returns\r\nNumber of functions stored in this event. This includes deferred inserts (callbacks that have not been inserted yet because emit() was running when it was added and it has not finished running).\r\n\r\n##\r\n\r\n### event::empty()\r\n`thread-safe`\r\n```cpp\r\nbool empty ();\r\n```\r\nChecks if there are any callbacks managed by the event.\r\n\r\n#### Returns\r\n`true` if length() returns `0`, and `false` otherwise.\r\n\r\n##\r\n\r\n### emitter::operator*()\r\n```cpp\r\nhandle operator* ();\r\n```\r\nAlias: event::operator*().\r\n\r\n##\r\n\r\n### emitter::create()\r\n```cpp\r\ntemplate\u003ctypename Q\u003e\r\nevent \u0026create (string Name);\r\n```\r\nCreates an event by name `Name` that can be configured using the available methods in the returned `event`. Then, emit() can be used to call all the user added callbacks (or handlers).\r\n\r\n#### Parameters\r\n- `Name`: Name of the event to be created.\r\n\r\n#### Returns\r\nNewly created event that is now tracked by the emitter.\r\n\r\n##\r\n\r\n### emitter::retire()\r\n```cpp\r\nemitter \u0026retire (string Name);\r\n```\r\nRetires an event, removing it from the managed events.\r\n\r\n#### Parameters\r\n- `Name`: Name of the event to be removed.\r\n\r\n#### Returns\r\n`*this` for chaining.\r\n\r\n##\r\n\r\n### emitter::contains()\r\n```cpp\r\nbool contains (string Name);\r\n```\r\nCheck if an event exists.\r\n\r\n#### Parameters\r\n- `Name`: Name of the event to be checked if it exists.\r\n\r\n#### Returns\r\n`true` if an event by name `Name` exists.\r\n\r\n##\r\n\r\n### emitter::operator\\[\\]()\r\n```cpp\r\nevent \u0026operator[] (string Name);\r\n```\r\nRetrieve an event by name, or insert one if it does not exist before retrieving it if the emitter has its `DefaultEventType` specified.\r\n\r\n#### Parameters\r\n- `Name`: Name of the event to be retrieved.\r\n\r\n#### Returns\r\nEvent by name `Name` if it exists or was implicitly created.\r\n\r\n#### Throws\r\n`no_such_event` if no event by name `Name` exists.\r\n\r\n##\r\n\r\n### using wheel::handle\r\n```cpp\r\nusing handle = shared_ptr\u003cint\u003e;\r\n```\r\nThe type of a handle used for the removal and otherwise identification of callbacks inside an event.\r\n\r\n##\r\n\r\n### with()\r\n```cpp\r\n#define with(Struct, ...)\r\n```\r\nA way to initialize an inline struct with some starting values.\r\n\r\n#### Parameters\r\n- `Struct`: Curly-brace-enclosed struct body.\r\n- `...`: Initial values of the struct fields.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwye-sh%2Fwheel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwye-sh%2Fwheel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwye-sh%2Fwheel/lists"}