DesignPattern/07.AdapterPattern/2.Code/AdapterPattern.h

57 lines
831 B
C
Raw Normal View History

2019-10-22 00:24:54 +00:00
#ifndef __SINGLETON_H__
#define __SINGLETON_H__
#include <iostream>
#include <string.h>
#include <mutex>
using namespace std;
//Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
class Controller
{
public:
Controller(){}
virtual ~Controller(){}
2019-10-22 00:24:54 +00:00
virtual void pathPlanning() = 0;
private:
};
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DxfParser
class DxfParser
{
public:
DxfParser(){}
void parseFile(){
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
}
};
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PathPlanner
class PathPlanner
{
public:
PathPlanner(){}
void calculate(){
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>·<EFBFBD><EFBFBD>\n");
}
};
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Adapter
class Adapter:public Controller
{
public:
Adapter(){
dxfParser = new DxfParser();
pathPlanner = new PathPlanner();
}
void pathPlanning(){
printf("·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
dxfParser->parseFile();
pathPlanner->calculate();
}
private:
DxfParser *dxfParser;
PathPlanner *pathPlanner;
};
#endif //__SINGLETON_H__