Giter Club home page Giter Club logo

reactor-cpp's Introduction

A Reactor-Oriented Programming Framework in C++

CI

While reactor-cpp can be used as a standalone framework, it is designed to work in conjunction with Lingua Franca, a polyglot metaprogramming language. Have a look at the Lingua Franca wiki to get an overview of the Reactor model. If you are working with AUTOSAR Adaptive Platform (AP), also have a look at the DEAR framework, which in conjunction with reactor-cpp allows to implement AP Services using the reactor model.

Build

mkdir build
cd build
cmake ..
make

The examples need to be built explicitly. Alternatively, take a look at the CONTRIBUTING.md for building with nix package manager.

Extras

reactor-cpp can be built with tracing support](https://github.com/lf-lang/reactor-cpp/tree/master/tracing). This provides a powerful tool for analyzing and debugging reactor applications.

Contributing

For general guidelines about contributing, see CONTRIBUTING.md.

Documentation

A live version of the latest commit on master is automatically deployed and available online. For tests and other purposes, you can also build the documentation locally.

First doxygen needs to be installed. On Ubuntu or Debian, run: Further, we need several Python packages. Assuming that both python3 and pip3 are set up, run

pip3 --user install -r doc/requirements.txt

If python3 is the default on your system, run:

pip --user install -r doc/requirements.txt

Now we can build the documentation with:

make html

This will output the project documentation in doc/build/html`.

Publications

  • DATE'20: Christian Menard, Andrés Goens, Marten Lohstroh, Jeronimo Castrillon, Achieving Determinism in Adaptive AUTOSAR, Proceedings of the 2020 Design, Automation and Test in Europe Conference (DATE), EDA Consortium, Mar 2020. Also, see the Lingua Franca publications.

reactor-cpp's People

Contributors

cmnrd avatar erlingrj avatar julianrobledom avatar lhstrh avatar tanneberger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

reactor-cpp's Issues

Respond to CTRL+C SIGINT

@zekailin00 found that when he attempts to interrupt the execution of his DeepRacer controller that uses the Cpp target, the program just keeps on running. Both Ctrl + C and Ctrl + D are ignored, and Ctrl + Z lets the program end abruptly (sometimes triggering a segfault). It is important to free up resources at the end of execution, or else things like GPIO pins become inaccessible during subsequent runs of the program, making debugging very onerous. Can we respond to Ctrl + C by initiating the shutdown sequence, like we're doing in reactor-c?

Update to C++20

The LF code generator now requires C++20. Thus we can also upgrade the C++ version in this repo.

Prevent user code from modifying multiport contents

So far, multiports were implemented as plain vectors of ports. #24 introduces a new MultiPort class to organize ports in a smarter way. This is mostly motivated by an optimazation for sparse communication. In the discussion of #24 it became clear that both the old and the new solution allow user code to modify the multiport. For instance users could add or remove ports. Ideally we can use the new dedicated Multiport class to restrict user access and allow only safe operations.

Support direct connections from inputs to outputs without reaction in between

In lf-lang/lingua-franca#1321, @petervdonovan pointed out that the following program fails to execute:

target Cpp

reactor ReactorWithMultiport {
    input[3] in: int

    reaction(in) {=
        for (auto i = 0; i < in.size(); i++) {
            if (in[i].is_present()) {
                std::cout << "received input at port " << i << std::endl;
            }
        }
    =}
}

reactor MultiportSplitter {
    output[3] out: int

    input in0: int
    input in1: int
    input in2: int

    in0, in1, in2 -> out
}

main reactor IndexIntoMultiportInput {
    splitter = new MultiportSplitter()
    receiver = new ReactorWithMultiport()

    splitter.out -> receiver.in

    reaction(startup) -> splitter.in1 {=
        splitter.in1.set(42);
    =}
}

The problem is located here, as there is no case for directly connecting an input to an output of the same reactor.

Provide convenient APIs for handling times

chrono is nice but also pretty awkward to use. We should aim at providing useful shortcuts. For instance, it would be nice to wrap cast operations and provide functions like to_seconds for casting durations.

Move constructor of ReactorElement is broken.

Currently, all reactor elements register a pointer to themselves at the containing reactor. When a ReactorElement is moved, this pointer stored at the containing reactor needs to be updated. This is currently not the case and leads to segfaults if the move constructor is used.

Update terminology

This is closely related to #3. Since the initial design of this runtime, some terminology has changed or we have developed better definitions of certain terms. In the core APIs, many terms should be updated. For instance, BaseAction should better be named BaseTrigger. Also, dependencies and antidependencies of reactions are better named sources and effects.

Update time APIs

Since the original design of the reactor-cpp runtime, some terminology has changed. For instance, we use "tag" to refer to the time stamp of an event (instead of logical time). Also the APIs used to access physical time, logical time, and tags have changed in C and Rust even introduces another API (I think). We should revisit the C++ APIs and bring them up to speed with the other targets.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.