You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently there are 2 ways to inject dependencies:
sm::process_event(auto event) call, which only inject the event into the guard/action
sm constructor, which will inject extra context object to guard/action by storing the context inside sm object.
normally it works fine, however, in some use case, it would be great to iject the context object through method call instead of storing it in the object to save sm memory footprint.
for example, suppose there are tens of thousands of HTTP client state machine objects managered by a HTTP server. It is a waste of memory to store the same context pointer in each and every one of the sm object through its constructor. It is better to inject the context through method call, like process_event()
currently, only a single event object could be injected through process_event(). in this case we could still embeded the context pointer/reference inside the event object like sm.process_event(PingEvent{context}). It's functional, though not idea.
it could be great if sml could inject extra parameters passed into process_event, something like:
currently there are 2 ways to inject dependencies:
sm::process_event(auto event)
call, which only inject theevent
into the guard/actionsm
constructor, which will inject extra context object to guard/action by storing the context inside sm object.normally it works fine, however, in some use case, it would be great to iject the context object through method call instead of storing it in the object to save sm memory footprint.
for example, suppose there are tens of thousands of HTTP client state machine objects managered by a HTTP server. It is a waste of memory to store the same context pointer in each and every one of the sm object through its constructor. It is better to inject the context through method call, like
process_event()
currently, only a single
event
object could be injected throughprocess_event()
. in this case we could still embeded the context pointer/reference inside the event object likesm.process_event(PingEvent{context})
. It's functional, though not idea.it could be great if sml could inject extra parameters passed into process_event, something like:
or maybe in other ways, like:
or use a local proxy object
not sure if it doable ...
The text was updated successfully, but these errors were encountered: