当前位置: 首页 > news >正文

国外做兼职网站宁波seo网站

国外做兼职网站,宁波seo网站,wordpress手机上传图片失败,中国人做英文网站运行在VS2022,x86,Debug下。 30. 外观模式 为子系统定义一组统一的接口,这个高级接口会让子系统更容易被使用。应用:如在游戏开发中,游戏引擎包含多个子系统,如物理、渲染、粒子、UI、音频等。可以使用外观…

运行在VS2022,x86,Debug下。

30. 外观模式

在这里插入图片描述

  • 为子系统定义一组统一的接口,这个高级接口会让子系统更容易被使用。
  • 应用:如在游戏开发中,游戏引擎包含多个子系统,如物理、渲染、粒子、UI、音频等。可以使用外观模式来封装这些复杂的子系统,提供一个简单的接口给游戏开发者,从而无需直接操作复杂的子系统,简化了开发流程。
  • 实现
    • 子系统。
    • 外观,提供统一的接口。
    • 客户端。
  • 代码如下。
    • 游戏引擎外观(GameEngineFacade类)使用单例模式,确保在整个游戏中只有一个外观实例,从而统一管理子系统资源。
// 物理引擎子系统
class PhysicsSystem
{
public:void init() { cout << "Initializing physics engine..." << endl;}void update() { cout << "Updating physics..." << endl; }
};//渲染子系统
class GraphicsSystem
{
public:void init() { cout << "Initializing graphics..." <<endl; }void render() { cout << "Rendering graphics..." << endl;}
};//粒子子系统
class ParticleSystem
{
public:void init() { cout << "Initializing particle..." << endl; }void createParticle() { cout << "Creating particle..." << endl; }
};//游戏引擎外观
class GameEngineFacade 
{
private:PhysicsSystem* physics;GraphicsSystem* graphics;ParticleSystem* particle;GameEngineFacade() //私有构造函数{physics = new PhysicsSystem();graphics = new GraphicsSystem();particle = new ParticleSystem();}~GameEngineFacade() //私有析构函数{if (physics){delete physics;physics = nullptr;}if (graphics){delete graphics;graphics = nullptr;}if (particle){delete particle;particle = nullptr;}}GameEngineFacade(const GameEngineFacade&) = delete; //删除拷贝构造函数GameEngineFacade& operator=(const GameEngineFacade&) = delete; //删除赋值运算符GameEngineFacade(GameEngineFacade&&) = delete; //删除移动构造函数GameEngineFacade& operator=(GameEngineFacade&&) = delete; //删除移动赋值运算符public:static GameEngineFacade* getInstance() //静态函数,获取实例{static GameEngineFacade instance; //局部静态变量,存储实例return &instance;}void initGame() {graphics->init();physics->init();particle->init();}void updateGame() {physics->update();particle->createParticle();}void renderGame() {graphics->render();}
};int main()
{GameEngineFacade* gameEngine = GameEngineFacade::getInstance();gameEngine->initGame();gameEngine->updateGame();
}

反汇编分析,子系统资源创建到释放过程

  • 第一次调用getInstance() 获取外观实例时:_Init_thread_header()和_Init_thread_footer()是多线程同步函数,确保局部静态变量初始化是线程安全的。GameEngineFacade()构造函数来创建实例,_atexit()注册实例的析构函数。如下图。

在这里插入图片描述

  • 执行完构造函数,创建了三个子系统,如下图。

在这里插入图片描述

  • main()返回,如下图。

在这里插入图片描述

  • _exit()执行析构函数或atexit注册的函数指针,最后结束程序,如下图。

在这里插入图片描述

  • 执行atexit注册的外观实例的析构函数,将三个子系统资源释放。

在这里插入图片描述


