This repository was archived by the owner on Apr 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathram.cpp
More file actions
141 lines (134 loc) · 2.87 KB
/
Copy pathram.cpp
File metadata and controls
141 lines (134 loc) · 2.87 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* @file ram.cpp
* @brief The implementation for the RAM class.
*
* @author Evan Elias Young
* @date 2019-04-04
* @date 2020-02-29
* @copyright Copyright 2019-2020 Evan Elias Young. All rights reserved.
*/
#include "pch.h"
#include "ram.h"
#include "os.h"
#pragma region "Constructors"
/**
* @brief Construct a new RAM object
*/
RAM::RAM()
{
size = 0;
bank = "";
type = "";
speed = 0;
formFactor = "";
manufacturer = "";
part = "";
serial = "";
voltageConfigured = 0.0;
voltageMin = 0.0;
voltageMax = 0.0;
}
/**
* @brief Construct a new RAM object with values
*
* @param sz The amount
* @param bk The bank
* @param tp The type
* @param spd The speed
* @param ff The formfactor
* @param manuf The manufacture
* @param prt The part number
* @param srl The serial number
* @param vlt The current voltage
* @param vltMin The minimum voltage
* @param vltMax The maximum voltage
*/
RAM::RAM(std::uint64_t sz, std::string bk, std::string tp, std::uint64_t spd, std::string ff, std::string manuf, std::string prt, std::string srl, float vlt, float vltMin, float vltMax)
{
size = sz;
bank = bk;
type = tp;
speed = spd;
formFactor = ff;
manufacturer = manuf;
part = prt;
serial = srl;
voltageConfigured = vlt;
voltageMin = vltMin;
voltageMax = vltMax;
}
/**
* @brief Construct a new RAM object with values from another RAM object
*
* @param o The other RAM object to copy from
*/
RAM::RAM(const RAM &o)
{
size = o.size;
bank = o.bank;
type = o.type;
speed = o.speed;
formFactor = o.formFactor;
manufacturer = o.manufacturer;
part = o.part;
serial = o.serial;
voltageConfigured = o.voltageConfigured;
voltageMin = o.voltageMin;
voltageMax = o.voltageMax;
}
#pragma endregion "Constructors"
#pragma region "Operators"
/**
* @brief Reserves memory for a new RAM object
*
* @param size The amount of memory to allocate
* @return void* A pointer to the allocated memory
*/
void *RAM::operator new(std::size_t size)
{
void *o = ::new (RAM);
return o;
}
/**
* @brief Sets equal two RAM objects
*
* @param o The RAM object to copy from
*/
void RAM::operator=(const RAM &o)
{
if (&o == this)
{
return;
}
size = o.size;
bank = o.bank;
type = o.type;
speed = o.speed;
formFactor = o.formFactor;
manufacturer = o.manufacturer;
part = o.part;
serial = o.serial;
voltageConfigured = o.voltageConfigured;
voltageMin = o.voltageMin;
voltageMax = o.voltageMax;
}
/**
* @brief Sets equal two RAM objects
*
* @param o The RAM object to copy from
*/
void RAM::operator=(RAM *o)
{
size = o->size;
bank = o->bank;
type = o->type;
speed = o->speed;
formFactor = o->formFactor;
manufacturer = o->manufacturer;
part = o->part;
serial = o->serial;
voltageConfigured = o->voltageConfigured;
voltageMin = o->voltageMin;
voltageMax = o->voltageMax;
}
#pragma endregion "Operators"