No history found.

README.md:

ohm

Local message broker

Interface

#pragma once

#include <functional>
#include <map>
#include <memory>
#include <set>

#include <lib/dynamo/src/interface.h>

namespace om636 {
namespace control {

    template <typename T, typename... U>
    class Emitter {
    public:
        typedef T event_type;
        typedef std::function<void(U...)> callback_type;
        typedef std::shared_ptr<callback_type> listener_type;

        virtual ~Emitter() = default;
        virtual listener_type on(event_type, callback_type) = 0;
        virtual listener_type once(event_type, callback_type) = 0;
        virtual void interupt(event_type, U...) = 0;
    };

    template <typename T, typename... U>
    class Quemitter : public Emitter<T, U...> {

    public:
        typedef Emitter<T, U...> base_type;
        using typename base_type::callback_type;
        using typename base_type::event_type;
        using typename base_type::listener_type;

        virtual ~Quemitter() = default;
        virtual void emit(event_type, U...) = 0;
    };

    template <typename T, typename... U>
    std::shared_ptr<Emitter<T, U...>> make_emitter();

    template <typename T, typename... U>
    std::shared_ptr<Emitter<T, U...>> make_quemitter();

} //control
} // om636

Example

#include <iostream>

#include <tmp/src/test.h>

#include <lib/ohm/src/index.h>

int main()
{
    using namespace om636::control;
    using namespace std;

    auto e = make_emitter<string, int>();
    auto l = e->on("run", [](int) {
        std::cout << "run" << std::endl;
    });
    e->interupt("run", 4);
    return 0;
}
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mucbuc/ohm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mucbuc/ohm

Clone this repository using git:
git clone git://git.rocketgit.com/user/mucbuc/ohm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main