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

Clean up Filter and FilterIndices, move indices_/input_ from public to protected section #3726

Merged

Conversation

SergioRAgostinho
Copy link
Member

Just did some class cleanup while prototyping the new SamplingFilter class.

@SergioRAgostinho SergioRAgostinho added needs: code review Specify why not closed/merged yet module: filters labels Mar 10, 2020
@kunaltyagi kunaltyagi added changelog: API break Meta-information for changelog generation needs: pr merge Specify why not closed/merged yet labels Mar 10, 2020
@kunaltyagi kunaltyagi changed the title Clean up Filter and FilterIndices classes Clean up Filter and FilterIndices API Mar 10, 2020
@kunaltyagi kunaltyagi added needs: pr merge Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet needs: pr merge Specify why not closed/merged yet labels Mar 15, 2020
@kunaltyagi kunaltyagi added this to the pcl-1.11.0 milestone Mar 15, 2020
@kunaltyagi kunaltyagi removed the needs: pr merge Specify why not closed/merged yet label Mar 28, 2020
Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

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

LGTM, but where is API break?

@kunaltyagi
Copy link
Member

filters/include/pcl/filters/filter.h doesn't export private variables anymore. It's also a fix so maybe we can add that too.

@taketwo taketwo changed the title Clean up Filter and FilterIndices API Clean up Filter and FilterIndices, move indices_/input_ from public to protected section Mar 29, 2020
@taketwo
Copy link
Member

taketwo commented Mar 29, 2020

Filter is an abstract class, so nobody used it directly. Doesn't this mean that nobody can be affected by this move?

@kunaltyagi
Copy link
Member

All classes inheriting from Filter now don't have those variables available freely. Anyone deriving from Filter directly or indirectly has to modify their code IFF they use these variables.

@taketwo
Copy link
Member

taketwo commented Mar 29, 2020

Please elaborate more, I still don't get. The following code is similar to what we have, but is not affected by access modifier change (C++ shell link):

#include <iostream>

class A {
protected:
  int foo = 1;
};

class B : public A {
public:  // changing this to protected does not break code
  using A::foo;
};

class C : public B {
public:
  using B::foo;
};

int main()
{
  C c;
  std::cout << c.foo << std::endl;
}

@kunaltyagi
Copy link
Member

Remove using B::foo; and then change the using A::foo; to protected

@taketwo
Copy link
Member

taketwo commented Mar 30, 2020

OK, but this only affects the "external" usage of the fields then.

Anyone deriving from Filter directly or indirectly has to modify their code IFF they use these variables.

If I understand right, the fields are still accessible in the deriving classes, it's just that they are not public.

@kunaltyagi
Copy link
Member

the fields are still accessible in the deriving classes, it's just that they are not public

Yes, you'd be right. This does mean an API break right? Code stops compiling = API break. Code stops linking = ABI break.

@SergioRAgostinho
Copy link
Member Author

SergioRAgostinho commented Mar 30, 2020

Strictly speaking, this is an API breakage situation. Even if it was a mistake in the first place to expose these fields.

@SergioRAgostinho SergioRAgostinho merged commit e20e9a5 into PointCloudLibrary:master Mar 30, 2020
@SergioRAgostinho SergioRAgostinho deleted the filters-interface branch March 30, 2020 12:57
@taketwo
Copy link
Member

taketwo commented Mar 31, 2020

OK, agree, this is an API break. And we skip the deprecation ritual because this was a mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: API break Meta-information for changelog generation module: filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants