Symmetri
Loading...
Searching...
No Matches
types.h File Reference
#include <chrono>
#include <string>
#include <unordered_map>
#include <vector>
#include "symmetri/colors.hpp"

Go to the source code of this file.

Classes

struct  symmetri::Event
 This struct defines a subset of data that we associate with the result of firing a transition. More...
 
struct  symmetri::DirectMutation
 A DirectMutation is a synchronous no-operation function. It simply mutates the mutation on the petri net executor loop. This way the deferring to the threadpool and back to the petri net loop is avoided. More...
 

Typedefs

using symmetri::Place = std::string
 
using symmetri::Transition = std::string
 
using symmetri::Clock
 
using symmetri::Eventlog = std::vector<Event>
 
using symmetri::Net
 
using symmetri::Marking
 
using symmetri::PriorityTable
 

Functions

bool symmetri::isSynchronous (const DirectMutation &)
 A DirectMutation is a synchronous Callback that always completes.
 
Token symmetri::fire (const DirectMutation &)
 fire for a direct mutation does no work at all.
 
Token symmetri::fire (const PetriNet &)
 The fire specialization for a PetriNet runs the Petri net until it completes, deadlocks or is preempted. It returns an event log along with the result state.
 
void symmetri::cancel (const PetriNet &)
 The cancel specialization for a PetriNet breaks the PetriNets' internal loop. It will not queue any new Callbacks and it will cancel all child Callbacks that are running. The cancel function will return before the PetriNet is preempted completely.
 
void symmetri::pause (const PetriNet &)
 The pause specialization for a PetriNet prevents new fire-able Callbacks from being scheduled. It will also pause all child Callbacks that are running. The pause function will return before the PetriNet will pause.
 
void symmetri::resume (const PetriNet &)
 The resume specialization for a PetriNet undoes pause and puts the PetriNet back in a normal state where all fireable Callback are scheduled for execution. The resume function will return before the PetriNet will resume.
 
Eventlog symmetri::getLog (const PetriNet &)
 Get the Log object.
 

Typedef Documentation

◆ Clock

Initial value:
std::chrono::steady_clock

The clock definition in Symmetri is the steady clock for monotonic reasons

◆ Eventlog

using symmetri::Eventlog = std::vector<Event>

The eventlog is simply a log of events, sorted by their stamp

◆ Marking

Initial value:
std::vector<std::pair<Place, Token>>

The Marking is a vector pairs in which the Place describes in which place the Token is.

◆ Net

Initial value:
std::unordered_map<
std::pair<std::vector<std::pair<Place, Token>>,
std::vector<std::pair<Place, Token>>>>
std::string Transition
Definition types.h:14

This is the multiset definition of a Petri net. For each transition there is a pair of lists for colored input and output places

◆ Place

using symmetri::Place = std::string

The string representation of the place the Petri net definition

◆ PriorityTable

Initial value:
std::vector<std::pair<Transition, int8_t>>

Priority is limited from -128 to 127

◆ Transition

using symmetri::Transition = std::string

The string representation of the transition the Petri net definition

Function Documentation

◆ cancel()

void symmetri::cancel ( const PetriNet & app)

The cancel specialization for a PetriNet breaks the PetriNets' internal loop. It will not queue any new Callbacks and it will cancel all child Callbacks that are running. The cancel function will return before the PetriNet is preempted completely.

Returns
void

◆ fire() [1/2]

Token symmetri::fire ( const DirectMutation & )

fire for a direct mutation does no work at all.

Returns
Token

◆ fire() [2/2]

Token symmetri::fire ( const PetriNet & app)

The fire specialization for a PetriNet runs the Petri net until it completes, deadlocks or is preempted. It returns an event log along with the result state.

Returns
Token

◆ getLog()

Eventlog symmetri::getLog ( const PetriNet & app)

Get the Log object.

Returns
Eventlog