Symmetri
Loading...
Searching...
No Matches
symmetri::PetriNet Class Referencefinal

PetriNet exposes the possible constructors to create PetriNets. It also allows the user to register a Callback to a transition, or to get a handle for input-transitions. More...

#include <symmetri.h>

Public Member Functions

 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 have priorities; you can optionally add a priority table manually.
 
 PetriNet (const Net &net, const std::string &case_id, std::shared_ptr< TaskSystem > threadpool, const Marking &initial_marking, const Marking &goal_marking={}, const PriorityTable &priorities={})
 Construct a new PetriNet object from a net and initial marking.
 
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. It returns a callable handle that will schedule a reducer for the transition, generating tokens. This only works for transitions that have no input places.
 
void registerCallback (const std::string &transition, const Callback &callback) const noexcept
 The default transition payload (DirectMutation) is overload by the Callback supplied for a specific transition.
 
Marking getMarking () const noexcept
 Get the Marking object. This function is thread-safe and be called during PetriNet execution.
 
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 natural termination of the PetriNet. You do need to supply a new case_id which must be different.
 

Friends

Token symmetri::fire (const PetriNet &)
 
void symmetri::cancel (const PetriNet &)
 
void symmetri::pause (const PetriNet &)
 
void symmetri::resume (const PetriNet &)
 
Eventlog symmetri::getLog (const PetriNet &)
 

Detailed Description

PetriNet exposes the possible constructors to create PetriNets. It also allows the user to register a Callback to a transition, or to get a handle for input-transitions.

Constructor & Destructor Documentation

◆ PetriNet() [1/2]

symmetri::PetriNet::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 have priorities; you can optionally add a priority table manually.

Parameters
petri_net_xmls
case_id
threadpool
goal_marking
priorities

◆ PetriNet() [2/2]

symmetri::PetriNet::PetriNet ( const Net & net,
const std::string & case_id,
std::shared_ptr< TaskSystem > threadpool,
const Marking & initial_marking,
const Marking & goal_marking = {},
const PriorityTable & priorities = {} )

Construct a new PetriNet object from a net and initial marking.

Parameters
net
case_id
threadpool
initial_marking
goal_marking
priorities

Member Function Documentation

◆ getInputTransitionHandle()

std::function< void()> symmetri::PetriNet::getInputTransitionHandle ( const std::string & transition) const
noexcept

By registering a input transition you get a handle to manually force a transition to fire. It returns a callable handle that will schedule a reducer for the transition, generating tokens. This only works for transitions that have no input places.

Parameters
transitionthe name of transition
Returns
std::function<void()>

◆ getMarking()

Marking symmetri::PetriNet::getMarking ( ) const
noexcept

Get the Marking object. This function is thread-safe and be called during PetriNet execution.

Returns
std::vector<Place>

◆ registerCallback()

void symmetri::PetriNet::registerCallback ( const std::string & transition,
const Callback & callback ) const
noexcept

The default transition payload (DirectMutation) is overload by the Callback supplied for a specific transition.

Parameters
transitionthe name of transition
callbackthe callback

◆ reuseApplication()

bool symmetri::PetriNet::reuseApplication ( const std::string & case_id)

reuseApplication resets the PetriNet such that the same net can be used again after a cancel call or natural termination of the PetriNet. You do need to supply a new case_id which must be different.

Parameters
case_idneeds to be a new unique id
Returns
true
false

The documentation for this class was generated from the following files: