Add api create methods

This commit is contained in:
John Zhao 2018-05-03 16:33:27 +08:00
parent c6586cf164
commit fbc7c3b6ef
2 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <thread> #include <thread>
#include "mynteye/glog_init.h"
#include "mynteye/utils.h" #include "mynteye/utils.h"
#include "api/synthetic.h" #include "api/synthetic.h"
@ -28,6 +29,17 @@ std::shared_ptr<API> API::Create(std::shared_ptr<Device> device) {
return std::make_shared<API>(device); return std::make_shared<API>(device);
} }
std::shared_ptr<API> API::Create(int argc, char *argv[]) {
static glog_init _(argc, argv);
return std::make_shared<API>(device::select());
}
std::shared_ptr<API> API::Create(
int argc, char *argv[], std::shared_ptr<Device> device) {
static glog_init _(argc, argv);
return std::make_shared<API>(device);
}
Model API::GetModel() const { Model API::GetModel() const {
return device_->GetModel(); return device_->GetModel();
} }

View File

@ -40,6 +40,9 @@ class MYNTEYE_API API {
static std::shared_ptr<API> Create(); static std::shared_ptr<API> Create();
static std::shared_ptr<API> Create(std::shared_ptr<Device> device); static std::shared_ptr<API> Create(std::shared_ptr<Device> device);
static std::shared_ptr<API> Create(int argc, char *argv[]);
static std::shared_ptr<API> Create(
int argc, char *argv[], std::shared_ptr<Device> device);
Model GetModel() const; Model GetModel() const;