Here is a way to convert a C++ enum with values to Python.
C++ code:
typedef enum
{
LADYBUG_RAW_CAM0 = ( 0x1 << 0 ),
LADYBUG_RAW_CAM1 = ( 0x1 << 1 ),
LADYBUG_RAW_CAM2 = ( 0x1 << 2 ),
LADYBUG_RAW_CAM3 = ( 0x1 << 3 ),
LADYBUG_RAW_CAM4 = ( 0x1 << 4 ),
LADYBUG_RAW_CAM5 = ( 0x1 << 5 ),
LADYBUG_ALL_RAW_IMAGES = 0x0000003F,
...
LADYBUG_PANORAMIC = ( 0x1 << 12 ),
LADYBUG_DOME = ( 0x1 << 13 ),
LADYBUG_SPHERICAL = ( 0x1 << 14 ),
LADYBUG_ALL_CAMERAS_VIEW = ( 0x1 << 15 ),
LADYBUG_ALL_OUTPUT_IMAGE = 0x7FFFFFFF,
} LadybugOutputImage
The Python version:
LadybugOutputImage = dict(
LADYBUG_RAW_CAM0 = ( 0x1 << 0 ),
LADYBUG_RAW_CAM1 = ( 0x1 << 1 ),
LADYBUG_RAW_CAM2 = ( 0x1 << 2 ),
LADYBUG_RAW_CAM3 = ( 0x1 << 3 ),
LADYBUG_RAW_CAM4 = ( 0x1 << 4 ),
LADYBUG_RAW_CAM5 = ( 0x1 << 5 ),
LADYBUG_ALL_RAW_IMAGES = 0x0000003F,
...
LADYBUG_PANORAMIC = ( 0x1 << 12 ),
LADYBUG_DOME = ( 0x1 << 13 ),
LADYBUG_SPHERICAL = ( 0x1 << 14 ),
LADYBUG_ALL_CAMERAS_VIEW = ( 0x1 << 15 ),
LADYBUG_ALL_OUTPUT_IMAGE = 0x7FFFFFFF )
LadybugOutputImage = namedtuple('Enum',
LadybugOutputImage.keys() )(**LadybugOutputImage)
Or even better, just get rid of all the packaging and commas on this type if it’s not too long and you have the patience. But you will also have to correct the indenting. Maybe there is a program out there that can do this editing for you.
LADYBUG_RAW_CAM0 = ( 0x1 << 0 ) LADYBUG_RAW_CAM1 = ( 0x1 << 1 ) LADYBUG_RAW_CAM2 = ( 0x1 << 2 ) LADYBUG_RAW_CAM3 = ( 0x1 << 3 ) ... LADYBUG_ALL_CAMERAS_VIEW = ( 0x1 << 15 ) LADYBUG_ALL_OUTPUT_IMAGE = 0x7FFFFFFF