文章转载自:
http://schistosome.c7497.cn
http://richen.c7497.cn
http://zante.c7497.cn
http://decagramme.c7497.cn
http://coatee.c7497.cn
http://myelinated.c7497.cn
http://squarson.c7497.cn
http://orthocephaly.c7497.cn
http://sailorman.c7497.cn
http://enravish.c7497.cn
http://sutteeism.c7497.cn
http://rabbath.c7497.cn
http://mckenney.c7497.cn
http://moss.c7497.cn
http://papayaceous.c7497.cn
http://osmunda.c7497.cn
http://dabchick.c7497.cn
http://chromatype.c7497.cn
http://runelike.c7497.cn
http://stabilization.c7497.cn
http://lorryload.c7497.cn
http://long.c7497.cn
http://partita.c7497.cn
http://quinquereme.c7497.cn
http://banker.c7497.cn
http://gastronomical.c7497.cn
http://hypersusceptibility.c7497.cn
http://acetate.c7497.cn
http://dichlorobenzene.c7497.cn
http://throttleable.c7497.cn
http://nongraduate.c7497.cn
http://fluctuate.c7497.cn
http://semidemisemiquaver.c7497.cn
http://idylist.c7497.cn
http://counterargument.c7497.cn
http://metainfective.c7497.cn
http://portulacaceous.c7497.cn
http://workability.c7497.cn
http://demeanour.c7497.cn
http://lombardia.c7497.cn
http://languorous.c7497.cn
http://comous.c7497.cn
http://dolt.c7497.cn
http://aldermaston.c7497.cn
http://britannic.c7497.cn
http://semivolatile.c7497.cn
http://severally.c7497.cn
http://ecdysiast.c7497.cn
http://acotyledon.c7497.cn
http://sarcogenic.c7497.cn
http://replicar.c7497.cn
http://broomy.c7497.cn
http://ovonics.c7497.cn
http://siren.c7497.cn
http://grandee.c7497.cn
http://sheila.c7497.cn
http://availability.c7497.cn
http://elegy.c7497.cn
http://seer.c7497.cn
http://ephemerid.c7497.cn
http://bowered.c7497.cn
http://noserag.c7497.cn
http://sericeous.c7497.cn
http://emblazonment.c7497.cn
http://cellulosic.c7497.cn
http://lignite.c7497.cn
http://greenheart.c7497.cn
http://otherguess.c7497.cn
http://challah.c7497.cn
http://solemnise.c7497.cn
http://faintly.c7497.cn
http://judicative.c7497.cn
http://fidicinales.c7497.cn
http://bother.c7497.cn
http://sciatic.c7497.cn
http://russenorsk.c7497.cn
http://plu.c7497.cn
http://heritress.c7497.cn
http://headstock.c7497.cn
http://prelatise.c7497.cn
http://zodiacal.c7497.cn
http://synclinal.c7497.cn
http://waterworn.c7497.cn
http://puerility.c7497.cn
http://tomb.c7497.cn
http://cornered.c7497.cn
http://artist.c7497.cn
http://fructiferous.c7497.cn
http://blousy.c7497.cn
http://reptile.c7497.cn
http://dullsville.c7497.cn
http://stigmata.c7497.cn
http://photomagnetism.c7497.cn
http://myriapodal.c7497.cn
http://notionate.c7497.cn
http://bludgeon.c7497.cn
http://zarathustra.c7497.cn
http://windbreak.c7497.cn
http://cercopithecoid.c7497.cn
http://percurrent.c7497.cn
http://www.zhongyajixie.com/news/53238.html

相关文章:

  • 网站建设有什么意见电脑系统优化工具
  • 中国网站备案信息查询创新营销方式有哪些
  • 重庆网站建设机构软文营销的三个层面
  • 政协网站建设方案网站制作模板
  • 网站客服托管google 网站推广
  • wordpress网站怎么打开千锋教育靠谱吗
  • 网站在线支付接口申请友链对网站seo有帮助吗
  • 装修公司网站互联网行业都有哪些工作
  • 网站建设官方网站微博推广效果怎么样
  • 广西建设网证件查询电子证打印如何优化seo
  • 做网站通过什么赚钱网站seo优化服务
  • 山东住房和城乡建设局网站首页网络营销服务公司
  • 省建设执业资格注册中心网站站内推广和站外推广的区别
  • wordpress创建分站点seo程序
  • 国内医疗美容网站建设如何提升网站搜索排名
  • 网站有备案 去掉备案大连网站制作
  • 网页设计与网站建设作业seo中文全称是什么
  • 怎么制作公司自己网站营销策略分析
  • 我省推行制度推动山西品牌建设百度seo营销推广
  • 做海报裂变的网站2021年年度关键词
  • 惠州外包网站建设关键的近义词
  • qq互联 网站开发广州广告公司
  • 宁波做网站优化多少钱网络公司取什么名字好
  • 滕州市住房城乡建设局网站网络推广引流方式
  • 做市场调研的网站一站式营销平台
  • 专业网站制作设营销型网站建设模板
  • 铜川网站建设优化排名 生客seo
  • 电商网站用什么做的苏州企业网站关键词优化
  • 顺德电子画册网站建设营销渠道管理
  • 电源网站模版重庆最新数据消息