Skip to content

feature: submodule or a class scope for exported classes#21488

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
VadimLevin:dev/vlevin/scope-for-classes
Mar 2, 2022
Merged

feature: submodule or a class scope for exported classes#21488
opencv-pushbot merged 1 commit intoopencv:3.4from
VadimLevin:dev/vlevin/scope-for-classes

Conversation

@VadimLevin
Copy link
Copy Markdown
Contributor

@VadimLevin VadimLevin commented Jan 20, 2022

All classes are registered in the scope that corresponds to C++ namespace or exported class.
Example:
cv::ml::Boost is exported as cv.ml.Boost
cv::SimpleBlobDetector::Params is exported as cv.SimpleBlobDetector.Params

For backward compatibility all classes are registered in the global module with their mangling name containing scope information. Example:
cv::ml::Boost has cv.ml_Boost alias to cv.ml.Boost type

Closes #14730

Backport for 4.x is required to handle GAPI aliases in the right way:

cv.gapi.wip.draw.Rect = cv.gapi_wip_draw_Rect
cv.gapi.wip.draw.Text = cv.gapi_wip_draw_Text
cv.gapi.wip.draw.Circle = cv.gapi_wip_draw_Circle
cv.gapi.wip.draw.Line = cv.gapi_wip_draw_Line
cv.gapi.wip.draw.Mosaic = cv.gapi_wip_draw_Mosaic
cv.gapi.wip.draw.Image = cv.gapi_wip_draw_Image
cv.gapi.wip.draw.Poly = cv.gapi_wip_draw_Poly

cv.gapi.streaming.queue_capacity = cv.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@VadimLevin VadimLevin added backport is needed Label for maintainers. Authors of PR can ignore this feature category: python bindings labels Jan 20, 2022
@VadimLevin VadimLevin force-pushed the dev/vlevin/scope-for-classes branch 3 times, most recently from 766d034 to e8a575e Compare January 31, 2022 08:23
@VadimLevin VadimLevin force-pushed the dev/vlevin/scope-for-classes branch 2 times, most recently from c982d92 to 8054f2a Compare January 31, 2022 11:34
@alalek
Copy link
Copy Markdown
Member

alalek commented Feb 1, 2022

@VadimLevin Thank you! Overall looks good!
Could you please create PR with port onto 4.x branch to ensure that all works properly? (changing target branch doesn't help as there are merge conflicts)

@VadimLevin VadimLevin force-pushed the dev/vlevin/scope-for-classes branch from 8054f2a to 169993f Compare February 2, 2022 08:46
@VadimLevin VadimLevin changed the base branch from 3.4 to 4.x February 2, 2022 09:29
@VadimLevin VadimLevin changed the base branch from 4.x to 3.4 February 2, 2022 09:30
@VadimLevin
Copy link
Copy Markdown
Contributor Author

@VadimLevin Thank you! Overall looks good! Could you please create PR with port onto 4.x branch to ensure that all works properly? (changing target branch doesn't help as there are merge conflicts)

After redundant #include <object.h> removal - git cherry-pick works without any conflict. Changing the base branch still leads to conflicts... Ported in #21553

@VadimLevin VadimLevin force-pushed the dev/vlevin/scope-for-classes branch from 169993f to 6d18ae2 Compare March 2, 2022 10:30
All classes are registered in the scope that corresponds to C++
namespace or exported class.

Example:
`cv::ml::Boost` is exported as `cv.ml.Boost`
`cv::SimpleBlobDetector::Params` is exported as
`cv.SimpleBlobDetector.Params`

For backward compatibility all classes are registered in the global
module with their mangling name containing scope information.
Example:
`cv::ml::Boost` has `cv.ml_Boost` alias to `cv.ml.Boost` type
@VadimLevin VadimLevin force-pushed the dev/vlevin/scope-for-classes branch from 6d18ae2 to ccebbbc Compare March 2, 2022 11:32
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Thank you!

@opencv-pushbot opencv-pushbot merged commit a082375 into opencv:3.4 Mar 2, 2022
@alalek alalek mentioned this pull request Mar 5, 2022
@opencv-pushbot opencv-pushbot mentioned this pull request Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: python bindings feature port/backport done Label for maintainers. Authors of PR can ignore this RFC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants