Skip to content

manual port of unique ptr pr #58

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

Merged
merged 5 commits into from
Oct 31, 2017
Merged

manual port of unique ptr pr #58

merged 5 commits into from
Oct 31, 2017

Conversation

wjwwood
Copy link
Member

@wjwwood wjwwood commented Oct 26, 2017

manual port of #38

This was painful 😄. I think class_loader needs to be brought closer to the ROS 1 version as I've been trying to do with pluginlib, but for now this lets me move forward.

@wjwwood wjwwood self-assigned this Oct 26, 2017
@wjwwood wjwwood changed the title manual port of https://github.com/ros/class_loader/pull/38 manual port of unique ptr pr Oct 26, 2017
@wjwwood
Copy link
Member Author

wjwwood commented Oct 26, 2017

Travis is failing due to poco not building with an error about the c++14 flag. I'll run ci.ros2.org CI instead.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@wjwwood
Copy link
Member Author

wjwwood commented Oct 27, 2017

Finally figured out the issue on Windows (I think).

@wjwwood
Copy link
Member Author

wjwwood commented Oct 27, 2017

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@wjwwood
Copy link
Member Author

wjwwood commented Oct 28, 2017

@mikaelarguedas I still don't know about the travis ci, but the other CI is green. Can you re-review?

@mikaelarguedas
Copy link
Member

Yep will do, not sure I'll have time to look at it today though.

I still don't know about the travis ci

Yeah it appeared on other PRs too (some discussion here), I didnt have time to look into it but it's not due to this change 👍

Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

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

Thanks @wjwwood for the painful port! (I feel you), I may have one or two comments so I'll wait until tomorrow to finish reviewing and merging.

return *i;
}
}
return nullptr;
Copy link
Member

Choose a reason for hiding this comment

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

looks like sometime you use NULL to match the ROS1 version and sometimes nullptr. Any reason this ones uses another one than the one from upstream?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's just habit (to use nullptr). It's better to use than NULL, but also C++11 only:

http://en.cppreference.com/w/cpp/language/nullptr

I'll replace this with NULL for now, so it's closer to the ROS 1 style.

Copy link
Member Author

Choose a reason for hiding this comment

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

I left two which are within a c++11 block and so they can use nullptr safely.

Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

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

Thanks @wjwwood for iterating. Change looks good to me, I have one question inline about some mismatch in documentation.
I don't mind fixing the nitpicks myself

* @param derived_class_name The name of the class we want to create (@see getAvailableClasses())
* It is not necessary for the user to call loadLibrary() as it will be
* invoked automatically if the library is not yet loaded (which typically
* happens when in "On Demand Load/Unload" mode).
Copy link
Member

Choose a reason for hiding this comment

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

looking at the upstream PR, some comment content has not been propagated:

     * Creating an unmanaged instance disables dynamically unloading libraries when
     * managed pointers go out of scope for all class loaders in this process.

}

/**
* @brief Creates an instance of an object of given class name with ancestor class Base
Copy link
Member

Choose a reason for hiding this comment

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

Nit: all other functions in this PR have the brief outside of the commented block with ///

/**
* It is not necessary for the user to call loadLibrary() as it will be
* invoked automatically.
* If the library is not yet loaded (which typically happens when in
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think this is the continuation of the previous sentence and not a new one (same below)

/**
* It is not necessary for the user to call loadLibrary() as it will be
* invoked automatically.
* if the library is not yet loaded (which typically happens when in
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think this is the continuation of the previous sentence and not a new one

@wjwwood
Copy link
Member Author

wjwwood commented Oct 31, 2017

No worries, I think I addressed all the nitpicks.

@mikaelarguedas
Copy link
Member

No worries, I think I addressed all the nitpicks.

👍 looks good to me, merging

@mikaelarguedas mikaelarguedas merged commit adcb526 into ros2 Oct 31, 2017
@mikaelarguedas mikaelarguedas deleted the port_pr38 branch October 31, 2017 23:05
@mikaelarguedas
Copy link
Member

@wjwwood FYI: Big oversight on my side, I mostly compared the changes to the ported ROS1 PR but didnt take into account the ROS2 context. This new test require both catkin and boost so we will need to change this to get them to run in ROS2.
But first we'll need to reenable previous tests and make them pass before focusing on this one.
I'll track this on #59

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2017

Oops, my bad too. I didn't even think about it after it compiled and ran some tests which passed :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants