Files
hardwaremoniter/hardware_monitor_wrapper/native/include/IComputer.h
2025-06-08 17:40:21 +08:00

64 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#pragma once
#include "Settings.h"
#include "SMBios.h"
#include <vector>
#include "Hardware.h"
#include "IComputer.h"
#include "dll_macro.h"
class Visitor;
struct innerComputerInterface;
/**
* 虽然以I打头但只是为了和C#类保持一致,本身不是抽象类
* 不应该被手动实例化,只可以从别的类中获取
*/
class DLL_API IComputer {
public:
//的确你是找不到这个innerComputerInterface的实现的要是你能找到就该报错了。
//不应该被手动实例化,只可以从别的类中获取
IComputer(std::shared_ptr<innerComputerInterface> inner);
virtual bool operator==(const IComputer& other) const;
bool isNull() const;
virtual ~IComputer();
virtual std::vector<Hardware> getHardware();
virtual bool isBatteryEnabled();
virtual bool isControllerEnabled();
virtual bool isCpuEnabled();
virtual bool isGpuEnabled();
virtual bool isMemoryEnabled();
virtual bool isMotherboardEnabled();
virtual bool isNetworkEnabled();
virtual bool isPsuEnabled();
virtual bool isStorageEnabled();
virtual std::string GetReport();
virtual void Accept(Visitor* visitor);
virtual void Traverse(Visitor* visitor);
protected:
std::shared_ptr<innerComputerInterface> inner;
//不应在外部访问inner变量getter和setter的作用是方便定义了同名变量的派生类访问
void setIComputerInner(std::shared_ptr<innerComputerInterface> inner) {
this->inner = inner;
}
std::shared_ptr<innerComputerInterface> getIComputerInner() const {
return inner;
}
};