Add synthetic files

This commit is contained in:
John Zhao 2018-04-26 10:33:37 +08:00
parent 1fd44f7f0c
commit 8f10285773
5 changed files with 147 additions and 1 deletions

View File

@ -140,6 +140,7 @@ set(MYNTEYE_SRCS
if(WITH_API)
list(APPEND MYNTEYE_SRCS
src/api/api.cc
src/api/synthetic.cc
)
endif()

View File

@ -4,11 +4,13 @@
#include "mynteye/utils.h"
#include "api/synthetic.h"
#include "device/device.h"
MYNTEYE_BEGIN_NAMESPACE
API::API(std::shared_ptr<Device> device) : device_(device) {
API::API(std::shared_ptr<Device> device)
: device_(device), synthetic_(new Synthetic(this)) {
VLOG(2) << __func__;
}
@ -24,4 +26,74 @@ std::shared_ptr<API> API::Create(std::shared_ptr<Device> device) {
return std::make_shared<API>(device);
}
Model API::GetModel() const {
return device_->GetModel();
}
bool API::Supports(const Stream &stream) const {
return device_->Supports(stream);
}
bool API::Supports(const Capabilities &capability) const {
return device_->Supports(capability);
}
bool API::Supports(const Option &option) const {
return device_->Supports(option);
}
const std::vector<StreamRequest> &API::GetStreamRequests(
const Capabilities &capability) const {
return device_->GetStreamRequests(capability);
}
void API::ConfigStreamRequest(
const Capabilities &capability, const StreamRequest &request) {
device_->ConfigStreamRequest(capability, request);
}
std::string API::GetInfo(const Info &info) const {
return device_->GetInfo(info);
}
Intrinsics API::GetIntrinsics(const Stream &stream) const {
return device_->GetIntrinsics(stream);
}
Extrinsics API::GetExtrinsics(const Stream &from, const Stream &to) const {
return device_->GetExtrinsics(from, to);
}
MotionIntrinsics API::GetMotionIntrinsics() const {
return device_->GetMotionIntrinsics();
}
Extrinsics API::GetMotionExtrinsics(const Stream &from) const {
return device_->GetMotionExtrinsics(from);
}
void API::LogOptionInfos() const {
device_->LogOptionInfos();
}
OptionInfo API::GetOptionInfo(const Option &option) const {
return device_->GetOptionInfo(option);
}
std::int32_t API::GetOptionValue(const Option &option) const {
return device_->GetOptionValue(option);
}
void API::SetOptionValue(const Option &option, std::int32_t value) {
device_->SetOptionValue(option, value);
}
bool API::RunOptionAction(const Option &option) const {
return device_->RunOptionAction(option);
}
std::shared_ptr<Device> API::device() {
return device_;
}
MYNTEYE_END_NAMESPACE

View File

@ -3,12 +3,16 @@
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "mynteye/mynteye.h"
#include "mynteye/types.h"
MYNTEYE_BEGIN_NAMESPACE
class Device;
class Synthetic;
class MYNTEYE_API API {
public:
@ -18,8 +22,38 @@ class MYNTEYE_API API {
static std::shared_ptr<API> Create();
static std::shared_ptr<API> Create(std::shared_ptr<Device> device);
Model GetModel() const;
bool Supports(const Stream &stream) const;
bool Supports(const Capabilities &capability) const;
bool Supports(const Option &option) const;
const std::vector<StreamRequest> &GetStreamRequests(
const Capabilities &capability) const;
void ConfigStreamRequest(
const Capabilities &capability, const StreamRequest &request);
std::string GetInfo(const Info &info) const;
Intrinsics GetIntrinsics(const Stream &stream) const;
Extrinsics GetExtrinsics(const Stream &from, const Stream &to) const;
MotionIntrinsics GetMotionIntrinsics() const;
Extrinsics GetMotionExtrinsics(const Stream &from) const;
void LogOptionInfos() const;
OptionInfo GetOptionInfo(const Option &option) const;
std::int32_t GetOptionValue(const Option &option) const;
void SetOptionValue(const Option &option, std::int32_t value);
bool RunOptionAction(const Option &option) const;
std::shared_ptr<Device> device();
private:
std::shared_ptr<Device> device_;
std::unique_ptr<Synthetic> synthetic_;
};
MYNTEYE_END_NAMESPACE

17
src/api/synthetic.cc Normal file
View File

@ -0,0 +1,17 @@
#include "api/synthetic.h"
#include <glog/logging.h>
#include "api/api.h"
MYNTEYE_BEGIN_NAMESPACE
Synthetic::Synthetic(API *api) : api_(api) {
VLOG(2) << __func__;
}
Synthetic::~Synthetic() {
VLOG(2) << __func__;
}
MYNTEYE_END_NAMESPACE

22
src/api/synthetic.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef MYNTEYE_SYNTHETIC_H_ // NOLINT
#define MYNTEYE_SYNTHETIC_H_
#pragma once
#include "mynteye/mynteye.h"
MYNTEYE_BEGIN_NAMESPACE
class API;
class Synthetic {
public:
explicit Synthetic(API *api);
~Synthetic();
private:
API *api_;
};
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_SYNTHETIC_H_ NOLINT