Hmm. I’ve been trying to keep the C++ class hierarchy “single inheritance” only to keep things simple to understand. So I think your good question has two possible answers:
- The quick slightly ugly answer is to inherit from SinglePortPlugin (via ProtobufPlugin or whatver) and then override
/**
* @return true if you want to receive the specified portnum
*/
virtual bool wantPortnum(PortNum p) { return ... true if p is in the range we care about }
- The prettier answer would be that I should have perhaps allowed multiple inheritance here. And ‘SinglePortFilter’ should have been a ‘mixin’ class that anyone could multiply inherit from if needed. How about let’s wait to see if this is a common usecase, and if it is then that can be changed as a (fairly easy) refactoring.