Functions
sbgVersion.c File Reference
#include "sbgVersion.h"
Include dependency graph for sbgVersion.c:

Go to the source code of this file.

Functions

SBG_COMMON_LIB_API int32_t sbgVersionCompare (const SbgVersion *pVersionA, const SbgVersion *pVersionB, SbgVersionCmpThresold thresold)
 
SBG_COMMON_LIB_API int32_t sbgVersionCompareEncoded (uint32_t versionA, uint32_t versionB, SbgVersionCmpThresold thresold)
 
SBG_COMMON_LIB_API void sbgVersionDecode (uint32_t encodedVersion, SbgVersion *pVersionInfo)
 
SBG_COMMON_LIB_API uint32_t sbgVersionEncode (const SbgVersion *pVersionInfo)
 
SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromString (const char *pVersionStr, SbgVersion *pVersionInfo)
 
SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromStringEncoded (const char *pVersionStr, uint32_t *pVersion)
 
SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRange (const SbgVersion *pLowerVersion, const SbgVersion *pHigherVersion, const SbgVersion *pVersion)
 
SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRangeEncoded (uint32_t lowerVersion, uint32_t higherVersion, uint32_t version)
 
SBG_COMMON_LIB_API SbgErrorCode sbgVersionToString (const SbgVersion *pVersionInfo, char *pBuffer, uint32_t sizeOfBuffer)
 
SBG_COMMON_LIB_API SbgErrorCode sbgVersionToStringEncoded (uint32_t version, char *pBuffer, uint32_t sizeOfBuffer)
 

Function Documentation

SBG_COMMON_LIB_API int32_t sbgVersionCompare ( const SbgVersion pVersionA,
const SbgVersion pVersionB,
SbgVersionCmpThresold  thresold 
)

Compare two version information structures and return if the version A is greater, less or equal than the version B. The computation is roughly result = version A - version B We can define how far we will check if the version A is greater than the version B. For example, we can only check the major or major and minor fields.

Parameters
[in]pVersionAThe first version to compare.
[in]pVersionBThe second version to compare.
[in]thresoldThe comparaison thresold to know if we are checking the major, minor, revision, build, ...
Returns
A positive value if the version A is greater than B, a negative one if version A is less than B and 0 if the two versions are the same (according to the thresold).

Definition at line 123 of file sbgVersion.c.

SBG_COMMON_LIB_API int32_t sbgVersionCompareEncoded ( uint32_t  versionA,
uint32_t  versionB,
SbgVersionCmpThresold  thresold 
)

Compare two encoded versions and return if the version A is greater, less or equal than the version B. The computation is roughly result = version A - version B We can define how far we will check if the version A is greater than the version B. For example, we can only check the major or major and minor fields.

Parameters
[in]versionAThe first compiled version to compare.
[in]versionBThe second compiled version to compare.
[in]thresoldThe comparaison thresold to know if we are checking the major, minor, revision, build, ...
Returns
A positive value if the version A is greater than B, a negative one if version A is less than B and 0 if the two versions are the same (according to the thresold).

Definition at line 226 of file sbgVersion.c.

SBG_COMMON_LIB_API void sbgVersionDecode ( uint32_t  encodedVersion,
SbgVersion pVersionInfo 
)

Fill a SbgVersion structure based on an uint32_t that stores the 'compiled' version information.

Parameters
[in]encodedVersionThe version information stored within a uint32_t.
[out]pVersionInfoPointer on an allocated SbgVersion structure to fill.

Definition at line 12 of file sbgVersion.c.

SBG_COMMON_LIB_API uint32_t sbgVersionEncode ( const SbgVersion pVersionInfo)

Construct a uint32_t containing a version information based on a SbgVersion structure.

Parameters
[in]pVersionInfoPointer on a read only version structure to encode.
Returns
The encoded version information on an uint32_t or 0 if an error has occurred.

Definition at line 69 of file sbgVersion.c.

SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromString ( const char *  pVersionStr,
SbgVersion pVersionInfo 
)

Convert a human readable string to a version structure.

Parameters
[in]pVersionStrThe string containing the version to convert.
[out]pVersionInfoPointer to a version structure to store the parsed version info.
Returns
SBG_NO_ERROR if the version information has been converted from a string.

Definition at line 439 of file sbgVersion.c.

SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromStringEncoded ( const char *  pVersionStr,
uint32_t *  pVersion 
)

Convert an encoded version number to a human readable string.

Parameters
[in]pVersionStrThe string containing the version to convert.
[out]pVersionReturned encoded version value parsed from the string.
Returns
SBG_NO_ERROR if the version information has been converted from a string.

Definition at line 560 of file sbgVersion.c.

SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRange ( const SbgVersion pLowerVersion,
const SbgVersion pHigherVersion,
const SbgVersion pVersion 
)

Check if the provided version is between the provided version interval. All versions should have the same scheme.

Parameters
[in]pLowerVersionThe lower version bound of the interval.
[in]pHigherVersionThe hiver version bound of the interval.
[in]pVersionThe version to check.
Returns
A negative value if the version is stricly below the lower version bound Zero if the version if equal or greater than lower version and equal or smaller than higer version A positive value if the version is strictly above the higher version bound

Definition at line 254 of file sbgVersion.c.

SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRangeEncoded ( uint32_t  lowerVersion,
uint32_t  higherVersion,
uint32_t  version 
)

Check if the provided encoded version is between the provided version interval. All versions should have the same scheme.

Parameters
[in]lowerVersionThe lower version bound of the interval.
[in]higherVersionThe hiver version bound of the interval.
[in]versionThe version to check.
Returns
A negative value if the version is stricly below the lower version bound Zero if the version if equal or greater than lower version and equal or smaller than higer version A positive value if the version is strictly above the higher version bound

Definition at line 277 of file sbgVersion.c.

SBG_COMMON_LIB_API SbgErrorCode sbgVersionToString ( const SbgVersion pVersionInfo,
char *  pBuffer,
uint32_t  sizeOfBuffer 
)

Convert a version information to a human readable string.

Parameters
[in]pVersionInfoPointer on a read only version structure to convert to a human readable string.
[out]pBufferBuffer to store the version as a human readable null terminated string.
[in]sizeOfBufferMaximum buffer size including the null terminated char.
Returns
SBG_NO_ERROR if the version information has been converted to a string. SBG_BUFFER_OVERFLOW is the buffer isn't big enough to store the converted version string.

Definition at line 317 of file sbgVersion.c.

SBG_COMMON_LIB_API SbgErrorCode sbgVersionToStringEncoded ( uint32_t  version,
char *  pBuffer,
uint32_t  sizeOfBuffer 
)

Convert an encoded version number to a human readable string.

Parameters
[in]versionEncoded version value to to convert to a human readable string.
[out]pBufferBuffer to store the version as a human readable null terminated string.
[in]sizeOfBufferMaximum buffer size including the null terminated char.
Returns
SBG_NO_ERROR if the version information has been converted to a string. SBG_BUFFER_OVERFLOW is the buffer isn't big enough to store the converted version string.

Definition at line 414 of file sbgVersion.c.



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