bugfix: add destructor, and disable copy ctor

master
FengJungle 2021-10-28 21:21:56 +08:00
parent 8c3b7a6a87
commit 81bd28e821
1 changed files with 13 additions and 7 deletions

View File

@ -6,7 +6,7 @@
#include <mutex> #include <mutex>
using namespace std; using namespace std;
//目标抽象类 //Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
class Controller class Controller
{ {
public: public:
@ -16,27 +16,27 @@ public:
private: private:
}; };
//适配者类DxfParser //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DxfParser
class DxfParser class DxfParser
{ {
public: public:
DxfParser(){} DxfParser(){}
void parseFile(){ void parseFile(){
printf("解析文件提取数据\n"); printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
} }
}; };
//适配者类PathPlanner //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PathPlanner
class PathPlanner class PathPlanner
{ {
public: public:
PathPlanner(){} PathPlanner(){}
void calculate(){ void calculate(){
printf("计算加工路径\n"); printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>·<EFBFBD><EFBFBD>\n");
} }
}; };
//适配器类Adapter //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Adapter
class Adapter:public Controller class Adapter:public Controller
{ {
public: public:
@ -44,8 +44,14 @@ public:
dxfParser = new DxfParser(); dxfParser = new DxfParser();
pathPlanner = new PathPlanner(); pathPlanner = new PathPlanner();
} }
~Adapter(){
delete dxfParser;
delete pathPlanner;
}
Adapter(const Adapter& other) = delete;
Adapter& operator=(const Adapter& ) = delete;
void pathPlanning(){ void pathPlanning(){
printf("路径规划:\n"); printf("·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
dxfParser->parseFile(); dxfParser->parseFile();
pathPlanner->calculate(); pathPlanner->calculate();
} }