64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
#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;
|
||
}
|
||
};
|