Symmetri
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1#pragma once
2
5#include <chrono>
6#include <string>
7#include <unordered_map>
8#include <vector>
9
10#include "symmetri/colors.hpp"
11namespace symmetri {
12using Place = std::string;
14using Transition = std::string;
16using Clock =
17 std::chrono::steady_clock;
19
25struct Event {
26 std::string case_id;
27 std::string transition;
29 Clock::time_point stamp;
30};
31
32using Eventlog = std::vector<Event>;
34
35using Net = std::unordered_map<
37 std::pair<std::vector<std::pair<Place, Token>>,
38 std::vector<std::pair<Place, Token>>>>;
45
46using Marking =
47 std::vector<std::pair<Place, Token>>;
50
52 std::vector<std::pair<Transition, int8_t>>;
54
62class PetriNet;
63
69bool isSynchronous(const DirectMutation &);
70
77
85Token fire(const PetriNet &);
86
95void cancel(const PetriNet &);
96
103void pause(const PetriNet &);
104
111void resume(const PetriNet &);
112
118Eventlog getLog(const PetriNet &);
119
120} // namespace symmetri
Token fire(const T &callback)
Generates a Token based on what kind of information the Callback returns.
Definition callback.h:64
Eventlog getLog(const T &)
Get the Log object. By default it returns an empty vector.
Definition callback.h:82
bool isSynchronous(const T &)
Checks if the callback is synchronous. Synchronous callbacks are immediately executed inside the Petr...
Definition callback.h:21
void resume(const T &)
Templates a resume action for a Callback. By default it does nothing and not resume the Callback.
Definition callback.h:52
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:34
void pause(const T &)
Implements a pause action for a Callback. By default it does nothing and not pause the Callback.
Definition callback.h:43
PetriNet exposes the possible constructors to create PetriNets. It also allows the user to register a...
Definition symmetri.h:27
Tokens are elements that can reside in places. Tokens can have a color which makes them distinguishab...
Definition colors.hpp:104
A DirectMutation is a synchronous no-operation function. It simply mutates the mutation on the petri ...
Definition types.h:61
This struct defines a subset of data that we associate with the result of firing a transition.
Definition types.h:25
Token state
The result of the event.
Definition types.h:28
std::string transition
The transition that generated the event.
Definition types.h:27
Clock::time_point stamp
The timestamp of the event.
Definition types.h:29
std::string case_id
The case_id of this event.
Definition types.h:26
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::string Place
Definition types.h:12
std::unordered_map< Transition, std::pair< std::vector< std::pair< Place, Token > >, std::vector< std::pair< Place, Token > > > > Net
Definition types.h:35
std::string Transition
Definition types.h:14
std::chrono::steady_clock Clock
Definition types.h:16