
C/C++
文章平均质量分 96
liyi1149549057
这个作者很懒,什么都没留下…
展开
-
apollo2.5源码解析之注册器模式
apollo2.5中感知模块注册器模式分析 一. SharedData分析先来看一个例子,方便我们更直观地理解注册器模式,摘自apollo2.5的modules/perception/lib/base/registerer.h文件:下面以SharedData类为例来具体分析一下,SharedData类的定义如下:class SharedData { public: ...原创 2019-09-26 09:59:48 · 696 阅读 · 0 评论 -
apollo2.5源码解析之运行流程
"The "apollo_app" build target defines the abstract class ApolloApp, which is implemented by all modules, as well as the macro APOLLO_MAIN, used to launch each module."上面是apollo2.5文档中关于common模块的apol...原创 2019-09-13 00:05:53 · 554 阅读 · 0 评论 -
apollo2.5源码解析之适配器模式
本博客主要参考https://blog.youkuaiyun.com/davidhopper/article/details/79197075和https://zhuanlan.zhihu.com/p/50523482,在此表示感谢。 适配器模式介绍 适配器模式的作用是将一个类的接口转换成客户希望的另外一个接口看,使得原本由于接口不兼容而不能一起工作的类可以一起工作。从实现上可以将适配器模式分为两种...原创 2019-09-11 13:51:30 · 560 阅读 · 1 评论 -
apollo2.5源码解析之工厂模式
本博客主要参考https://blog.youkuaiyun.com/davidhopper/article/details/79197075,在此表示感谢@知行合一2018工厂模式介绍工厂模式属于创建型模式,大致可以分为简单工厂模式、工厂方法模式、抽象工厂模式三类。简单工厂模式的主要特点是需要在工厂类中做判断,从而创造相应类型的产品,当增加新的产品类型时,就需要修改工厂类。工厂方法模式会定义一个用于创...原创 2019-09-10 11:27:57 · 813 阅读 · 0 评论 -
apollo2.5源码解析之单例模式
本博客主要参考https://blog.youkuaiyun.com/davidhopper/article/details/79197075,在此表示感谢@知行合一2018apollo2.5中对象创建方式总结apollo2.5项目中对象的创建大多使用直接法,例如:// 在栈(stack)上直接创建对象ADCTrajectory not_ready_pb;// 在堆(heap)上直接创建对象...原创 2019-09-09 15:58:00 · 450 阅读 · 0 评论 -
宏定义中的特殊符号
特殊符号包括:#(字符串化)、##(参数连接)、#@(参数字符化)和\(连接至下一行)。1. #(字符串化操作,自动将宏参数字符串化),例如:#define ToString(x) #xchar* str = ToString(123132); // str = "123132"2. ##(参数连接操作,即允许宏参数连接其他符号,构成新的参数,##的左右符号必须能够组成一个有意义的...转载 2019-06-19 10:31:38 · 2193 阅读 · 0 评论 -
OpenCV中Mat::clone与Mat::copyTo的区别
"The major difference is that when the destination matrix and the source matrix have the same type and size,copyTowill not change the address of the destination matrix, whileclonewill always alloc...原创 2019-04-19 17:38:31 · 6320 阅读 · 2 评论 -
常用的位操作:置位、清零与测试
以下程序可用于把某个位置位、清零或测试某位为0或1:#include <stdio.h>#include <stdbool.h> int setbit(int num, int bit);int clearbit(int num, int bit);bool testbit(int num, int bit); int main(void){ int ...转载 2019-04-19 15:12:32 · 2582 阅读 · 0 评论 -
计算两个给定整数的汉明距离——C++实现
常规实现,统计两个整数的异或结果中1的位数:int hamming_distance(unsigned x, unsigned y){ int dist = 0; // Count the number of bits set for (unsigned val = x ^ y; val > 0; val >>= 1) { ...原创 2019-04-22 11:19:26 · 1072 阅读 · 0 评论