diff --git a/include/setcpu.h b/include/setcpu.h index 2188c5a..b6f2928 100644 --- a/include/setcpu.h +++ b/include/setcpu.h @@ -3,29 +3,28 @@ /* this function's Incoming arguments are a pointer to the CPU class "CPU *pCPU" and the new mainclock speed */ -void setCPUclock(CPU *pCPU, float mmainclock, float mboostclock) { -cout << "Coming from the setCPUclock function in setcpu.h" << endl; - -pCPU->mainclock = mmainclock; -pCPU->boostclock = mboostclock; -cout << "Incoming main clock variable was: " << mmainclock << endl; -cout << "Leaving setCPUclock()\n\n"; +void setCPUmainclock(CPU *pCPU, string mkey, string mmainclock) { +pCPU->HardwareSpecs[mkey] = mmainclock; } -void setCPUarch(CPU *pCPU, std::string march) { -pCPU->architecture = march; +void setCPUboostclock(CPU *pCPU, string mkey, string mboostclock) { +pCPU->HardwareSpecs[mkey] = mboostclock; } -void setCPUbits(CPU *pCPU, int mbits) { - pCPU->bits64 = mbits; +void setCPUarch(CPU *pCPU, string mkey, std::string march) { +pCPU->HardwareSpecs[mkey] = march; } -void setCPUcores(CPU *pCPU, int mcores) { -pCPU->cores = mcores; +void setCPUbits(CPU *pCPU, string mkey, int mbits) { + pCPU->HardwareSpecs[mkey] = mbits; } -void setCPUthreads(CPU *pCPU, int mthreads) { -pCPU->threads = mthreads; +void setCPUcores(CPU *pCPU, string mkey, int mcores) { +pCPU->HardwareSpecs[mkey] = mcores; +} + +void setCPUthreads(CPU *pCPU, string mkey, int mthreads) { +pCPU->HardwareSpecs[mkey] = mthreads; // create an IF catch to set threads cores * 2 as a fall back } diff --git a/include/sethardware.h b/include/sethardware.h index 0e14393..8c5ac1b 100644 --- a/include/sethardware.h +++ b/include/sethardware.h @@ -4,10 +4,10 @@ "Hardware *pHardware" and the new mainclock speed */ void setHardwaremanufacturer(Hardware *pHardware, string mmanufacturer) { -cout << "Coming from the setHardwaremanufacturer function in setHardware" << endl; +// cout << "Coming from the setHardwaremanufacturer function in setHardware" << endl; pHardware->manufacturer = mmanufacturer; -cout << "Leaving setHardwaremanufacturer()\n\n"; +// cout << "Leaving setHardwaremanufacturer()\n\n"; } void setHardwarereleasedyear(Hardware *pHardware, int mreleasedyear) { @@ -20,9 +20,9 @@ void setHardwaremodel(Hardware *pHardware, string mmodel) { void Hardwaredictadd(CPU *pHardware, string mkey, string mvalue) { - cout << "The incoming key/value is: " << mkey << "/" << mvalue << endl; - cout << "\nThe current manufacturer is: " << pHardware->HardwareSpecs[mkey] << endl; + // cout << "The incoming key/value is: " << mkey << "/" << mvalue << endl; + // cout << "\nThe current manufacturer is: " << pHardware->HardwareSpecs[mkey] << endl; pHardware->HardwareSpecs[mkey] = mvalue; - cout << "The new manufacturer is: " << pHardware->HardwareSpecs[mkey]; + // cout << "The new manufacturer is: " << pHardware->HardwareSpecs[mkey]; } diff --git a/lists/hardware.h b/lists/hardware.h index 74e3dd1..4f9c50e 100644 --- a/lists/hardware.h +++ b/lists/hardware.h @@ -14,14 +14,8 @@ class Hardware { std::string model; int releasedyear; - std::map HardwareSpecs = { - {"manufacturer", "The Gnomes"}, - {"model", "Honey Bomb"}, - {"ReleasedYear", "2025"}, - }; - - std::string myval = HardwareSpecs.at("manufacturer"); - // HardwareSpecs.at("manufacturer") = "tester"; + // example of how to set a dictionary item + // std::string myval = HardwareSpecs.at("manufacturer"); }; @@ -33,61 +27,45 @@ class Mobo: public Hardware { int dualchannel; // This is an int so 1 = dualchannel and 2 = quad channel int ramspeed; std::string comment; - Mobo() { - manufacturer = "Forest Gnomes"; - model = "HoneyJar"; - releasedyear = 2025; - pciegen = 4; - piceslots = 3; - dimmslots = 2; - dualchannel = 1; - ramspeed = 6000; - comment = "If on AM5 platform - update BIOS before booting!"; + + std::map HardwareSpecs = { + {"manufacturer", "The Gnomes part 2"}, + {"model", "Honey Bomb"}, + {"ReleasedYear", "2025"}, + {"pciegen", "4"}, + {"pcieslots", "3"}, + {"dimmslots", "2"}, + {"ramchannels", "2"}, + {"ramspeed", "6000"}, + {"comment", "If on AM5 platform - update BIOS before booting!"}, }; }; class CPU: public Hardware { public: - bool bits64; - bool igpu; - int igpusize; - int cores; - int threads; - int l1cache; - int l2cache; - int l3cache; - int pcielanes; - int maxram; - float mainclock; - float boostclock; - std::string architecture; - std::string memoryrange; - std::string microcode; - std::string kerneldriver; - std::string comment; // This shoule be used to warn the user about updating BIOS on AM5 before booting - CPU() { - manufacturer = "Forest Gnomes"; - model = "HoneyPot"; - releasedyear = 2025; - bits64 = true; - igpu = false; - igpusize = 0; - cores = 4; - threads = 2; - l1cache = 32; - l2cache = 32; - l3cache = 32; - pcielanes = 24; - maxram = 128; - mainclock = 2; - boostclock = 2.2; - architecture = "x86_64"; - memoryrange = "00:00"; - microcode = "acorns"; - kerneldriver = "Forest Gnome Special"; - comment = ""; - }; + std::map HardwareSpecs = { + {"manufacturer", "The Gnomes part 2"}, + {"model", "Honey Bomb"}, + {"ReleasedYear", "2025"}, + {"bits", "64"}, + {"igpu", "false"}, + {"igpusize", "N/A"}, + {"cores", "4"}, + {"threads", "8"}, + {"l1cache", "32Mb"}, + {"l2cache", "32Mb"}, + {"l3cache", "32Mb"}, + {"pcielanes", "24"}, + {"maxram", "256Gb"}, + {"mainclock", "3Ghz"}, + {"boostclock", "3.2Ghz"}, + {"architecture", "x86_64"}, + {"memoryrange", "00:00 - set me!"}, + {"microcode", "unchanged"}, + {"kerneldriver", "intel"}, + {"comment", "If on AM5 platform - update BIOS before booting!"}, + }; }; class GPU: public Hardware { diff --git a/main.cpp b/main.cpp index 63cd6ab..5a0aa76 100644 --- a/main.cpp +++ b/main.cpp @@ -22,21 +22,22 @@ int main() { // A7800x3d->manufacturer = "AMD"; // Cat out both CPU's that have been created for sanity - cout << "i75820k manufacturer is: " << Ii75820k->manufacturer << endl; - cout << "A7800x3d manufacturer is: " << A7800x3d->manufacturer << endl; + // cout << "i75820k manufacturer is: " << Ii75820k->HardwareSpecs["manufacturer"] << endl; + // cout << "A7800x3d manufacturer is: " << A7800x3d->HardwareSpecs["manufacturer"] << endl; cout << "Lets try the setCPU function!\n"; - cout << "A7800x3d main clock speed is: " << A7800x3d->mainclock << endl; + cout << "A7800x3d main clock speed is: " << A7800x3d->HardwareSpecs["mainclock"] << endl; setHardwaremanufacturer(A7800x3d, "AMD"); - setCPUcores(A7800x3d, 8); - setCPUthreads(A7800x3d, 16); - setCPUclock(A7800x3d, 4.8, 5.1); // clock is base, boost - - cout << "A7800x3d new main clock speed is: " << A7800x3d->mainclock << endl; - cout << "A7800x3d manufacturer is: " << A7800x3d->manufacturer << "\n\n\n"; + setCPUcores(A7800x3d, "cores", 8); + setCPUthreads(A7800x3d, "threads", 16); + setCPUmainclock(A7800x3d, "mainclock", "4.8 Ghz"); + setCPUboostclock(A7800x3d, "boostclock", "5.2 ghz"); + cout << "\n\nA7800x3d new main/boost speed is: " << A7800x3d->HardwareSpecs["mainclock"] << "/" << A7800x3d->HardwareSpecs["boostclock"] << endl; + // cout << "A7800x3d manufacturer is: " << A7800x3d->HardwareSpecs["manufacturer"] << "\n\n\n"; // Start of Hardware Dictionary Test -// Hardwaredictadd(A7800x3d, "manufacturer", "Ganome Himself"); + // Hardwaredictadd(A7800x3d, "manufacturer", "Ganome Himself"); +// cout << "Parent Hardware() dict manufacturer is: " << A7800x3d->HardwareSpecs["manufacturer"]; system("sleep 3s"); return 0;