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
MINIFICPP-14: Prune class names. Add option to config #643
Conversation
This is an old PR I created a while ago. I rebased, but should probably go through it myself to clean it up. Here is the example output
versus
|
libminifi/src/utils/ClassUtils.cpp
Outdated
namespace minifi { | ||
namespace utils { | ||
|
||
void ClassUtils::shortenClassName(const std::string &class_name, std::string &out) { |
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.
In case it's void, what's the motivation behind an output parameter, why not just return it?
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.
There are several pros and cons but following suit for some of the other API calls I should have returned true/false if shortening occurred. I like the idea of using output variables and since I'm already following other API utils classes I'll make that change. Thanks!
libminifi/include/utils/ClassUtils.h
Outdated
* @param class_name input class name | ||
* @param out output class name that is shortened. | ||
*/ | ||
extern void shortenClassName(const std::string &class_name, std::string &out); |
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.
Why do we need extern here? Libminifi build should be wholearchive anyway.
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 for pointing this out! It's not needed as is superfluous in header files.
It was copied from the original location ( the source file ), in which case the use of wholarchive didn't help locate during the linking phase -- but when rebasing this PR I moved this to the header, at which point it's actually already externalized across translation units.
namespace nifi { | ||
namespace minifi { | ||
namespace utils { | ||
namespace ClassUtils { |
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.
This is cool to have, I like it!
I also think some of the tempalte functions we already have (getClassName<T>
and getClassNames<T>
) could also be moved to here from classloader.
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.
Good idea. made a follow on.
// if no update can be performed, return false to let the developer know | ||
// this. Out will have no updates | ||
return false; | ||
} | ||
} | ||
for (auto &elem : class_split) { | ||
if (&elem != &class_split.back() && elem.size() > 1) { |
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.
Tricky :)
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.
LGTM
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically master)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.