Macros | Functions
sbgDefines.h File Reference

Header file that contains all common definitions. More...

#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
Include dependency graph for sbgDefines.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __BASE_FILE__   __FILE__
 
#define FALSE   (0)
 
#define NULL   (0)
 
#define SBG_ARRAY_SIZE(a)   (sizeof(a) / sizeof((a)[0]))
 
#define SBG_COMMON_LIB_API
 
#define SBG_CONST_CAST_AA(x)   x
 
#define SBG_CONST_CAST_PP(x)   x
 
#define SBG_CONTAINER_OF(ptr, type, member)   ((type *)((char *)(ptr) - offsetof(type, member)))
 
#define SBG_DELETE   if (p){free(p); (p) = NULL;}
 
#define SBG_DELETE_ARRAY   if (p){free(p); (p) = NULL;}
 
#define SBG_DEPRECATED(func)   func
 
#define SBG_DEPRECATED_MACRO(func)   func
 
#define SBG_DISABLE   (0)
 
#define SBG_ENABLE   (1)
 
#define SBG_FALLTHROUGH
 
#define SBG_FREE(p)   if (p){free(p); (p) = NULL;}
 
#define SBG_FREE_ARRAY(p)   if (p){free(p); (p) = NULL;}
 
#define SBG_INLINE   static inline
 
#define SBG_INVALID_HANDLE   (0x00000000u)
 
#define SBG_LIKELY(expr)   (expr)
 
#define SBG_NOT_FOUND   (0xFFFFFFFFu)
 
#define SBG_PI   3.14159265358979323846
 
#define SBG_PI_F   3.14159265358979323846f
 
#define SBG_STRLEN(s)   (sizeof(s) - 1)
 
#define SBG_UNDEFINED   (0xFFFFFFFFu)
 
#define SBG_UNLIKELY(expr)   (expr)
 
#define SBG_UNUSED_PARAMETER(x)   (void)(x)
 
#define sbgAbs(x)   (((x) < 0) ? -(x) : (x))
 
#define sbgClamp(value, minValue, maxValue)   (((value) < (minValue))?(minValue): ((value) > (maxValue)?maxValue:value))
 
#define sbgDivCeil(n, d)   (((n) + (d) - 1) / (d))
 
#define sbgMax(a, b)   (((a) > (b)) ? (a) : (b))
 
#define sbgMin(a, b)   (((a) < (b)) ? (a) : (b))
 
#define TRUE   (1)
 

Functions

SBG_INLINE double sbgDegToRadD (double angle)
 
SBG_INLINE float sbgDegToRadF (float angle)
 
SBG_INLINE double sbgRadToDegD (double angle)
 
SBG_INLINE float sbgRadToDegF (float angle)
 

Detailed Description

Header file that contains all common definitions.

Author
SBG Systems (Raphael Siryani)
Date
17 March 2015

Copyright Notice

Copyright (C) 2007-2015, SBG Systems SAS. All rights reserved.

This source code is intended for use only by SBG Systems SAS and those that have explicit written permission to use it from SBG Systems SAS.

THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

Definition in file sbgDefines.h.

Macro Definition Documentation

#define __BASE_FILE__   __FILE__

BASE_FILE is gcc specific

Definition at line 159 of file sbgDefines.h.

#define FALSE   (0)

Definition at line 73 of file sbgDefines.h.

#define NULL   (0)

Definition at line 81 of file sbgDefines.h.

#define SBG_ARRAY_SIZE (   a)    (sizeof(a) / sizeof((a)[0]))

Definition at line 97 of file sbgDefines.h.

#define SBG_COMMON_LIB_API

Macro used to handle export and import methods of the sbgCommon library

Definition at line 58 of file sbgDefines.h.

#define SBG_CONST_CAST_AA (   x)    x

XXX Visual C (not C++) doesn't provide anything to implement typeof(). As a result, This macro is private and shouldn't be relied on.

Definition at line 142 of file sbgDefines.h.

#define SBG_CONST_CAST_PP (   x)    x

Definition at line 150 of file sbgDefines.h.

#define SBG_CONTAINER_OF (   ptr,
  type,
  member 
)    ((type *)((char *)(ptr) - offsetof(type, member)))

Definition at line 105 of file sbgDefines.h.

#define SBG_DELETE   if (p){free(p); (p) = NULL;}

Definition at line 169 of file sbgDefines.h.

#define SBG_DELETE_ARRAY   if (p){free(p); (p) = NULL;}

Definition at line 170 of file sbgDefines.h.

#define SBG_DEPRECATED (   func )    func

This macro is used to define a new section of packed structures. All structures defined after this macro will be packed.

This macro is used to specify that a structure is packed.

This macro is used to close the section of packed structures and return to the default packing.

Macro used to indicate that a function is deprecated.

