// Copyright 2008 Isis Innovation Limited
// This is the main extry point for PTAM
#include <stdlib.h>
#include <iostream>
#include <gvars3/instances.h>
#include "System.h"
using namespace std;
using namespace GVars3;
int main()
{
cout << " Welcome to PTAM " << endl;
cout << " --------------- " << endl;
cout << " Parallel tracking and mapping for Small AR workspaces" << endl;
cout << " Copyright (C) Isis Innovation Limited 2008 " << endl;
cout << endl;
cout << " Parsing settings.cfg ...." << endl;
GUI.LoadFile("settings.cfg"); //当内核使⽤⼀个exec函数执⾏C程序时,在调⽤main函数之前先调⽤⼀个特殊的启动例程,
//可执⾏程序将此例程指定为程序的起始地址。启动例程从内核获取命令⾏参数和环境变量,然后为调⽤main函数做好准备。
GUI.StartParserThread(); // Start parsing of the console input
atexit(GUI.StopParserThread);
//atexit函数是一个特殊的函数,它是在正常程序退出时调用的函数,我们把他叫为登记函数(函数原型:int atexit (void (*)(void)))
// ⼀个进程可以登记若⼲个函数,这些函数由exit⾃动调⽤,这些函数被称为终⽌处理函数, atexit函数可以登记这些函数。
try
{
System s;
s.Run();
}
catch(CVD::Exceptions::All e)
{
cout << endl;
cout << "!! Failed to run system; got exception. " << endl;
cout << " Exception was: " << endl;
cout << e.what << endl;
}
}