Skip to content

Commit

Permalink
Add ability to query marker data from FlatScene object.
Browse files Browse the repository at this point in the history
Issue #114
  • Loading branch information
david-cattermole committed Jan 2, 2022
1 parent b1b16cd commit b0cbf88
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/mmscenegraph/cppbind/include/mmscenegraph/_cxxbridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,10 @@ struct ShimSceneGraph final : public ::rust::Opaque {
#ifndef CXXBRIDGE1_STRUCT_mmscenegraph$ShimFlatScene
#define CXXBRIDGE1_STRUCT_mmscenegraph$ShimFlatScene
struct ShimFlatScene final : public ::rust::Opaque {
MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> markers() const noexcept;
MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> points() const noexcept;
MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> deviations() const noexcept;
MMSCENEGRAPH_API_EXPORT ::std::size_t num_markers() const noexcept;
MMSCENEGRAPH_API_EXPORT ::std::size_t num_points() const noexcept;
MMSCENEGRAPH_API_EXPORT ::std::size_t num_deviations() const noexcept;
MMSCENEGRAPH_API_EXPORT void evaluate(const ::rust::Box<::mmscenegraph::ShimAttrDataBlock> &attrdb, ::rust::Slice<const ::std::uint32_t> frame_list) noexcept;
Expand Down
9 changes: 8 additions & 1 deletion src/mmscenegraph/cppbind/include/mmscenegraph/flatscene.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class FlatScene {
MMSCENEGRAPH_API_EXPORT
FlatScene(rust::Box<ShimFlatScene> flat_scene) noexcept;

MMSCENEGRAPH_API_EXPORT
rust::Slice<const Real>
markers() const noexcept;

MMSCENEGRAPH_API_EXPORT
rust::Slice<const Real>
points() const noexcept;
Expand All @@ -45,6 +49,10 @@ class FlatScene {
rust::Slice<const Real>
deviations() const noexcept;

MMSCENEGRAPH_API_EXPORT
size_t
num_markers() const noexcept;

MMSCENEGRAPH_API_EXPORT
size_t
num_points() const noexcept;
Expand All @@ -60,7 +68,6 @@ class FlatScene {
std::vector<FrameValue> &frames
) noexcept;


private:
rust::Box<ShimFlatScene> inner_;
};
Expand Down
13 changes: 13 additions & 0 deletions src/mmscenegraph/cppbind/src/_cxxbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,10 @@ struct ShimSceneGraph final : public ::rust::Opaque {
#ifndef CXXBRIDGE1_STRUCT_mmscenegraph$ShimFlatScene
#define CXXBRIDGE1_STRUCT_mmscenegraph$ShimFlatScene
struct ShimFlatScene final : public ::rust::Opaque {
MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> markers() const noexcept;
MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> points() const noexcept;
MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> deviations() const noexcept;
MMSCENEGRAPH_API_EXPORT ::std::size_t num_markers() const noexcept;
MMSCENEGRAPH_API_EXPORT ::std::size_t num_points() const noexcept;
MMSCENEGRAPH_API_EXPORT ::std::size_t num_deviations() const noexcept;
MMSCENEGRAPH_API_EXPORT void evaluate(const ::rust::Box<::mmscenegraph::ShimAttrDataBlock> &attrdb, ::rust::Slice<const ::std::uint32_t> frame_list) noexcept;
Expand Down Expand Up @@ -1265,10 +1267,14 @@ ::mmscenegraph::ShimSceneGraph *mmscenegraph$cxxbridge1$shim_create_scene_graph_
::std::size_t mmscenegraph$cxxbridge1$ShimFlatScene$operator$sizeof() noexcept;
::std::size_t mmscenegraph$cxxbridge1$ShimFlatScene$operator$alignof() noexcept;

::rust::repr::Fat mmscenegraph$cxxbridge1$ShimFlatScene$markers(const ::mmscenegraph::ShimFlatScene &self) noexcept;

::rust::repr::Fat mmscenegraph$cxxbridge1$ShimFlatScene$points(const ::mmscenegraph::ShimFlatScene &self) noexcept;

::rust::repr::Fat mmscenegraph$cxxbridge1$ShimFlatScene$deviations(const ::mmscenegraph::ShimFlatScene &self) noexcept;

::std::size_t mmscenegraph$cxxbridge1$ShimFlatScene$num_markers(const ::mmscenegraph::ShimFlatScene &self) noexcept;

::std::size_t mmscenegraph$cxxbridge1$ShimFlatScene$num_points(const ::mmscenegraph::ShimFlatScene &self) noexcept;

::std::size_t mmscenegraph$cxxbridge1$ShimFlatScene$num_deviations(const ::mmscenegraph::ShimFlatScene &self) noexcept;
Expand Down Expand Up @@ -1643,6 +1649,10 @@ ::std::size_t ShimFlatScene::layout::align() noexcept {
return mmscenegraph$cxxbridge1$ShimFlatScene$operator$alignof();
}

MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> ShimFlatScene::markers() const noexcept {
return ::rust::impl<::rust::Slice<const double>>::slice(mmscenegraph$cxxbridge1$ShimFlatScene$markers(*this));
}

MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> ShimFlatScene::points() const noexcept {
return ::rust::impl<::rust::Slice<const double>>::slice(mmscenegraph$cxxbridge1$ShimFlatScene$points(*this));
}
Expand All @@ -1651,6 +1661,9 @@ MMSCENEGRAPH_API_EXPORT ::rust::Slice<const double> ShimFlatScene::deviations()
return ::rust::impl<::rust::Slice<const double>>::slice(mmscenegraph$cxxbridge1$ShimFlatScene$deviations(*this));
}

MMSCENEGRAPH_API_EXPORT ::std::size_t ShimFlatScene::num_markers() const noexcept {
return mmscenegraph$cxxbridge1$ShimFlatScene$num_markers(*this);
}

MMSCENEGRAPH_API_EXPORT ::std::size_t ShimFlatScene::num_points() const noexcept {
return mmscenegraph$cxxbridge1$ShimFlatScene$num_points(*this);
Expand Down
3 changes: 3 additions & 0 deletions src/mmscenegraph/cppbind/src/cxxbridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,11 @@ pub mod ffi {
extern "Rust" {
type ShimFlatScene;

fn markers(&self) -> &[f64];
fn points(&self) -> &[f64];
fn deviations(&self) -> &[f64];

fn num_markers(&self) -> usize;
fn num_points(&self) -> usize;
fn num_deviations(&self) -> usize;

Expand Down
14 changes: 14 additions & 0 deletions src/mmscenegraph/cppbind/src/flatscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,19 @@

namespace mmscenegraph {

FlatScene::FlatScene() noexcept
: inner_(shim_create_flat_scene_box()) {
}

FlatScene::FlatScene(rust::Box<ShimFlatScene> flat_scene) noexcept
: inner_(std::move(flat_scene)) {
}

rust::Slice<const Real>
FlatScene::markers() const noexcept {
return inner_->markers();
}

rust::Slice<const Real>
FlatScene::points() const noexcept {
return inner_->points();
Expand All @@ -39,6 +48,11 @@ FlatScene::deviations() const noexcept {
return inner_->deviations();
}

size_t
FlatScene::num_markers() const noexcept {
return inner_->num_markers();
}

size_t
FlatScene::num_points() const noexcept {
return inner_->num_points();
Expand Down
8 changes: 8 additions & 0 deletions src/mmscenegraph/cppbind/src/flatscene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ impl ShimFlatScene {
&self.inner
}

pub fn markers(&self) -> &[CoreReal] {
&self.inner.markers()
}

pub fn points(&self) -> &[CoreReal] {
&self.inner.points()
}
Expand All @@ -46,6 +50,10 @@ impl ShimFlatScene {
&self.inner.deviations()
}

pub fn num_markers(&self) -> usize {
self.inner.num_markers()
}

pub fn num_points(&self) -> usize {
self.inner.num_points()
}
Expand Down

0 comments on commit b0cbf88

Please sign in to comment.