Update macros

This commit is contained in:
John Zhao
2018-09-11 10:19:25 +08:00
parent cf9e714626
commit 1b95e376a5
25 changed files with 176 additions and 162 deletions

View File

@@ -31,7 +31,7 @@
#include "internal/dl.h"
#if defined(WITH_FILESYSTEM) && defined(WITH_NATIVE_FILESYSTEM)
#if defined(OS_WIN)
#if defined(MYNTEYE_OS_WIN)
#include <windows.h>
#endif
#endif
@@ -68,7 +68,7 @@ bool dir_exists(const fs::path &p) {
#elif defined(WITH_NATIVE_FILESYSTEM)
#if defined(OS_WIN)
#if defined(MYNTEYE_OS_WIN)
bool file_exists(const std::string &p) {
DWORD attrs = GetFileAttributes(p.c_str());
@@ -90,7 +90,7 @@ bool dir_exists(const std::string &p) {
std::vector<std::string> get_plugin_paths() {
std::string info_path(MYNTEYE_SDK_INSTALL_DIR);
info_path.append(OS_SEP "share" OS_SEP "mynteye" OS_SEP "build.info");
info_path.append(MYNTEYE_OS_SEP "share" MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
cv::FileStorage fs(info_path, cv::FileStorage::READ);
if (!fs.isOpened()) {
@@ -187,13 +187,13 @@ std::vector<std::string> get_plugin_paths() {
std::vector<std::string> dirs{MYNTEYE_SDK_ROOT_DIR, MYNTEYE_SDK_INSTALL_DIR};
for (auto &&plat : plats) {
for (auto &&dir : dirs) {
auto &&plat_dir = dir + OS_SEP "plugins" + OS_SEP + plat;
auto &&plat_dir = dir + MYNTEYE_OS_SEP "plugins" + MYNTEYE_OS_SEP + plat;
// VLOG(2) << "plat_dir: " << plat_dir;
if (!dir_exists(plat_dir))
continue;
for (auto &&name : names) {
// VLOG(2) << " name: " << name;
auto &&path = plat_dir + OS_SEP + name;
auto &&path = plat_dir + MYNTEYE_OS_SEP + name;
if (!file_exists(path))
continue;
paths.push_back(path);

View File

@@ -53,8 +53,8 @@ class MYNTEYE_API Plugin {
* @return `true` if you process rectify.
*/
virtual bool OnRectifyProcess(Object *const in, Object *const out) {
UNUSED(in)
UNUSED(out)
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
@@ -65,8 +65,8 @@ class MYNTEYE_API Plugin {
* @return `true` if you process disparity.
*/
virtual bool OnDisparityProcess(Object *const in, Object *const out) {
UNUSED(in)
UNUSED(out)
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
@@ -78,8 +78,8 @@ class MYNTEYE_API Plugin {
*/
virtual bool OnDisparityNormalizedProcess(
Object *const in, Object *const out) {
UNUSED(in)
UNUSED(out)
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
@@ -90,8 +90,8 @@ class MYNTEYE_API Plugin {
* @return `true` if you process points.
*/
virtual bool OnPointsProcess(Object *const in, Object *const out) {
UNUSED(in)
UNUSED(out)
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
@@ -102,8 +102,8 @@ class MYNTEYE_API Plugin {
* @return `true` if you process depth.
*/
virtual bool OnDepthProcess(Object *const in, Object *const out) {
UNUSED(in)
UNUSED(out)
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}

View File

@@ -40,7 +40,7 @@ Object *DepthProcessor::OnCreateOutput() {
bool DepthProcessor::OnProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
const ObjMat *input = Object::Cast<ObjMat>(in);
ObjMat *output = Object::Cast<ObjMat>(out);
cv::Mat channels[3 /*input->value.channels()*/];

View File

@@ -44,7 +44,7 @@ Object *DisparityNormalizedProcessor::OnCreateOutput() {
bool DisparityNormalizedProcessor::OnProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
const ObjMat *input = Object::Cast<ObjMat>(in);
ObjMat *output = Object::Cast<ObjMat>(out);
cv::normalize(input->value, output->value, 0, 255, cv::NORM_MINMAX, CV_8UC1);

View File

@@ -74,7 +74,7 @@ Object *DisparityProcessor::OnCreateOutput() {
bool DisparityProcessor::OnProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
const ObjMat2 *input = Object::Cast<ObjMat2>(in);
ObjMat *output = Object::Cast<ObjMat>(out);

View File

@@ -42,7 +42,7 @@ Object *PointsProcessor::OnCreateOutput() {
bool PointsProcessor::OnProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
const ObjMat *input = Object::Cast<ObjMat>(in);
ObjMat *output = Object::Cast<ObjMat>(out);
cv::reprojectImageTo3D(input->value, output->value, Q_, true);

View File

@@ -49,7 +49,7 @@ Object *RectifyProcessor::OnCreateOutput() {
bool RectifyProcessor::OnProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
const ObjMat2 *input = Object::Cast<ObjMat2>(in);
ObjMat2 *output = Object::Cast<ObjMat2>(out);
cv::remap(input->first, output->first, map11, map12, cv::INTER_LINEAR);

View File

@@ -498,7 +498,7 @@ void Synthetic::ProcessNativeStream(
bool Synthetic::OnRectifyProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
if (plugin_ && plugin_->OnRectifyProcess(in, out)) {
return true;
}
@@ -508,7 +508,7 @@ bool Synthetic::OnRectifyProcess(
bool Synthetic::OnDisparityProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
if (plugin_ && plugin_->OnDisparityProcess(in, out)) {
return true;
}
@@ -517,7 +517,7 @@ bool Synthetic::OnDisparityProcess(
bool Synthetic::OnDisparityNormalizedProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
if (plugin_ && plugin_->OnDisparityNormalizedProcess(in, out)) {
return true;
}
@@ -526,7 +526,7 @@ bool Synthetic::OnDisparityNormalizedProcess(
bool Synthetic::OnPointsProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
if (plugin_ && plugin_->OnPointsProcess(in, out)) {
return true;
}
@@ -535,7 +535,7 @@ bool Synthetic::OnPointsProcess(
bool Synthetic::OnDepthProcess(
Object *const in, Object *const out, Processor *const parent) {
UNUSED(parent)
MYNTEYE_UNUSED(parent)
if (plugin_ && plugin_->OnDepthProcess(in, out)) {
return true;
}

View File

@@ -453,7 +453,7 @@ std::size_t from_data(
}
i += 40;
UNUSED(spec_version)
MYNTEYE_UNUSED(spec_version)
return i;
}
@@ -484,7 +484,7 @@ std::size_t from_data(
}
i += 24;
UNUSED(spec_version)
MYNTEYE_UNUSED(spec_version)
return i;
}
@@ -505,7 +505,7 @@ std::size_t from_data(
}
i += 24;
UNUSED(spec_version)
MYNTEYE_UNUSED(spec_version)
return i;
}
@@ -684,7 +684,7 @@ std::size_t to_data(
_to_data(info->nominal_baseline, data + i);
i += 2;
UNUSED(spec_version)
MYNTEYE_UNUSED(spec_version)
// others
std::size_t size = i - 3;
@@ -725,7 +725,7 @@ std::size_t to_data(
}
i += 40;
UNUSED(spec_version)
MYNTEYE_UNUSED(spec_version)
return i;
}
@@ -756,7 +756,7 @@ std::size_t to_data(
}
i += 24;
UNUSED(spec_version)
MYNTEYE_UNUSED(spec_version)
return i;
}
@@ -777,7 +777,7 @@ std::size_t to_data(
}
i += 24;
UNUSED(spec_version)
MYNTEYE_UNUSED(spec_version)
return i;
}

View File

@@ -17,7 +17,8 @@
MYNTEYE_BEGIN_NAMESPACE
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && \
!defined(MYNTEYE_OS_CYGWIN)
namespace {
@@ -62,7 +63,8 @@ bool DL::Open(const char *filename) {
// Close();
return false;
}
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && \
!defined(MYNTEYE_OS_CYGWIN)
handle = LoadLibraryEx(filename, nullptr, 0);
#else
handle = dlopen(filename, RTLD_LAZY);
@@ -84,7 +86,7 @@ void *DL::Sym(const char *symbol) {
VLOG(2) << "Not opened, do nothing";
return nullptr;
}
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && !defined(MYNTEYE_OS_CYGWIN)
void *f = GetProcAddress(handle, symbol);
if (f == nullptr) {
VLOG(2) << "Load symbol failed: " << symbol;
@@ -106,7 +108,7 @@ int DL::Close() {
if (handle == nullptr) {
VLOG(2) << "Not opened, do nothing";
} else {
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && !defined(MYNTEYE_OS_CYGWIN)
ret = FreeLibrary(handle) ? 0 : 1;
#else
ret = dlclose(handle);
@@ -117,7 +119,7 @@ int DL::Close() {
}
const char *DL::Error() {
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && !defined(MYNTEYE_OS_CYGWIN)
return GetLastErrorAsString().c_str();
#else
return dlerror();

View File

@@ -17,7 +17,8 @@
#include "mynteye/mynteye.h"
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && \
!defined(MYNTEYE_OS_CYGWIN)
#include <Windows.h>
#else
#include <dlfcn.h>
@@ -25,7 +26,8 @@
MYNTEYE_BEGIN_NAMESPACE
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && \
!defined(MYNTEYE_OS_CYGWIN)
using DLLIB = HMODULE;
#else
using DLLIB = void *;

View File

@@ -15,7 +15,8 @@
#include "mynteye/logger.h"
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && \
!defined(MYNTEYE_OS_CYGWIN)
#include <direct.h>
#else
#include <sys/stat.h>
@@ -28,9 +29,9 @@ MYNTEYE_BEGIN_NAMESPACE
namespace files {
bool _mkdir(const std::string &path) {
#if defined(OS_MINGW) || defined(OS_CYGWIN)
#if defined(MYNTEYE_OS_MINGW) || defined(MYNTEYE_OS_CYGWIN)
const int status = ::mkdir(path.c_str());
#elif defined(OS_WIN)
#elif defined(MYNTEYE_OS_WIN)
const int status = ::_mkdir(path.c_str());
#else
const int status =
@@ -51,7 +52,7 @@ bool _mkdir(const std::string &path) {
}
bool mkdir(const std::string &path) {
auto &&dirs = strings::split(path, OS_SEP);
auto &&dirs = strings::split(path, MYNTEYE_OS_SEP);
auto &&size = dirs.size();
if (size <= 0)
return false;
@@ -59,7 +60,7 @@ bool mkdir(const std::string &path) {
if (!_mkdir(p))
return false;
for (std::size_t i = 1; i < size; i++) {
p.append(OS_SEP).append(dirs[i]);
p.append(MYNTEYE_OS_SEP).append(dirs[i]);
if (!_mkdir(p))
return false;
}

View File

@@ -186,7 +186,7 @@ inline std::string to_string(
const system_clock::time_point &t, const std::tm *tm,
const char *fmt = "%F %T", std::int32_t precision = 6) {
std::stringstream ss;
#if defined(OS_ANDROID) || defined(OS_LINUX)
#if defined(MYNTEYE_OS_ANDROID) || defined(MYNTEYE_OS_LINUX)
char foo[20];
strftime(foo, sizeof(foo), fmt, tm);
ss << foo;

View File

@@ -113,13 +113,13 @@ int get_product_id(const device &device) {
std::string get_name(const device &device) {
// TODO(JohnZhao)
UNUSED(device)
MYNTEYE_UNUSED(device)
return "";
}
std::string get_video_name(const device &device) {
// TODO(JohnZhao)
UNUSED(device)
MYNTEYE_UNUSED(device)
return "";
}
@@ -127,21 +127,21 @@ bool pu_control_range(
const device &device, Option option, int32_t *min, int32_t *max,
int32_t *def) {
// TODO(JohnZhao)
UNUSED(device)
UNUSED(option)
UNUSED(min)
UNUSED(max)
UNUSED(def)
MYNTEYE_UNUSED(device)
MYNTEYE_UNUSED(option)
MYNTEYE_UNUSED(min)
MYNTEYE_UNUSED(max)
MYNTEYE_UNUSED(def)
return false;
}
bool pu_control_query(
const device &device, Option option, pu_query query, int32_t *value) {
// TODO(JohnZhao)
UNUSED(device)
UNUSED(option)
UNUSED(query)
UNUSED(value)
MYNTEYE_UNUSED(device)
MYNTEYE_UNUSED(option)
MYNTEYE_UNUSED(query)
MYNTEYE_UNUSED(value)
return false;
}
@@ -149,13 +149,13 @@ bool xu_control_range(
const device &device, const xu &xu, uint8_t selector, uint8_t id, int32_t *min,
int32_t *max, int32_t *def) {
// TODO(JohnZhao)
UNUSED(device)
UNUSED(xu)
UNUSED(selector)
UNUSED(id)
UNUSED(min)
UNUSED(max)
UNUSED(def)
MYNTEYE_UNUSED(device)
MYNTEYE_UNUSED(xu)
MYNTEYE_UNUSED(selector)
MYNTEYE_UNUSED(id)
MYNTEYE_UNUSED(min)
MYNTEYE_UNUSED(max)
MYNTEYE_UNUSED(def)
return false;
}
@@ -163,12 +163,12 @@ bool xu_control_query(
const device &device, const xu &xu, uint8_t selector, xu_query query,
uint16_t size, uint8_t *data) {
// TODO(JohnZhao)
UNUSED(device)
UNUSED(xu)
UNUSED(selector)
UNUSED(query)
UNUSED(size)
UNUSED(data)
MYNTEYE_UNUSED(device)
MYNTEYE_UNUSED(xu)
MYNTEYE_UNUSED(selector)
MYNTEYE_UNUSED(query)
MYNTEYE_UNUSED(size)
MYNTEYE_UNUSED(data)
return false;
}
@@ -176,23 +176,23 @@ void set_device_mode(
device &device, int width, int height, int fourcc, int fps, // NOLINT
video_channel_callback callback) {
// TODO(JohnZhao)
UNUSED(device)
UNUSED(width)
UNUSED(height)
UNUSED(fourcc)
UNUSED(fps)
UNUSED(callback)
MYNTEYE_UNUSED(device)
MYNTEYE_UNUSED(width)
MYNTEYE_UNUSED(height)
MYNTEYE_UNUSED(fourcc)
MYNTEYE_UNUSED(fps)
MYNTEYE_UNUSED(callback)
}
void start_streaming(device &device, int num_transfer_bufs) { // NOLINT
// TODO(JohnZhao)
UNUSED(device)
UNUSED(num_transfer_bufs)
MYNTEYE_UNUSED(device)
MYNTEYE_UNUSED(num_transfer_bufs)
}
void stop_streaming(device &device) { // NOLINT
// TODO(JohnZhao)
UNUSED(device)
MYNTEYE_UNUSED(device)
}
} // namespace uvc