2
* To change this license header, choose License Headers in Project Properties.
3
* To change this template file, choose Tools | Templates
4
* and open the template in the editor.
8
* File: SuccessorGenerator.h
9
* Author: Peter G. Jensen
11
* Created on 30 March 2016, 19:50
14
#ifndef SUCCESSORGENERATOR_H
15
#define SUCCESSORGENERATOR_H
18
#include "Structures/State.h"
21
namespace PetriEngine {
22
class SuccessorGenerator {
24
SuccessorGenerator(const PetriNet& net);
25
SuccessorGenerator(const PetriNet& net, std::vector<std::shared_ptr<PQL::Condition> >& queries);
26
virtual ~SuccessorGenerator();
27
void prepare(const Structures::State* state);
28
bool next(Structures::State& write);
31
return _suc_tcounter -1;
34
const MarkVal* parent() const {
35
return _parent->marking();
41
* Checks if the conditions are met for fireing t, if write != NULL,
42
* then also consumes tokens from write while checking
43
* @param t, transition to fire
44
* @param write, marking to consume from (possibly NULL)
45
* @return true if t is fireable, false otherwise
47
bool checkPreset(uint32_t t);
50
* Consumes tokens in preset of t without from marking write checking
51
* @param write, a marking to consume from
52
* @param t, a transition to fire
54
void consumePreset(Structures::State& write, uint32_t t);
57
* Produces tokens in write, given by t
58
* @param write, a marking to produce to
59
* @param t, a transition to fire
61
void producePostset(Structures::State& write, uint32_t t);
65
const Structures::State* _parent;
66
uint32_t _suc_pcounter;
67
uint32_t _suc_tcounter;
69
friend class ReducingSuccessorGenerator;
73
#endif /* SUCCESSORGENERATOR_H */