forked from ovr/StaticScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmachine.h
More file actions
39 lines (30 loc) · 821 Bytes
/
machine.h
File metadata and controls
39 lines (30 loc) · 821 Bytes
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
//
// Created by Dmitry Patsura on 2018-11-28.
//
#ifndef HLVM_RUNTIME_MACHINE_H
#define HLVM_RUNTIME_MACHINE_H
#include "v8/src/base/utils/random-number-generator.h"
/**
* Store whole Runtime
*/
class Machine {
protected:
v8::base::RandomNumberGenerator* randomNumberGenerator = nullptr;
public:
static Machine& Instance() {
static Machine s;
return s;
}
v8::base::RandomNumberGenerator* getRandomNumberGenerator() {
if (this->randomNumberGenerator) {
return this->randomNumberGenerator;
}
return this->randomNumberGenerator = new v8::base::RandomNumberGenerator();
}
private:
Machine() { }
~Machine() { }
Machine(Machine const&) = delete;
Machine& operator= (Machine const&) = delete;
};
#endif //HLVM_RUNTIME_MACHINE_H