Global Mapper Ints: *_t32, uint32, and others

Some types referred to in this documentation and in the help(..) strings of the Global Mapper Python SDK have the suffix “t32”, such as GM_LayerHandle_t32 or GM_Error_t32. These types can’t be initialized or addressed in Python because they are just integers. In the C++ SDK, these *_t32 types are real classes that are used as an abstraction for void* or other whole numeric values; however, in Python, this is unnecessary since it can all be represented with just ints. They are still shown with their original names in documentation both for consistency with the C++ SDK and to clarify what information each int represents. In practice, a regular int can be used for any function parameter which requires a *_t32 type, and any such return value will also be an integer.

Similarly, the types with the suffix “t8” are also interchangeable with integers, but should only be used with values representable with 8 unsigned bits (0 - 255). This also applies to the “t16” types and 16-bit numbers. The 32 in “t32”, however, doesn’t necessarily mean 32-bit. For instance, when used on a 64-bit architecture, pointers will be 64-bit. Many of these types which don’t represent pointers are derived from C++ enums, with integer numbers replacing their enumerated values. In Python, the enumerations have been replaced with constants whose values are listed on the constants documentation pages. These values can be used in place of integer literals. For example, you could pass GM_FeatureClass_Point for a GM_FeatureClassType_t8 parameter, because GM_FeatureClass_Point evaluates to 2 and GM_FeatureClassType_t8 takes any int.

Another category of int types are the uint32 type and its relatives. Uint32 is the most common, but you may also see sint32, uint8, or similarly named types as parameters for Global Mapper functions. As these have also been translated from C++ classes into Python ints, any integer will be valid for the parameter, but the name of the type indicates the range of numbers that will work correctly for the function. For example, uint32 means “unsigned 32-bit integers” and sint8 means “signed 8-bit integers”.

Booleans, in this SDK, are a type of uint8 which accepts both integers from 0 - 255 and the Python values True and False. The numbers 1 - 255 are equivalent to True, and 0 is equivalent to False. When a boolean is returned, it will only be the integer 1 or 0, rather than True or False, which is why this documentation refers to these variables as “boolean” instead of bool (the standard Python type).