System.cc
//系统的构造函数,将会启动其他的线程
System::System(const string &strVocFile, //词典文件路径
const string &strSettingsFile, //配置文件路径
const eSensor sensor, //传感器类型
const bool bUseViewer): //是否使用可视化界面
mSensor(sensor), //初始化传感器类型
mpViewer(static_cast<Viewer*>(NULL)), //空。。。对象指针? TODO
mbReset(false), //无复位标志
mbActivateLocalizationMode(false), //没有这个模式转换标志
mbDeactivateLocalizationMode(false) //没有这个模式转换标志
static_cast
这个关键字的作用主要表现在
static
上,是一种静态的转换,在编译期就能确定的转换,可以完成C语言中的强制类型转换中的大部分工作,但需要注意的是,它不能转换掉表达式的const
、volitale
或者__unaligned
属性。
用于基本数据类型之间的转换,如把
int
转换成char
,把int
转换成double
等int val = 110119;
char c = static_cast<char>(val);
double d = static_cast<double>(val);
可以用于
void*
和其他指针类类型之间的转换,但是不能用于两个无关指针类型的直接转换// 正常转换
int *p = new int;
void* p1 = static_cast<void*>(p);
char* p2 = static_cast<char*>(p1);// 编译失败 //error: invalid static_cast from type ‘int*’ to type ‘char*’
char* p3 = static_cast<char*>(p);
cv::FileStorage fsSettings(strSettingsFile.c_str(), //将配置文件名转换成为字符串
cv::FileStorage::READ); //只读
cv::FileStorage的简单使用_天际的鸟的博客-优快云博客
//建立一个新的ORB字典
mpVocabulary = new ORBVocabulary();
//获取字典加载状态
bool bVocLoad = mpVocabulary->loadFromTextFile(strVocFile);
//Create KeyFrame Database
mpKeyFrameDatabase = new KeyFrameDatabase(*mpVocabulary);
//Create the Map
mpMap = new Map();
//Create Drawers. These are used by the Viewer
//这里的帧绘制器和地图绘制器将会被可视化的Viewer所使用
mpFrameDrawer = new FrameDrawer(mpMap);
mpMapDrawer = new MapDrawer(mpMap, strSettingsFile);
new
class person{
public:
person(string name){
this->Name=name;
}
string Name;
};
int main() {
int* ptr = new int(10);
person* person1 = new person("sss");
std::cout <<*ptr << std::endl;
std::cout <<person1 << std::endl;
person1->Name;
std::cout <<person1->Name<< std::endl;
return 0;
}
shuchu
10
0x55671b6cde90
sss