LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
wfn_resource.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_RESOURCE_H
6
#define LINE_API_WFN_WFN_RESOURCE_H
7
8
/**
9
* @file
10
* @ingroup api_wfn
11
* A resource shared by the tasks of a WorkflowNet that name it, and by every case.
12
*
13
* MATLAB twin: matlab/src/api/wfn/WFNResource.m
14
*/
15
16
#include <string>
17
18
#include "
line/lang/lang_types.h
"
19
#include "
line/util/error.h
"
20
21
namespace
line
{
22
namespace
wfn
{
23
24
class
WFNResource
{
25
public
:
26
WFNResource
(
const
std::string&
name
,
double
servers
= 1.0,
27
lang::SchedStrategy
scheduling
=
lang::SchedStrategy::FCFS
)
28
: name_(
name
), scheduling_(
scheduling
) {
29
set_servers
(
servers
);
30
}
31
32
const
std::string&
name
()
const
{
return
name_; }
33
double
servers
()
const
{
return
servers_; }
34
lang::SchedStrategy
scheduling
()
const
{
return
scheduling_; }
35
36
void
set_name
(
const
std::string&
name
) { name_ =
name
; }
37
void
set_servers
(
double
servers
) {
38
if
(!(
servers
>= 1))
39
throw
InputError
(
ErrorKind
(
"Argument"
),
"Number of servers must be at least 1."
);
40
servers_ =
servers
;
41
}
42
void
set_scheduling
(
lang::SchedStrategy
scheduling
) { scheduling_ =
scheduling
; }
43
44
private
:
45
std::string name_;
46
double
servers_ = 1.0;
47
lang::SchedStrategy
scheduling_;
48
};
49
50
}
// namespace wfn
51
}
// namespace line
52
53
#endif
// LINE_API_WFN_WFN_RESOURCE_H
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:105
line::wfn::WFNResource::set_scheduling
void set_scheduling(lang::SchedStrategy scheduling)
Definition
wfn_resource.h:42
line::wfn::WFNResource::WFNResource
WFNResource(const std::string &name, double servers=1.0, lang::SchedStrategy scheduling=lang::SchedStrategy::FCFS)
Definition
wfn_resource.h:26
line::wfn::WFNResource::scheduling
lang::SchedStrategy scheduling() const
Definition
wfn_resource.h:34
line::wfn::WFNResource::set_servers
void set_servers(double servers)
Definition
wfn_resource.h:37
line::wfn::WFNResource::name
const std::string & name() const
Definition
wfn_resource.h:32
line::wfn::WFNResource::set_name
void set_name(const std::string &name)
Definition
wfn_resource.h:36
line::wfn::WFNResource::servers
double servers() const
Definition
wfn_resource.h:33
error.h
The exception types the port throws.
lang_types.h
Enumerations and the minimal distribution descriptor shared by the model layer of the C++ port.
line::lang::SchedStrategy
SchedStrategy
Scheduling disciplines, with the values of MATLAB SchedStrategy.
Definition
lang_types.h:185
line::lang::SchedStrategy::FCFS
@ FCFS
Definition
lang_types.h:187
line::wfn
Definition
soundness_report.h:24
line
Conservation laws of a layered queueing network, enumerated from its structure.
Definition
aoi_dist2ph.h:52
line::ErrorKind::ErrorKind
ErrorKind(std::string n)
Definition
error.h:39
include
line
api
wfn
wfn_resource.h
Generated by
1.18.0