forked from jacyara/GenESyS-Reborn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Resource.h
89 lines (76 loc) · 2.23 KB
/
Resource.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Resource.h
* Author: cancian
*
* Created on 21 de Agosto de 2018, 16:52
*/
#ifndef RESOURCE_H
#define RESOURCE_H
#include "ModelInfrastructure.h"
#include "LinkedBy.h"
#include "StatisticsCollector.h"
#include "Model.h"
class Resource : public ModelInfrastructure, public LinkedBy {
public:
enum ResourceType {
rtSET, rtRESOURCE
};
enum ResourceRule {
rrRANDOM, rrCICLICAL, rrESPECIFIC, rrSMALLESTBUSY, rrLARGESTREMAININGCAPACITY
};
enum ResourceState {
rsIDLE, rsBUSY, rsFAILED, rsINACTIVE, rsOTHER
};
public:
Resource(Model* model);
Resource(const Resource& orig);
virtual ~Resource();
public:
virtual std::string show();
public:
void seize(unsigned int quantity, double tnow);
void release(unsigned int quantity, double tnow);
public: // g&s
void setResourceState(ResourceState _resourceState);
ResourceState getResourceState() const;
void setCapacity(unsigned int _capacity);
unsigned int getCapacity() const;
void setCostBusyHour(double _costBusyHour);
double getCostBusyHour() const;
void setCostIdleHour(double _costIdleHour);
double getCostIdleHour() const;
void setCostPerUse(double _costPerUse);
double getCostPerUse() const;
public: // gets
unsigned int getNumberBusy() const;
unsigned int getNumberOut() const;
protected:
virtual void _loadInstance(std::list<std::string> words);
virtual std::list<std::string>* _saveInstance();
virtual bool _verifySymbols(std::string* errorMessage);
private:
unsigned int _capacity = 1;
double _costBusyHour = 1.0;
double _costIdleHour = 1.0;
double _costPerUse = 1.0;
ResourceState _resourceState = ResourceState::rsIDLE;
//Queue* _queue;
private: // only gets
unsigned int _numberBusy = 0;
unsigned int _numberOut = 0;
private: // not gets nor sets
unsigned int _seizes = 0;
double _lastTimeSeized = 0.0; // to check
double _whenSeized; // same as last? check
private:
StatisticsCollector* _cstatTimeSeized = new StatisticsCollector("Time Seized");
// aCSTATTimeSeizedID: word;
//aFailures: TStringList;
//std::list<Failure*>* _failures;
};
#endif /* RESOURCE_H */