40 PetriNet(
const std::set<std::string> &petri_net_xmls,
41 const std::string &case_id, std::shared_ptr<TaskSystem> threadpool,
42 const Marking &goal_marking = {},
55 PetriNet(
const Net &net,
const std::string &case_id,
56 std::shared_ptr<TaskSystem> threadpool,
70 const std::string &transition)
const noexcept;
91 template <
typename T,
typename... Args>
93 Args &&...args)
const noexcept {
94 if (impl ==
nullptr || s.empty()) {
97 s.emplace_back(
identity<T>{}, std::forward<Args>(args)...);
98 *getCallbackItr(transition) = std::move(s.back());
134 std::vector<
Callback>::iterator getCallbackItr(
135 const std::
string &transition_name) const;
137 const std::shared_ptr<
Petri> impl;
Token fire(const T &callback)
Generates a Token based on what kind of information the Callback returns.
Definition callback.h:65
Eventlog getLog(const T &)
Get the Log object. By default it returns an empty vector.
Definition callback.h:83
void resume(const T &)
Templates a resume action for a Callback. By default it does nothing and not resume the Callback.
Definition callback.h:53
void cancel(const T &)
The default cancel implementation is naive. It only returns a user-exit state and does nothing to the...
Definition callback.h:35
void pause(const T &)
Implements a pause action for a Callback. By default it does nothing and not pause the Callback.
Definition callback.h:44
Callback is a wrapper around any type that you to tie to a transition. Typically this is an invokable...
Definition callback.h:104
PetriNet exposes the possible constructors to create PetriNets. It also allows the user to register a...
Definition symmetri.h:27
Marking getMarking() const noexcept
Get the Marking object. This function is thread-safe and be called during PetriNet execution.
Definition symmetri.cpp:72
std::function< void()> getInputTransitionHandle(const std::string &transition) const noexcept
By registering a input transition you get a handle to manually force a transition to fire....
Definition symmetri.cpp:39
PetriNet(const std::set< std::string > &petri_net_xmls, const std::string &case_id, std::shared_ptr< TaskSystem > threadpool, const Marking &goal_marking={}, const PriorityTable &priorities={})
Construct a new PetriNet object from a set of paths to PNML- or GRML-files. Since PNML-files do not h...
Definition symmetri.cpp:11
bool reuseApplication(const std::string &case_id)
reuseApplication resets the PetriNet such that the same net can be used again after a cancel call or ...
Definition symmetri.cpp:84
void registerCallback(const std::string &transition, Callback &&callback) const noexcept
The default transition payload (DirectMutation) is overloaded by the Callback supplied for a specific...
Definition symmetri.cpp:58
void registerCallbackInPlace(const std::string &transition, Args &&...args) const noexcept
Construct a Callback of type T in place. This is required for type that are not moveable;.
Definition symmetri.h:92
Tokens are elements that can reside in places. Tokens can have a color which makes them distinguishab...
Definition colors.hpp:107
Petri is a data structure that encodes the Petri net and holds pointers to the thread-pool and the re...
Definition petri.h:115
std::vector< std::pair< Transition, int8_t > > PriorityTable
Definition types.h:51
std::vector< Event > Eventlog
Definition types.h:32
std::vector< std::pair< Place, Token > > Marking
Definition types.h:46
std::unordered_map< Transition, std::pair< std::vector< std::pair< Place, Token > >, std::vector< std::pair< Place, Token > > > > Net
Definition types.h:35