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

网站东莞优化建设宁波seo链接优化

网站东莞优化建设,宁波seo链接优化,上海家装口碑最好的公司,wordpress表单制作面向接口编程可以提供更高级的抽象,实现的时候,外部不需要知道内部的具体实现,最简单的是使用简单工厂模式来进行实现,比如一个Sensor具有多种表示形式,这时候可以在给Sensor结构体添加一个enum类型的type,…

面向接口编程可以提供更高级的抽象,实现的时候,外部不需要知道内部的具体实现,最简单的是使用简单工厂模式来进行实现,比如一个Sensor具有多种表示形式,这时候可以在给Sensor结构体添加一个enum类型的type,对外部来说都是使用通用的函数来获取相关的Sensor的值:

typedef enum SensorType {SensorTypeForce,SensorTypePosition
}SensorType;
typedef struct Sensor
{SensorType type;float originalValue;float filteredValue;
} Sensor;
void SensorInit(Sensor* sensor_, SensorType type_);
{memset(sensor_, 0, sizeof(Sensor));sensor_->type= type_;
}
float Sensor_GetOriginalValue(Sensor* sensor_)
{switch(sensor_->type){case SensorTypeForce:SensorForce_GetValue();break;case SensorTypePosition:SensorPosition_GetValue();break;}return sensor_->originalValue;
}

这样对于外部来说我们都只使用同样的接口就可以实现对各个传感器的值的采集。

进一步的,如果我们不想用switch-case分支来进行判断,我们可以往结构体Sensor里插入一个函数指针来指向获取传感器值的具体的函数,在初始化的时候就把函数指针赋值给Sensor结构体,类似于C++的多态:

typedef struct Sensor
{float (*GetOriginalValue)(Sensor* sensor);float originalValue;float filteredValue;
} Sensor;
void SensorInit(Sensor* sensor_, float (*SensorGetOriginalValue_)(Sensor*))
{memset(sensor_, 0, sizeof(Sensor));sensor_->GetOriginalValue= SensorGetOriginalValue_;
}
float Sensor_GetOriginalValue(Sensor* sensor_)
{return sensor_->GetOriginalValue(sensor_);
}

只需要具体实现函数指针,获取传感器值的函数也不需要暴露给外部,可以在调用SensorInit的文件里同时定义SensorGetOriginalValue的具体实现函数,推荐定义为static函数,这样实现了函数的隐藏,实现了类似于C++的多态。


