diff --git a/applications/reconstruct/include/ftl/virtual_source.hpp b/applications/reconstruct/include/ftl/virtual_source.hpp index 931bdd5eb48c2e89a893b142f741bb0dbabc959c..b4162ef9750c867eff78822a9294f5b4f19b7f6e 100644 --- a/applications/reconstruct/include/ftl/virtual_source.hpp +++ b/applications/reconstruct/include/ftl/virtual_source.hpp @@ -19,7 +19,7 @@ namespace rgbd { * calculating disparity, before converting to depth. Calibration of the images * is also performed. */ -class VirtualSource : public ftl::rgbd::detail::Source { +class VirtualSource : public ftl::rgbd::BaseSourceImpl { public: VirtualSource(ftl::rgbd::Source*); ~VirtualSource(); diff --git a/components/rgbd-sources/include/ftl/rgbd/detail/source.hpp b/components/rgbd-sources/include/ftl/rgbd/detail/source.hpp index 3ec5903bb9db5e155e82ac6de5bc373cf2722ffd..dc910068bc0c14b9153335cb7b6562a68baa7f2e 100644 --- a/components/rgbd-sources/include/ftl/rgbd/detail/source.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/detail/source.hpp @@ -21,16 +21,13 @@ static const capability_t kCapActive = 0x0004; // An active depth sensor static const capability_t kCapStereo = 0x0008; // Has right RGB static const capability_t kCapDepth = 0x0010; // Has depth capabilities - -namespace detail { - -class Source { +class BaseSourceImpl { public: friend class ftl::rgbd::Source; public: - explicit Source(ftl::rgbd::Source *host) : capabilities_(0), host_(host), params_(state_.getLeft()) { } - virtual ~Source() {} + explicit BaseSourceImpl(ftl::rgbd::Source *host) : capabilities_(0), host_(host), params_(state_.getLeft()) { } + virtual ~BaseSourceImpl() {} /** * Perform hardware data capture. This should be low latency. @@ -60,7 +57,6 @@ class Source { ftl::rgbd::Camera ¶ms_; }; -} } } diff --git a/components/rgbd-sources/include/ftl/rgbd/source.hpp b/components/rgbd-sources/include/ftl/rgbd/source.hpp index b49dc2116d3ab27c12251aaa3f441bddf06eec90..b0bec3cf1e465933a66bc98c66272859ae8cac94 100644 --- a/components/rgbd-sources/include/ftl/rgbd/source.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/source.hpp @@ -143,8 +143,6 @@ class Source : public ftl::Configurable { ftl::rgbd::FrameState &state() { return impl_->state_; } - //void customImplementation(detail::Source *); - SHARED_MUTEX &mutex() { return mutex_; } const FrameCallback &callback() { return callback_; } @@ -166,7 +164,7 @@ class Source : public ftl::Configurable { private: - detail::Source *impl_; + BaseSourceImpl *impl_; Eigen::Matrix4d pose_; ftl::net::Universe *net_; SHARED_MUTEX mutex_; diff --git a/components/rgbd-sources/src/source.cpp b/components/rgbd-sources/src/source.cpp index 49de1578335ce52e6524a1aef29891d7753fe768..77efb6b5df78fd52ed756de6c9e4240046c2922a 100644 --- a/components/rgbd-sources/src/source.cpp +++ b/components/rgbd-sources/src/source.cpp @@ -79,7 +79,7 @@ cv::Mat Source::cameraMatrix() const { return m; } -static ftl::rgbd::detail::Source *createFileImpl(const ftl::URI &uri, Source *host) { +static ftl::rgbd::BaseSourceImpl *createFileImpl(const ftl::URI &uri, Source *host) { std::string path = uri.getPath(); // Note: This is non standard if (uri.getHost() == "." || uri.getHost() == "~") path = uri.getHost()+path; @@ -122,7 +122,7 @@ static ftl::rgbd::detail::Source *createFileImpl(const ftl::URI &uri, Source *ho return nullptr; } -static ftl::rgbd::detail::Source *createDeviceImpl(const ftl::URI &uri, Source *host) { +static ftl::rgbd::BaseSourceImpl *createDeviceImpl(const ftl::URI &uri, Source *host) { if (uri.getPathSegment(0) == "video") { return new StereoVideoSource(host); } else if (uri.getPathSegment(0) == "pylon") { @@ -154,7 +154,7 @@ static ftl::rgbd::detail::Source *createDeviceImpl(const ftl::URI &uri, Source * return nullptr; } -static ftl::rgbd::detail::Source *createImplementation(const std::string &uristr, Source *host) { +static ftl::rgbd::BaseSourceImpl *createImplementation(const std::string &uristr, Source *host) { ftl::URI uri(uristr); if (!uri.isValid()) { LOG(WARNING) << "Invalid URI for source: " << uristr; diff --git a/components/rgbd-sources/src/sources/image/image.hpp b/components/rgbd-sources/src/sources/image/image.hpp index f5017cbe3db11a060709303343c869337c6bb1fa..18212ce87b3905035fd02e0f609561b09c6b56e0 100644 --- a/components/rgbd-sources/src/sources/image/image.hpp +++ b/components/rgbd-sources/src/sources/image/image.hpp @@ -5,12 +5,12 @@ namespace ftl { namespace rgbd { namespace detail { -class ImageSource : public ftl::rgbd::detail::Source { +class ImageSource : public ftl::rgbd::BaseSourceImpl { public: - explicit ImageSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit ImageSource(ftl::rgbd::Source *host) : ftl::rgbd::BaseSourceImpl(host) { } - ImageSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::detail::Source(host) { + ImageSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::BaseSourceImpl(host) { } diff --git a/components/rgbd-sources/src/sources/middlebury/middlebury_source.cpp b/components/rgbd-sources/src/sources/middlebury/middlebury_source.cpp index 372963906a0c03346f88e20811b5ef03fd374f9b..656310c26a96730de4dec8cd37b72ae592bc9a9d 100644 --- a/components/rgbd-sources/src/sources/middlebury/middlebury_source.cpp +++ b/components/rgbd-sources/src/sources/middlebury/middlebury_source.cpp @@ -10,7 +10,7 @@ using ftl::rgbd::detail::Disparity; using std::string; MiddleburySource::MiddleburySource(ftl::rgbd::Source *host) - : ftl::rgbd::detail::Source(host), ready_(false) { + : ftl::rgbd::BaseSourceImpl(host), ready_(false) { // Not VALID } @@ -62,7 +62,7 @@ static bool loadMiddleburyCalib(const std::string &filename, ftl::rgbd::Camera & } MiddleburySource::MiddleburySource(ftl::rgbd::Source *host, const string &dir) - : ftl::rgbd::detail::Source(host), ready_(false) { + : ftl::rgbd::BaseSourceImpl(host), ready_(false) { double scaling = host->value("scaling", 0.5); diff --git a/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp b/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp index d1243a17b0a6ca7ac8e1198cda1ca3c47586e37e..f89bfd6655fb719eb8125aa7f8d13568abb89736 100644 --- a/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp +++ b/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp @@ -13,7 +13,7 @@ namespace detail { class Disparity; -class MiddleburySource : public detail::Source { +class MiddleburySource : public BaseSourceImpl { public: explicit MiddleburySource(ftl::rgbd::Source *); MiddleburySource(ftl::rgbd::Source *, const std::string &dir); diff --git a/components/rgbd-sources/src/sources/pylon/pylon.cpp b/components/rgbd-sources/src/sources/pylon/pylon.cpp index 223d201f72cb20879b887a49bfadd9e6be385fa5..87eff0c3d4aeb21d5c9b92f3bef7f0d98bc7a1d1 100644 --- a/components/rgbd-sources/src/sources/pylon/pylon.cpp +++ b/components/rgbd-sources/src/sources/pylon/pylon.cpp @@ -16,7 +16,7 @@ using cv::cuda::GpuMat; using namespace Pylon; PylonSource::PylonSource(ftl::rgbd::Source *host) - : ftl::rgbd::detail::Source(host), ready_(false), lcam_(nullptr), rcam_(nullptr) { + : ftl::rgbd::BaseSourceImpl(host), ready_(false), lcam_(nullptr), rcam_(nullptr) { capabilities_ = kCapVideo; auto &inst = CTlFactory::GetInstance(); diff --git a/components/rgbd-sources/src/sources/pylon/pylon.hpp b/components/rgbd-sources/src/sources/pylon/pylon.hpp index 2d0a82261de809bd312db5735733a970af136678..fe6be490ce5a16010ae87933058ea5ddd0bac16b 100644 --- a/components/rgbd-sources/src/sources/pylon/pylon.hpp +++ b/components/rgbd-sources/src/sources/pylon/pylon.hpp @@ -15,7 +15,7 @@ namespace rgbd { namespace detail { -class PylonSource : public ftl::rgbd::detail::Source { +class PylonSource : public ftl::rgbd::BaseSourceImpl { public: explicit PylonSource(ftl::rgbd::Source *host); ~PylonSource(); diff --git a/components/rgbd-sources/src/sources/realsense/realsense_source.cpp b/components/rgbd-sources/src/sources/realsense/realsense_source.cpp index 2f95799bc7d4eeef992f292e07bf6d6c47bf8fc8..57e212027a454fcfe147d8d2e8cca51dea63bf42 100644 --- a/components/rgbd-sources/src/sources/realsense/realsense_source.cpp +++ b/components/rgbd-sources/src/sources/realsense/realsense_source.cpp @@ -9,7 +9,7 @@ using ftl::codecs::Channel; using cv::cuda::GpuMat; RealsenseSource::RealsenseSource(ftl::rgbd::Source *host) - : ftl::rgbd::detail::Source(host), align_to_depth_(RS2_STREAM_COLOR) { + : ftl::rgbd::BaseSourceImpl(host), align_to_depth_(RS2_STREAM_COLOR) { capabilities_ = kCapVideo; rs2::config cfg; diff --git a/components/rgbd-sources/src/sources/realsense/realsense_source.hpp b/components/rgbd-sources/src/sources/realsense/realsense_source.hpp index a4c7baa49c74e102f287b8a71d8038a99243ed1d..a0b730e8e58382522ab1a43df13ec3e04ede1e26 100644 --- a/components/rgbd-sources/src/sources/realsense/realsense_source.hpp +++ b/components/rgbd-sources/src/sources/realsense/realsense_source.hpp @@ -12,7 +12,7 @@ namespace rgbd { namespace detail { -class RealsenseSource : public ftl::rgbd::detail::Source { +class RealsenseSource : public ftl::rgbd::BaseSourceImpl { public: explicit RealsenseSource(ftl::rgbd::Source *host); ~RealsenseSource(); diff --git a/components/rgbd-sources/src/sources/screencapture/screencapture.cpp b/components/rgbd-sources/src/sources/screencapture/screencapture.cpp index 9c7a210528a2b4b06d8312b7a453249373435912..39ec56c096335233b7ac4e98ce427c53cbaf1bea 100644 --- a/components/rgbd-sources/src/sources/screencapture/screencapture.cpp +++ b/components/rgbd-sources/src/sources/screencapture/screencapture.cpp @@ -55,7 +55,7 @@ static Eigen::Matrix4d matrix(const cv::Vec3d &rvec, const cv::Vec3d &tvec) { ScreenCapture::ScreenCapture(ftl::rgbd::Source *host) - : ftl::rgbd::detail::Source(host) { + : ftl::rgbd::BaseSourceImpl(host) { capabilities_ = kCapVideo; ready_ = false; diff --git a/components/rgbd-sources/src/sources/screencapture/screencapture.hpp b/components/rgbd-sources/src/sources/screencapture/screencapture.hpp index f5cb50b4a02b48303dccedeb2b205fa7fe9d3736..d753ada43ea0a9d76e085e98886c3ad78f514e24 100644 --- a/components/rgbd-sources/src/sources/screencapture/screencapture.hpp +++ b/components/rgbd-sources/src/sources/screencapture/screencapture.hpp @@ -17,7 +17,7 @@ typedef X11State ImplState; typedef int ImplState; #endif -class ScreenCapture : public ftl::rgbd::detail::Source { +class ScreenCapture : public ftl::rgbd::BaseSourceImpl { public: explicit ScreenCapture(ftl::rgbd::Source *host); ~ScreenCapture(); diff --git a/components/rgbd-sources/src/sources/snapshot/snapshot_source.cpp b/components/rgbd-sources/src/sources/snapshot/snapshot_source.cpp index 95d8b9e078bf4904e66b70adc0f2df31591f4848..2179b2719a136b7e64ad4f8c24524d6168ae8cc1 100644 --- a/components/rgbd-sources/src/sources/snapshot/snapshot_source.cpp +++ b/components/rgbd-sources/src/sources/snapshot/snapshot_source.cpp @@ -15,7 +15,7 @@ using ftl::codecs::Channel; using std::string; using std::vector; -SnapshotSource::SnapshotSource(ftl::rgbd::Source *host, Snapshot &snapshot, const string &id) : detail::Source(host) { +SnapshotSource::SnapshotSource(ftl::rgbd::Source *host, Snapshot &snapshot, const string &id) : BaseSourceImpl(host) { snapshot_ = snapshot; camera_idx_ = std::atoi(id.c_str()); frame_idx_ = 0; diff --git a/components/rgbd-sources/src/sources/snapshot/snapshot_source.hpp b/components/rgbd-sources/src/sources/snapshot/snapshot_source.hpp index 80a0bf392b39fb9d5215dd80034768d806ac7957..a6149dec3b2f82b0fd10f7a70758250a951ed72b 100644 --- a/components/rgbd-sources/src/sources/snapshot/snapshot_source.hpp +++ b/components/rgbd-sources/src/sources/snapshot/snapshot_source.hpp @@ -11,7 +11,7 @@ namespace ftl { namespace rgbd { namespace detail { -class SnapshotSource : public detail::Source { +class SnapshotSource : public BaseSourceImpl { public: explicit SnapshotSource(ftl::rgbd::Source *); SnapshotSource(ftl::rgbd::Source *, ftl::rgbd::Snapshot &snapshot, const std::string &id); diff --git a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp index 0bbbb4aec4a28ade280bca363bae9754a19f515d..9ccb320dfa7363952c5587e8f451884f5d56dc39 100644 --- a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp +++ b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp @@ -42,12 +42,12 @@ ftl::rgbd::detail::Device::~Device() { } StereoVideoSource::StereoVideoSource(ftl::rgbd::Source *host) - : ftl::rgbd::detail::Source(host), ready_(false) { + : ftl::rgbd::BaseSourceImpl(host), ready_(false) { init(""); } StereoVideoSource::StereoVideoSource(ftl::rgbd::Source *host, const string &file) - : ftl::rgbd::detail::Source(host), ready_(false) { + : ftl::rgbd::BaseSourceImpl(host), ready_(false) { init(file); } diff --git a/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp b/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp index 4d0c3795ab9c0af6e86b717925ac503a3825ad03..54f2d5e12ed6ba62d77af88430328a3a46e57d59 100644 --- a/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp +++ b/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp @@ -19,7 +19,7 @@ class Disparity; * RGBD source from either a stereo video file with left + right images, or * direct from two camera devices. */ -class StereoVideoSource : public detail::Source { +class StereoVideoSource : public BaseSourceImpl { public: explicit StereoVideoSource(ftl::rgbd::Source*); StereoVideoSource(ftl::rgbd::Source*, const std::string &); diff --git a/components/rgbd-sources/test/source_unit.cpp b/components/rgbd-sources/test/source_unit.cpp index 37b9224c0d5bf288a9b16091a71624afdf02dcf4..365088c42318ac16f6cd9ffb0a83688b9eb38d78 100644 --- a/components/rgbd-sources/test/source_unit.cpp +++ b/components/rgbd-sources/test/source_unit.cpp @@ -30,12 +30,12 @@ class Player { namespace detail { -class ImageSource : public ftl::rgbd::detail::Source { +class ImageSource : public ftl::rgbd::BaseSourceImpl { public: - explicit ImageSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit ImageSource(ftl::rgbd::Source *host) : ftl::rgbd::BaseSourceImpl(host) { last_type = "image"; } - ImageSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::detail::Source(host) { + ImageSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::BaseSourceImpl(host) { last_type = "image"; } @@ -44,9 +44,9 @@ class ImageSource : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class ScreenCapture : public ftl::rgbd::detail::Source { +class ScreenCapture : public ftl::rgbd::BaseSourceImpl { public: - explicit ScreenCapture(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit ScreenCapture(ftl::rgbd::Source *host) : ftl::rgbd::BaseSourceImpl(host) { last_type = "screen"; } @@ -55,12 +55,12 @@ class ScreenCapture : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class StereoVideoSource : public ftl::rgbd::detail::Source { +class StereoVideoSource : public ftl::rgbd::BaseSourceImpl { public: - explicit StereoVideoSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit StereoVideoSource(ftl::rgbd::Source *host) : ftl::rgbd::BaseSourceImpl(host) { last_type = "video"; } - StereoVideoSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::detail::Source(host) { + StereoVideoSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::BaseSourceImpl(host) { last_type = "video"; } @@ -69,9 +69,9 @@ class StereoVideoSource : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class NetSource : public ftl::rgbd::detail::Source { +class NetSource : public ftl::rgbd::BaseSourceImpl { public: - explicit NetSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit NetSource(ftl::rgbd::Source *host) : ftl::rgbd::BaseSourceImpl(host) { last_type = "net"; } @@ -80,9 +80,9 @@ class NetSource : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class SnapshotSource : public ftl::rgbd::detail::Source { +class SnapshotSource : public ftl::rgbd::BaseSourceImpl { public: - SnapshotSource(ftl::rgbd::Source *host, ftl::rgbd::Snapshot &r, const std::string &) : ftl::rgbd::detail::Source(host) { + SnapshotSource(ftl::rgbd::Source *host, ftl::rgbd::Snapshot &r, const std::string &) : ftl::rgbd::BaseSourceImpl(host) { last_type = "snapshot"; } @@ -91,9 +91,9 @@ class SnapshotSource : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class FileSource : public ftl::rgbd::detail::Source { +class FileSource : public ftl::rgbd::BaseSourceImpl { public: - FileSource(ftl::rgbd::Source *host, ftl::rgbd::Player *r, int) : ftl::rgbd::detail::Source(host) { + FileSource(ftl::rgbd::Source *host, ftl::rgbd::Player *r, int) : ftl::rgbd::BaseSourceImpl(host) { last_type = "filesource"; } @@ -102,9 +102,9 @@ class FileSource : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class RealsenseSource : public ftl::rgbd::detail::Source { +class RealsenseSource : public ftl::rgbd::BaseSourceImpl { public: - explicit RealsenseSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit RealsenseSource(ftl::rgbd::Source *host) : ftl::rgbd::BaseSourceImpl(host) { last_type = "realsense"; } @@ -113,9 +113,9 @@ class RealsenseSource : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class PylonSource : public ftl::rgbd::detail::Source { +class PylonSource : public ftl::rgbd::BaseSourceImpl { public: - explicit PylonSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit PylonSource(ftl::rgbd::Source *host) : ftl::rgbd::BaseSourceImpl(host) { last_type = "pylon"; } @@ -124,9 +124,9 @@ class PylonSource : public ftl::rgbd::detail::Source { bool isReady() { return true; }; }; -class MiddleburySource : public ftl::rgbd::detail::Source { +class MiddleburySource : public ftl::rgbd::BaseSourceImpl { public: - MiddleburySource(ftl::rgbd::Source *host, const std::string &dir) : ftl::rgbd::detail::Source(host) { + MiddleburySource(ftl::rgbd::Source *host, const std::string &dir) : ftl::rgbd::BaseSourceImpl(host) { last_type = "middlebury"; }