mucbuc / circuit (public) (License: GPLv3) (since 2020-06-28) (hash sha1)
Synchronize container operations for single objects
No history found.

README.md:

circuit

Synchronize container operations for single objects

Interface

#pragma once

#include <memory>

namespace om636 {
namespace circuit {

    template <class T>
    struct Circuit {
        typedef T value_type;

        virtual ~Circuit() = default;
        virtual void push(value_type&&) = 0;
        virtual bool check_pop(value_type&) = 0;
        virtual void wait_pop(value_type&) = 0;
        virtual std::shared_ptr<Circuit> clone() const = 0;
    };

    template <typename T>
    std::shared_ptr<Circuit<T>> make_stack();

    template <typename T>
    std::shared_ptr<Circuit<T>> make_queue();

} // circuit
} // om636

Example

#include <tmp/src/test.h>

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

using namespace std;
using namespace om636::circuit;

int main()
{
    auto s = make_stack<int>();

    s->push(88);
    s->push(77);

    s->wait_pop(i);
    if (s->check_pop(i)) {
    }
}
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/circuit

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

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

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