reactor-cpp icon indicating copy to clipboard operation
reactor-cpp copied to clipboard

Sdk

Open OmerMajNition opened this issue 9 months ago • 3 comments

What this SDK provides

  • Lazy construction of child reactors
  • Lazy construction of child reactor banks
  • Lazy construction of multi-ports
  • Simplified, single line wiring syntax
  • Simplified reaction definition, function can be a lambda function or a member function of reactor class
  • Parameter definition in the form of metadata for self explanatory reactor parameters as well as configurability via a config map of whole topology

Features missing so far, work in progress

  • After delay
  • Enclaves
  • Physical connection
  • Interleaved connection

Building cd reactor-cpp mkdir build && cd build && cmake .. make -j && make install

Examples and Tests examples and test folders have use cases that help understand the concepts.

Immediate next item

  • Complete the wiring
  • Homogeneous config
  • Generate config files (header and source) by SDK

OmerMajNition avatar Feb 19 '25 23:02 OmerMajNition

@cmnrd, please review the latest changes, now reactions can only be defined in ReactionInternal class that user would have to inherit from. Once user defines reactions with triggers, dependencies and effects they can not access any other unintended LF entity inside reaction bodies.

State variables would also be defined in this class available to reactions only.

OmerMajNition avatar Mar 12 '25 20:03 OmerMajNition

@cmnrd, please review the latest changes, now reactions can only be defined in ReactionInternal class that user would have to inherit from. Once user defines reactions with triggers, dependencies and effects they can not access any other unintended LF entity inside reaction bodies.

State variables would also be defined in this class available to reactions only.

If I understand correctly, this basically replicates the inner class mechanism that is used by the LF code generator. In case of LF, this does work well because the code generator is in full control of defining the scope. Here we are talking about an SDK and the user is in charge of defining the scope and it seems trivial to break out of the intended pattern (both intentionally and by accident). So I am not seeing how the inner class actually helps. Can you elaborate on what exactly is prevented and how?

I am also not sure what LF entities you are referring to. How is LF involved in this?

cmnrd avatar Mar 20 '25 21:03 cmnrd

Yes, it does resemble inner class mechanism. How this differs from inner class

  • ReactionChamber centralizes reaction definition with triggers, effects, dependencies and lamdba/member function at a single place in the code (add_reactions function of ReactionChamber class is the place to define all the reactions of the reactor)
  • Lets user define reaction body as a lambda function (making sure they still only have access to intended triggers, effects, and dependencies)

With LF entities I meant logical actions, ports and things defined in Users' reactor class, that they want to expose to reactions functions.

OmerMajNition avatar Mar 25 '25 12:03 OmerMajNition

Closing the PR due to inactivity and the concerns stated earlier.

cmnrd avatar May 20 '25 12:05 cmnrd