Definition at line 270 of file sbgDefines.h.

#define SBG_DEPRECATED_MACRO (   func)    func

Macro used to indicate that a macro is deprecated.

Definition at line 282 of file sbgDefines.h.

#define SBG_DISABLE   (0)

Definition at line 65 of file sbgDefines.h.

#define SBG_ENABLE   (1)

Definition at line 69 of file sbgDefines.h.

#define SBG_FALLTHROUGH

The fallthrough attribute is used to avoid compiler warning in swith case statements when an intentional break is missing

Definition at line 207 of file sbgDefines.h.

#define SBG_FREE (   p)    if (p){free(p); (p) = NULL;}

Definition at line 171 of file sbgDefines.h.

#define SBG_FREE_ARRAY (   p)    if (p){free(p); (p) = NULL;}

Definition at line 172 of file sbgDefines.h.

#define SBG_INLINE   static inline

Macro used to abstract the compiler specific inline keyword.

Definition at line 186 of file sbgDefines.h.

#define SBG_INVALID_HANDLE   (0x00000000u)

Definition at line 85 of file sbgDefines.h.

#define SBG_LIKELY (   expr)    (expr)

Definition at line 112 of file sbgDefines.h.

#define SBG_NOT_FOUND   (0xFFFFFFFFu)

Definition at line 89 of file sbgDefines.h.

#define SBG_PI   3.14159265358979323846

Definition at line 289 of file sbgDefines.h.

#define SBG_PI_F   3.14159265358979323846f

Definition at line 293 of file sbgDefines.h.

#define SBG_STRLEN (   s)    (sizeof(s) - 1)

Definition at line 101 of file sbgDefines.h.

#define SBG_UNDEFINED   (0xFFFFFFFFu)

Definition at line 93 of file sbgDefines.h.

#define SBG_UNLIKELY (   expr)    (expr)

Definition at line 120 of file sbgDefines.h.

#define SBG_UNUSED_PARAMETER (   x)    (void)(x)

Macro used to avoid compiler warning when a variable is not used.

Definition at line 194 of file sbgDefines.h.

#define sbgAbs (   x)    (((x) < 0) ? -(x) : (x))

Returns the absolute value of x.

Parameters
[in]xSigned integer value.
Returns
The absolute value of x.

Definition at line 303 of file sbgDefines.h.

#define sbgClamp (   value,
  minValue,
  maxValue 
)    (((value) < (minValue))?(minValue): ((value) > (maxValue)?maxValue:value))

Clamp a value between minValue and maxValue ie minValue <= value <= maxValue

Parameters
[in]valueFirst operand.
[in]minValueFirst operand.
[in]maxValueSecond operand.
Returns
The clamped value.

Definition at line 334 of file sbgDefines.h.

#define sbgDivCeil (   n,
  d 
)    (((n) + (d) - 1) / (d))

Integer division with a result rounded up.

Parameters
[in]nDividend.
[in]dDivisor.

Definition at line 343 of file sbgDefines.h.

#define sbgMax (   a,
 
)    (((a) > (b)) ? (a) : (b))

Returns the maximum between a and b

Parameters
[in]aFirst operand.
[in]bSecond operand.
Returns
The maximum between a and b.

Definition at line 313 of file sbgDefines.h.

#define sbgMin (   a,
 
)    (((a) < (b)) ? (a) : (b))

Returns the minimum between a and b

Parameters
[in]aFirst operand.
[in]bSecond operand.
Returns
The minimum between a and b.

Definition at line 323 of file sbgDefines.h.

#define TRUE   (1)

Definition at line 77 of file sbgDefines.h.

Function Documentation

SBG_INLINE double sbgDegToRadD ( double  angle)

Convert an angle from degrees to radians using double precision.

Parameters
[in]angleThe angle to convert in degrees.
Returns
The converted angle in radians.

Definition at line 361 of file sbgDefines.h.

SBG_INLINE float sbgDegToRadF ( float  angle)

Convert an angle from degrees to radians using single (float) precision.

Parameters
[in]angleThe angle to convert in degrees.
Returns
The converted angle in radians.

Definition at line 381 of file sbgDefines.h.

SBG_INLINE double sbgRadToDegD ( double  angle)

Convert an angle from radians to degrees using double precision.

Parameters
[in]angleThe angle to convert in radians.
Returns
The converted angle in degrees.

Definition at line 351 of file sbgDefines.h.

SBG_INLINE float sbgRadToDegF ( float  angle)

Convert an angle from radians to degrees using single (float) precision.

Parameters
[in]angleThe angle to convert in radians.
Returns
The converted angle in degrees.

Definition at line 371 of file sbgDefines.h.



sbg_driver
Author(s): SBG Systems
autogenerated on Thu Oct 22 2020 03:47:22