{"id":13730736,"url":"https://github.com/dacap/observable","last_synced_at":"2025-04-10T17:50:17.511Z","repository":{"id":48670622,"uuid":"61734786","full_name":"dacap/observable","owner":"dacap","description":"Observer pattern and signals/slots for C++11 projects","archived":false,"fork":false,"pushed_at":"2024-06-10T22:22:18.000Z","size":52,"stargazers_count":78,"open_issues_count":1,"forks_count":29,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-04T19:55:31.090Z","etag":null,"topics":["cpp","multiple-threads","observer-pattern","signal","slot"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dacap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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}},"created_at":"2016-06-22T16:32:32.000Z","updated_at":"2025-03-28T06:57:58.000Z","dependencies_parsed_at":"2024-06-11T00:40:29.912Z","dependency_job_id":null,"html_url":"https://github.com/dacap/observable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacap%2Fobservable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacap%2Fobservable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacap%2Fobservable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacap%2Fobservable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dacap","download_url":"https://codeload.github.com/dacap/observable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262420,"owners_count":21074305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","multiple-threads","observer-pattern","signal","slot"],"created_at":"2024-08-03T02:01:18.769Z","updated_at":"2025-04-10T17:50:17.472Z","avatar_url":"https://github.com/dacap.png","language":"C++","readme":"Observable Library\n==================\n\n*Copyright (C) 2016-2021 David Capello*\n\n[![build](https://github.com/dacap/observable/actions/workflows/build.yml/badge.svg)](https://github.com/dacap/observable/actions/workflows/build.yml)\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)\n\nLibrary to use the observer pattern in C++11 programs with\nobservable/observer classes or signals/slots.\n\nFeatures\n--------\n\n* Generate an observable notification/signal from multiple threads\n* Add/remove observers/slots from multiple threads\n* Erase/disconnect an observer/slot from the same observable notification/signal\n* Reconnect an observer in the same notification\n\nObservable\n----------\n\nAn observable `Widget`:\n\n```cpp\n#include \"obs.h\"\n\nclass WidgetObserver {\npublic:\n  virtual ~WidgetObserver() = 0;\n  virtual void onClick() { }\n};\n\nclass Widget : public obs::observable\u003cWidgetObserver\u003e {\npublic:\n  void processClick() {\n    notify_observers(\u0026WidgetObserver::onClick);\n  }\n};\n```\n\nAn example\n\n```cpp\n#include \"obs.h\"\n\nclass ObserveClick : public WidgetObserver {\npublic:\n  void onClick() override {\n    // Do something...\n  }\n};\n\n...\nObserveClick observer;\nWidget button;\nbutton.add_observer(\u0026observer);\n```\n\nSignal\n------\n\n```cpp\n#include \"obs.h\"\n\nint main() {\n  obs::signal\u003cvoid (int, int)\u003e sig;\n  sig.connect([](int x, int y){ ... });\n  sig(1, 2); // Generate signal\n}\n```\n\nTested Compilers\n----------------\n\n* Visual Studio 2015\n* Xcode 7.3.1 (`-std=c++11`)\n* GCC 4.8.4 (`-std=c++11`)\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdacap%2Fobservable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdacap%2Fobservable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdacap%2Fobservable/lists"}