Global

Edit on GitHub
#include <Global.h>

Defines global symbols used throughout the library including version macros, platform macros, class export routines, namespace declarations and data type definitions. Version macros can be used to retrieve the current version of Robot. Platform macros can be used to identify supported operating systems and architectures. Class export routines provide Robot with the flexibility of supporting multiple compiler configurations. Namespace declarations can be used to manage and modify the Robot namespace. And data type definitions define cross-platform fixed-length data types.

Version

Defines two macros representing the version of Robot currently in use. The first macro, ROBOT_VERSION, expands to an integer of the form 0xMMNNPP where MM means major, NN means minor, and PP means patch. So if the application is compiled against Robot 2.3.4, the macro will expand to 0x020304. The second macro, ROBOT_VERSION_STR, expands to a string of the form "M.N.P". As with the example above, the macro will expand to "2.3.4".

Platforms

#define ROBOT_OS_LINUX          // Defined when compiling on Linux
#define ROBOT_OS_MAC            // Defined when compiling on OS X
#define ROBOT_OS_WIN            // Defined when compiling on Windows

#define ROBOT_ARCH_64           // Defined when compiling as x64
#define ROBOT_ARCH_32           // Defined when compiling as x86

Defines macros for identifying operating systems and architectures. These macros are used heavily throughout the library and enable cross-platform development. operating system macros can be used in cases where platform-specific code is required whereas architecture macros can be used in cases where architecture-specific code is required.

Export

Defines macros for supporting multiple compiler configurations. These are especially important when Robot is used as a shared library. The ROBOT_EXPORT macro marks a symbol for export and is only used within the Robot library itself. The BUILDING_ROBOT_SHARED macro is defined whenever Robot is being built as a shared library. And the USING_ROBOT_SHARED macro is defined whenever an application using Robot as a shared library is being built. None of these macros should be defined when Robot is used as a static library.

Namespaces

#define ROBOT_NS                // Name of the Robot namespace

#define ROBOT_NS_BEGIN          // Begins the Robot namespace
#define ROBOT_NS_END            //   Ends the Robot namespace

#define ROBOT_NS_PRE( name )    // Preface a single Robot symbol
#define ROBOT_NS_FWD( name )    // Forward declare a Robot class

#define ROBOT_NS_USE_ALL        // Use the entire Robot namespace
#define ROBOT_NS_USE( name )    // Use only a single Robot class

Defines macros for configuring and managing the Robot namespace. By default, Robot uses "Robot" as its namespace. Most of the time this does not need to be modified, however, in the case of conflicts, the namespace can be modified through the ROBOT_NS macro. Namespaces can either be set on a project-wide basis or before including any Robot-specific header files. All other namespace macros adapt to use the custom namespace.

Data Types

typedef int8                    // Signed  8-bit integer
typedef int16                   // Signed 16-bit integer
typedef int32                   // Signed 32-bit integer
typedef int64                   // Signed 64-bit integer

typedef uint8                   // Unsigned  8-bit integer
typedef uint16                  // Unsigned 16-bit integer
typedef uint32                  // Unsigned 32-bit integer
typedef uint64                  // Unsigned 64-bit integer

typedef real32                  // 32-bit float value
typedef real64                  // 64-bit float value

typedef intptr                  // Signed   pointer integer
typedef uintptr                 // Unsigned pointer integer

Declares several data types that guarantee a specific bit-size on all supported platforms. Pointer types are guaranteed to be the size of a pointer, that is, 32-bit when compiling as x86 and 64-bit when compiling as x64.