[C++-sig] wrap union types with boost.python

Malte Dreschert malte.dreschert at gmail.com
Sun Jan 16 12:29:42 EST 2022


Hi Stefan,

thanks for answering and a greetings from northern Germany to Berlin :)

the struct is meant to hold color values (three floats) but the color space
can be different.
It contains three of these unions and one enum value that contains the
information which color space was used when the values were written.
The floats are either rgb or hsv.

The library is for reading a binary file and I only have these structs and
some methods I need to wrap, that means I only need to read the values.
I guess I would first check the color space and then interpret the three
values accordingly.

Does that help? I don't want to post the code directly because it is in
house code.

Thank you very much,

Cheers,

Malte


On Sun, Jan 16, 2022 at 4:18 PM Stefan Seefeld <stefan at seefeld.name> wrote:

> Hi Malte,
>
> the first step is for you to decide what semantics you want `someStruct`
> to carry, which would then translate into an API. This is also a
> prerequisite for using this in pure C++, i.e. without any Python bindings.
> It just becomes more obvious if you want to think about accessing this in a
> pythonic way.
>
> So, can you rephrase your question by describing `someStruct` in terms of
> behaviour rather than structure, i.e. in an "object-oriented" way ?
>
> [image: Stefan]
> --
>
>       ...ich hab' noch einen Koffer in Berlin...
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> https://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/cplusplus-sig/attachments/20220116/568af5bd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .signature.png
Type: image/png
Size: 2754 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/cplusplus-sig/attachments/20220116/568af5bd/attachment.png>


More information about the Cplusplus-sig mailing list