Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releaseable point cloud #24

Merged
merged 1 commit into from
Nov 12, 2019
Merged

Releaseable point cloud #24

merged 1 commit into from
Nov 12, 2019

Conversation

trym-b
Copy link
Contributor

@trym-b trym-b commented Nov 6, 2019

Instead of transforming the point cloud directly to a numpy buffer, we
should instead return a intermediate layer, since in the underlying C++
API point cloud exposes various functions such as width and height.

Making buffer releasable also created some technical debt:
assertNotReleased is needed since accessing the underlying a C++ object
after it has been released causes a crash.

@trym-b trym-b requested a review from nedrebo November 6, 2019 10:19
@trym-b trym-b force-pushed the point-cloud-class branch 3 times, most recently from afd9bb0 to 7b3eb09 Compare November 11, 2019 12:31
Copy link
Contributor

@nedrebo nedrebo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Only one comment.

modules/zivid/point_cloud.py Outdated Show resolved Hide resolved
@trym-b trym-b force-pushed the point-cloud-class branch 2 times, most recently from 6b1e370 to d28a15a Compare November 12, 2019 05:40
Instead of transforming the point cloud directly to a numpy buffer, we
should instead return a intermediate layer, since in the underlying C++
API point cloud exposes various functions such as width and height.

Making buffer releasable also created some technical debt:
assertNotReleased is needed since accessing the underlying a C++ object
after it has been released causes a crash.

Ignored flake8's D402, since it mistakenly thought that the paranthesis
in the docstring was the signature of the function.
@trym-b
Copy link
Contributor Author

trym-b commented Nov 12, 2019

Ready for next round.

"""Release the underlying resources."""
self.__impl.release()

def __enter__(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have a mixin or base class or something for these three functions. They are duplicated many places now.

You are just adding to the existing solution, so no need to fix in this PR. But if you agree please add an issue for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably be done through a decorator:

@utils.context_manager
class SomethingThatRequiresContextManager:
    ....

Will create an issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#27

@trym-b trym-b merged commit 31313fe into master Nov 12, 2019
@trym-b trym-b deleted the point-cloud-class branch November 12, 2019 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants