LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
wfn_place.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_API_WFN_WFN_PLACE_H
6#define LINE_API_WFN_WFN_PLACE_H
7
8/**
9 * @file
10 * @ingroup api_wfn
11 * A place of a WorkflowNet.
12 *
13 * The initial marking is informational: every analysis of the net starts from
14 * k tokens in the source place, as WF-net soundness does.
15 *
16 * MATLAB twin: matlab/src/api/wfn/WFNPlace.m
17 */
18
19#include <cstddef>
20#include <string>
21
22#include "line/util/error.h"
23
24namespace line {
25namespace wfn {
26
27class WorkflowNet;
28
29class WFNPlace {
30public:
31 const std::string& name() const { return name_; }
32 /** 0-based position in `WorkflowNet::places()`. */
33 std::size_t index() const { return index_; }
34 double initial_marking() const { return initial_marking_; }
35
36 /** `setInitialMarking(m)`. */
37 void set_initial_marking(double marking) {
38 if (marking < 0)
39 throw InputError(ErrorKind("Argument"), "Initial marking cannot be negative.");
40 initial_marking_ = marking;
41 }
42
43private:
44 friend class WorkflowNet;
45 WFNPlace(const std::string& name, std::size_t index, double initial_marking)
46 : name_(name), index_(index), initial_marking_(initial_marking) {}
47
48 std::string name_;
49 std::size_t index_;
50 double initial_marking_;
51};
52
53} // namespace wfn
54} // namespace line
55
56#endif // LINE_API_WFN_WFN_PLACE_H
InputError(const std::string &what)
Definition error.h:105
std::size_t index() const
0-based position in WorkflowNet::places().
Definition wfn_place.h:33
const std::string & name() const
Definition wfn_place.h:31
void set_initial_marking(double marking)
setInitialMarking(m).
Definition wfn_place.h:37
friend class WorkflowNet
Definition wfn_place.h:44
double initial_marking() const
Definition wfn_place.h:34
The exception types the port throws.
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:52
ErrorKind(std::string n)
Definition error.h:39