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

Type nitf::Uint32 as input or return type for some NITF-related methods are not typemapped into Python #352

Closed
ianrcooke opened this issue Sep 23, 2020 · 0 comments

Comments

@ianrcooke
Copy link

For the python module, a number of nitf-related methods are not typemapped correctly in the SWIG file six_sicd.i. As a result, the methods can't be called if the underlying C++ takes a nitf::Uint32 or if the method returns a nitf::Uint32, the return type is opaque.

In particular ImageSegment.getBandInfo can't be called:

(pdb) record.getImageSegment(0).getSubheader().getBandInfo(0)
*** TypeError in method ' ImageSubheader_getBandInfo', argument 2 of type 'nitf::Uint32'

And ImageSegment.getBandCount() returns an opaque type:

(pdb) record.getImageSegment(0).getSubheader().getBandCount()
<SWIG object of type 'nitf::uint32 *' at 0x7f03c6e77210>

This appears to be because the input and output typemaps for nitf::Uint32 are defined after the nitf-related includes

Moving those typemaps before the nitf includes in the .i and then regenerating the bindings via a recompilation with -DENABLE_SWIG=ON fixes the issue:

(pdb) record.getImageSegment(0).getSubheader().getBandInfo(0)
<SWIG Object of type 'nitf::BandInfo *' at 0x7fc491bb67b0>
(pdb) record.getImageSegment(0).getSubheader().getBandCount()
2

(Note: nitf::BandInfo is also opaque because it's not included in the .i file, but that's a separate issue)

@ianrcooke ianrcooke changed the title Type nitf::Uint32 as input or return type for some NITF-related methods are not typemapped into Python Type nitf::Uint32 as input or return type for some NITF-related methods are not typemapped into Python Sep 23, 2020
@ianrcooke ianrcooke changed the title Type nitf::Uint32 as input or return type for some NITF-related methods are not typemapped into Python Type nitf::Uint32 as input or return type for some NITF-related methods are not typemapped into Python Sep 23, 2020
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

No branches or pull requests

2 participants