#pragma once
#include <vector>
#include <fstream>

/*
*  THIS PORTION OF CODE WAS DONATED BY szaszmango from brodie's server!
*/

// This magic returns a vector which contain all the objects created using the CPU class
std::vector<CPU> genCPUclasses() {
  std::vector<CPU> resultCpuList;
  std::ifstream cpuList{"lists/cpulist", std::ifstream::in};
  
  if(cpuList.is_open()) {
    std::cout << "File opened\n";
  }
  else { std::cout << "Failed to open file!\n"; }
  
  std::string line;
  while (std::getline(cpuList, line)) {
    CPU cpu;
    cpu.HardwareSpecs["model"] = line;
    resultCpuList.push_back(std::move(cpu));
    std::cout << "Loaded CPU: " << line << std::endl;
  }

  return resultCpuList;
}
