cleaned up references and added json alias. Unfortuantely this library isn't easy to forward declare so leaving the header include

This commit is contained in:
amerhifi 2019-05-10 12:21:40 -07:00
parent edb3206a24
commit ba69f0c962
6 changed files with 17 additions and 24 deletions

View file

@ -14,7 +14,6 @@
#include <unistd.h>
using namespace platform;
using namespace nlohmann;
bool MACOSInstance::enumeratePlatform() {
enumerateCpu();
@ -26,8 +25,6 @@ bool MACOSInstance::enumeratePlatform() {
void MACOSInstance::enumerateCpu() {
json *cpu= new json();
// (*cpu)["brand"] = ident->getName();
// (*cpu)["model"] = CPUModelString;
// (*cpu)["clockSpeed"] = CPUClockString;
@ -36,8 +33,6 @@ void MACOSInstance::enumerateCpu() {
_cpu.push_back(cpu);
}
unsigned int MACOSInstance::getNumLogicalCores() {
return std::thread::hardware_concurrency();
}

View file

@ -10,7 +10,6 @@
#define hifi_MACOSPlatform_h
#include "platform.h"
#include <nlohmann/json.hpp>
namespace platform {

View file

@ -7,17 +7,18 @@
//
#include "WINPlatform.h"
#ifdef Q_OS_WINDOWS
#include <intrin.h>
#include <Windows.h>
#endif
#include <thread>
#include <GPUIdent.h>
#include <string>
using namespace platform;
using namespace nlohmann;
bool WINInstance::enumeratePlatform() {
enumerateCpu();

View file

@ -10,7 +10,6 @@
#define hifi_WinPlatform_h
#include "platform.h"
#include <nlohmann/json.hpp>
namespace platform {
@ -30,4 +29,4 @@ namespace platform {
} // namespace platform
#endif //hifi_winplatform_h
#endif //hifi_winplatform_h

View file

@ -23,7 +23,6 @@
#endif
using namespace platform;
using namespace nlohmann;
Instance* _instance;

View file

@ -9,36 +9,36 @@
#ifndef hifi_Platform_h
#define hifi_Platform_h
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
namespace platform {
using json = nlohmann::json;
class Instance {
public:
bool virtual enumeratePlatform() = 0;
int getNumCPU() { return _cpu.size(); }
nlohmann::json* getCPU(int index);
json* getCPU(int index);
int getNumGPU() { return _gpu.size(); }
nlohmann::json* getGPU(int index);
json* getGPU(int index);
int getNumMemory() { return _memory.size(); }
nlohmann::json* getMemory(int index);
json* getMemory(int index);
int getNumDisplay() { return _display.size(); }
nlohmann::json* getDisplay(int index);
json* getDisplay(int index);
virtual ~Instance();
protected:
std::vector<nlohmann::json*> _cpu;
std::vector<nlohmann::json*> _memory;
std::vector<nlohmann::json*> _gpu;
std::vector<nlohmann::json*> _display;
std::vector<json*> _cpu;
std::vector<json*> _memory;
std::vector<json*> _gpu;
std::vector<json*> _display;
};
@ -49,16 +49,16 @@ void destroy();
bool enumeratePlatform();
int getNumProcessor();
const nlohmann::json* getProcessor(int index);
const json* getProcessor(int index);
int getNumGraphics();
const nlohmann::json* getGraphics(int index);
const json* getGraphics(int index);
int getNumDisplay();
const nlohmann::json* getDisplay(int index);
const json* getDisplay(int index);
int getNumMemory();
const nlohmann::json* getMemory(int index);
const json* getMemory(int index);
} // namespace platform