-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
OctreeIterators special member revision #2108
OctreeIterators special member revision #2108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try PCL.Octree_Test
on your machine? Seems to segfault on Travis.
: OctreeIteratorBase<OctreeT> (other) | ||
, stack_ (other.stack_) | ||
{ | ||
this->current_state_ = stack_.size()? &stack_.back() : NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style
Also, can you please explain why we don't inherit the state from other, i.e. this->current_state_ = other.current_state_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna redirect you to the explanation I gave @frozar when I had a first look at the copy constructor fix he did. Let me know in case you need further clarification. Here's the link #1983 (comment)
The important point to remember is that current_state_
points to an address, which is normally the back element of the stack or the front of the FIFO vector (depending on the type of iterator) and when you perform the copy, this pointer needs to be updated the equivalent element of the stack/fifo container your object has. Also notice that current_state_
is not a direct pointer to an octree node. Hence it can't be simply copied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, makes sense.
: OctreeIteratorBase<OctreeT> (other) | ||
, FIFO_ (other.FIFO_) | ||
{ | ||
this->current_state_ = FIFO_.size()? &FIFO_.front () : NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style
No. It was 4 am already when I pushed this. I just decided to let Travis do it's job over the night :) |
If it may help, I use this line to compile octree test on my machine (it's quick enough to get the binary): cmake -DPCL_ONLY_CORE_POINT_TYPES=ON -DPCL_NO_PRECOMPILE=ON -DBUILD_tools=OFF -DBUILD_examples=OFF -DBUILD_apps=OFF -DBUILD_2d=OFF -DBUILD_features=OFF -DBUILD_filters=OFF -DBUILD_geometry=OFF -DBUILD_io=OFF -DBUILD_kdtree=OFF -DBUILD_keypoints=OFF -DBUILD_ml=OFF -DBUILD_octree=ON -DBUILD_outofcore=OFF -DBUILD_people=OFF -DBUILD_recognition=OFF -DBUILD_registration=OFF -DBUILD_sample_consensus=OFFF -DBUILD_search=OFF -DBUILD_segmentation=OFF -DBUILD_simulation=OFF -DBUILD_stereo=OFF -DBUILD_surface=OFF -DBUILD_tracking=OFF -DBUILD_visualization=OFF -DBUILD_global_tests=ON -DBUILD_tests_2d=OFF -DBUILD_tests_common=OFF -DBUILD_tests_features=OFF -DBUILD_tests_filters=OFF -DBUILD_tests_geometry=OFF -DBUILD_tests_io=OFF -DBUILD_tests_kdtree=OFF -DBUILD_tests_keypoints=OFF -DBUILD_tests_octree=ON -DBUILD_tests_outofcore=OFF -DBUILD_tests_people=OFF -DBUILD_tests_recognition=OFF -DBUILD_tests_registration=OFF -DBUILD_tests_sample_consensus=OFF -DBUILD_tests_search=OFF -DBUILD_tests_segmentation=OFF -DBUILD_tests_surface=OFF -DBUILD_tests_visualization=OFF -DGTEST_INCLUDE_DIR=/home/frozar/soft/googletest/googletest/include -DGTEST_SRC_DIR=/home/frozar/soft/googletest/googletest -DCMAKE_BUILD_TYPE=Debug .. && make -j8 test_octree test_octree_iterator @taketwo is right, |
: OctreeIteratorBase<OctreeT> (other) | ||
, stack_ (other.stack_) | ||
{ | ||
this->current_state_ = stack_.size()? &stack_.back() : NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, makes sense.
( max_octree_depth_ == other.max_octree_depth_) ); | ||
return (this == &other) || | ||
((octree_ == other.octree_) && | ||
(current_state_ == other.current_state_) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then here we should dereference, right? Otherwise this is never true.
(Plus protection from dereferencing null pointer).
The end iterators we're being constructed in a defective manner. The moment, we wrote a "proper" iterator equivalence/inequality they started failing of course. These latest changes fix #2064 as well. The PR now lacks tests for checking the newly defined begin/end operators. To be added later. |
In a separate PR? Should I merge this? |
I’ll add on this PR.
|
Can I just squash, or do you want to rearrange commits in some certain way? |
e4ec8f8
to
2e0a4e7
Compare
Squashed and rebased on top of master for that additional appveyor checkup. |
Ok, scratch that. I think I will just make two commits:
|
* Revised the implementations of the following operators - Copy constructors - Copy assignment - Destructors - Equality - Inequality * Added unit tests
- Added full parameter constructor for the octree iterators. - Modified Octree end iterators construction - Added unit tests for octree begin/end iterators
2e0a4e7
to
ce26217
Compare
Revised the implementations of the following operators
Added unit tests to validate all changes.
#1983 is meant to be applied after this one.
Edit: Fixes #2064