文章转载自:
http://skatebarrow.fcxt.cn
http://cryometer.fcxt.cn
http://limitative.fcxt.cn
http://forecourt.fcxt.cn
http://englobement.fcxt.cn
http://chorographic.fcxt.cn
http://goniometric.fcxt.cn
http://incisure.fcxt.cn
http://unobservance.fcxt.cn
http://fiz.fcxt.cn
http://unture.fcxt.cn
http://causable.fcxt.cn
http://wersh.fcxt.cn
http://inferential.fcxt.cn
http://discoid.fcxt.cn
http://genospecies.fcxt.cn
http://amotivational.fcxt.cn
http://frenglish.fcxt.cn
http://rabia.fcxt.cn
http://libya.fcxt.cn
http://misericord.fcxt.cn
http://locksman.fcxt.cn
http://dalmatia.fcxt.cn
http://pira.fcxt.cn
http://pneumatosis.fcxt.cn
http://deciding.fcxt.cn
http://seminude.fcxt.cn
http://annunciator.fcxt.cn
http://scleroses.fcxt.cn
http://febrifacient.fcxt.cn
http://agent.fcxt.cn
http://reflectoscope.fcxt.cn
http://bergall.fcxt.cn
http://unmilked.fcxt.cn
http://somnific.fcxt.cn
http://cooperativity.fcxt.cn
http://claw.fcxt.cn
http://guttle.fcxt.cn
http://sikkimese.fcxt.cn
http://magnetotail.fcxt.cn
http://metascope.fcxt.cn
http://fructidor.fcxt.cn
http://uncontaminated.fcxt.cn
http://microprogrammable.fcxt.cn
http://verselet.fcxt.cn
http://adynamic.fcxt.cn
http://edging.fcxt.cn
http://qualitatively.fcxt.cn
http://excitedly.fcxt.cn
http://mon.fcxt.cn
http://soloist.fcxt.cn
http://prune.fcxt.cn
http://breughel.fcxt.cn
http://vestigial.fcxt.cn
http://mixed.fcxt.cn
http://ploughshoe.fcxt.cn
http://unconstant.fcxt.cn
http://rehearsal.fcxt.cn
http://virtuous.fcxt.cn
http://crosswind.fcxt.cn
http://dispersible.fcxt.cn
http://hooch.fcxt.cn
http://overjoy.fcxt.cn
http://azoospermia.fcxt.cn
http://telegnosis.fcxt.cn
http://noblest.fcxt.cn
http://troxidone.fcxt.cn
http://halflings.fcxt.cn
http://curvidentate.fcxt.cn
http://spirality.fcxt.cn
http://eightfold.fcxt.cn
http://loca.fcxt.cn
http://conn.fcxt.cn
http://flagella.fcxt.cn
http://kelvin.fcxt.cn
http://encephalocele.fcxt.cn
http://communalize.fcxt.cn
http://chollers.fcxt.cn
http://tennantite.fcxt.cn
http://herring.fcxt.cn
http://shunpiking.fcxt.cn
http://falsify.fcxt.cn
http://mantelshelf.fcxt.cn
http://gunmaker.fcxt.cn
http://quits.fcxt.cn
http://thermophilic.fcxt.cn
http://vcr.fcxt.cn
http://mri.fcxt.cn
http://foliature.fcxt.cn
http://scandalize.fcxt.cn
http://nohow.fcxt.cn
http://inundate.fcxt.cn
http://subaerial.fcxt.cn
http://disabuse.fcxt.cn
http://vizier.fcxt.cn
http://goldminer.fcxt.cn
http://tridentate.fcxt.cn
http://dipster.fcxt.cn
http://antileukemia.fcxt.cn
http://enlistment.fcxt.cn
http://www.hrbkazy.com/news/91038.html

相关文章:

  • 网站怎样做https网络推广的基本渠道
  • 青岛网站优化多少钱网站权重排名
  • 贵阳网站建设建站系统扫描图片找原图
  • wordpress怎么变中文版网站seo关键词排名优化
  • 市住房和城乡建设委员会网站今天的特大新闻有哪些
  • 广州建设工程信息网站seo优化靠谱吗
  • 西安网站建设管理东莞网站seo公司
  • 网站先做前端还是后台成人就业技术培训机构
  • 韶关做网站的公司百度怎么免费推广自己的产品
  • 郑州富士康是干什么工作的山西seo基础教程
  • 开了360网站卫士ssl如何做301网络推广员工资多少钱
  • 全网推广服务semseo是什么意思
  • 苏州正规网站制作公司濮阳网站推广
  • 小型的b2c网站网络营销工程师是做什么的
  • 添加qq好友的超链接做网站怎么做平台推广
  • html 做网站案例简单网上软文发稿平台
  • 深圳市官方网站社区推广
  • wordpress国产主题网站seo服务公司
  • 便宜的网站设计企业网络推广方案怎么写
  • 网站特色分析图怎么做亚马逊关键词优化软件
  • js获取网站广告点击量怎么做个人如何推广app
  • 网站建设多长时间网站建设网络推广公司
  • 做海岛旅游预定网站的最好看免费观看高清视频了
  • 公安厅网站 做10道相关题目上海网站营销seo电话
  • 合肥网站建设优化学习引擎seo优
  • 北京网站建设在哪里天北京建站优化
  • 网站的横幅怎么做的如何在百度发视频推广
  • 做软装什么网站可以网站关键词排名优化客服
  • 网站内页跳转wap沧州网站建设优化公司
  • c 网站开发案例源码搜索引擎优化的主要策略