From ba69f0c962882bd5c534173e3e8f3f15cb8233d8 Mon Sep 17 00:00:00 2001 From: amerhifi Date: Fri, 10 May 2019 12:21:40 -0700 Subject: [PATCH] cleaned up references and added json alias. Unfortuantely this library isn't easy to forward declare so leaving the header include --- libraries/platform/src/MACOSPlatform.cpp | 5 ----- libraries/platform/src/MACOSPlatform.h | 1 - libraries/platform/src/WINPlatform.cpp | 3 ++- libraries/platform/src/WINPlatform.h | 3 +-- libraries/platform/src/platform.cpp | 1 - libraries/platform/src/platform.h | 28 ++++++++++++------------ 6 files changed, 17 insertions(+), 24 deletions(-) diff --git a/libraries/platform/src/MACOSPlatform.cpp b/libraries/platform/src/MACOSPlatform.cpp index fb83de1951..034849817c 100644 --- a/libraries/platform/src/MACOSPlatform.cpp +++ b/libraries/platform/src/MACOSPlatform.cpp @@ -14,7 +14,6 @@ #include 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(); } diff --git a/libraries/platform/src/MACOSPlatform.h b/libraries/platform/src/MACOSPlatform.h index ff1a4818be..71953d1d1a 100644 --- a/libraries/platform/src/MACOSPlatform.h +++ b/libraries/platform/src/MACOSPlatform.h @@ -10,7 +10,6 @@ #define hifi_MACOSPlatform_h #include "platform.h" -#include namespace platform { diff --git a/libraries/platform/src/WINPlatform.cpp b/libraries/platform/src/WINPlatform.cpp index 0c7f3db9f6..1e5e05df42 100644 --- a/libraries/platform/src/WINPlatform.cpp +++ b/libraries/platform/src/WINPlatform.cpp @@ -7,17 +7,18 @@ // #include "WINPlatform.h" + #ifdef Q_OS_WINDOWS #include #include #endif + #include #include #include using namespace platform; -using namespace nlohmann; bool WINInstance::enumeratePlatform() { enumerateCpu(); diff --git a/libraries/platform/src/WINPlatform.h b/libraries/platform/src/WINPlatform.h index 198fad5b77..35ad2bf964 100644 --- a/libraries/platform/src/WINPlatform.h +++ b/libraries/platform/src/WINPlatform.h @@ -10,7 +10,6 @@ #define hifi_WinPlatform_h #include "platform.h" -#include namespace platform { @@ -30,4 +29,4 @@ namespace platform { } // namespace platform -#endif //hifi_winplatform_h \ No newline at end of file +#endif //hifi_winplatform_h diff --git a/libraries/platform/src/platform.cpp b/libraries/platform/src/platform.cpp index 7fd8e4f8ad..b51a3907bb 100644 --- a/libraries/platform/src/platform.cpp +++ b/libraries/platform/src/platform.cpp @@ -23,7 +23,6 @@ #endif using namespace platform; -using namespace nlohmann; Instance* _instance; diff --git a/libraries/platform/src/platform.h b/libraries/platform/src/platform.h index 9a5267211a..3c28836a7f 100644 --- a/libraries/platform/src/platform.h +++ b/libraries/platform/src/platform.h @@ -9,36 +9,36 @@ #ifndef hifi_Platform_h #define hifi_Platform_h -#include #include #include 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 _cpu; - std::vector _memory; - std::vector _gpu; - std::vector _display; + std::vector _cpu; + std::vector _memory; + std::vector _gpu; + std::vector _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