Line data Source code
1 : #include "allocator.hpp"
2 : #include "defragmentator.hpp"
3 :
4 3 : Allocator::Allocator(std::shared_ptr<Network> network) {
5 3 : this->network = network;
6 3 : this->name = std::string("No name");
7 3 : this->defragmentator = nullptr;
8 3 : }
9 :
10 2 : allocationStatus Allocator::exec(int src, int dst, BitRate bitRate,
11 : Connection &con) {
12 : throw std::runtime_error(
13 : "You must implement a method to allocate resources. You can do this "
14 2 : "making an inherited class from Allocator, or ...");
15 : }
16 :
17 12 : std::string Allocator::getName(void) { return this->name; }
18 :
19 53 : Allocator::Allocator(void) {
20 53 : this->network = nullptr;
21 53 : this->path = nullptr;
22 53 : this->defragmentator = nullptr;
23 53 : }
24 :
25 14 : void Allocator::setNetwork(std::shared_ptr<Network> network) { this->network = network; }
26 :
27 14 : void Allocator::setPaths(std::shared_ptr<Paths> path) {
28 14 : this->path = path;
29 14 : }
30 :
31 0 : void Allocator::setDefragmentator(std::unique_ptr<Defragmentator> defragmentator) {
32 0 : this->defragmentator = std::move(defragmentator);
33 0 : }
34 :
35 53426 : std::unique_ptr<Defragmentator> &Allocator::getDefragmentator(void) {
36 53426 : return this->defragmentator;
37 : }
|