LAR Library: Basic Definitions

LAR Library

Basic Definitions

Macros

#define BASE_MAX(a, b)
 Return the largest of two elements (as defined by the comparison <).
 
#define BASE_MIN(a, b)
 Return the smallest of two elements (as defined by the comparison <).
 
#define BASE_LENGTH(v)
 Return the count of a fixed-size array. More...
 
#define LARLIB_VERSION   (0x0113)
 Version of this LarLib as a 2-byte BCD number. More...
 

Typedefs

typedef char int8_t
 Signed 8-bit integer. More...
 
typedef short int16_t
 Signed 16-bit integer. More...
 
typedef int int32_t
 Signed 32-bit integer. More...
 
typedef long long int64_t
 Signed 64-bit integer. More...
 
typedef unsigned char uint8_t
 Unsigned 8-bit integer. More...
 
typedef unsigned short uint16_t
 Unsigned 16-bit integer. More...
 
typedef unsigned int uint32_t
 Unsigned 32-bit integer. More...
 
typedef unsigned long long uint64_t
 Unsigned 64-bit integer. More...
 

Enumerations

enum  baseErrors_t {
  BASE_ERR_OK = 0, BASE_ERR_INVALID_PARAMETER = -1, BASE_ERR_DATA_NOT_FOUND = -2, BASE_ERR_INVALID_HANDLE = -3,
  BASE_ERR_RESOURCE_PB = -4, BASE_ERR_OVERFLOW = -5, BASE_ERR_ACCESS = -6, BASE_ERR_CANCEL = -7,
  BASE_ERR_TIMEOUT = -8
}
 Common error values. More...
 

Functions

const char * larlibGetVersion (void)
 Return a string with the version and revision of LarLib library. More...
 

Detailed Description

Rationale

Each platform has its own definition of types and error codes. We need a platform-independent basis to use for our own libraries. As an extra we try to reuse the types from C99's <stdint.h>.

Introduction

This module includes basic definitions, types and functions that should be used as the environment for other modules.

Macro Definition Documentation

#define BASE_LENGTH (   v)

Return the count of a fixed-size array.

This will not work with pointers and other arrays, for example:

1 myStruct_t v[10];
2 myStruct_t *pv = v;
3 int nv = BASE_LENGTH(v); // works
4 int npv = BASE_LENGTH(pv); // does NOT work
#define LARLIB_VERSION   (0x0113)

Version of this LarLib as a 2-byte BCD number.

For example, 0x0123 indicates version 1.23.

This allows both the application code and the (human) reader to know which version of LarLib this header file is associated with.

Typedef Documentation

typedef short int16_t

Signed 16-bit integer.

typedef int int32_t

Signed 32-bit integer.

typedef long long int64_t

Signed 64-bit integer.

typedef char int8_t

Signed 8-bit integer.

typedef unsigned short uint16_t

Unsigned 16-bit integer.

typedef unsigned int uint32_t

Unsigned 32-bit integer.

typedef unsigned long long uint64_t

Unsigned 64-bit integer.

typedef unsigned char uint8_t

Unsigned 8-bit integer.

Enumeration Type Documentation

Common error values.

Enumerator
BASE_ERR_OK 

No error.

BASE_ERR_INVALID_PARAMETER 

Function was given an invalid parameter.

BASE_ERR_DATA_NOT_FOUND 

Requested data was not found.

BASE_ERR_INVALID_HANDLE 

Given handle is invalid.

BASE_ERR_RESOURCE_PB 

Resource allocation problem (usually memory)

BASE_ERR_OVERFLOW 

Either parameter is too large, or result buffer too small.

BASE_ERR_ACCESS 

Access/permission failure.

BASE_ERR_CANCEL 

Canceled by external process (user?)

BASE_ERR_TIMEOUT 

Time-limited function has not completed in the requested time.

Function Documentation

const char* larlibGetVersion ( void  )

Return a string with the version and revision of LarLib library.

The returned string always follows the format "xx.yy $Revision: nnn $", where:

  • xx.yy are the major and minor versions (from LARLIB_VERSION);
  • nnn is the SVN revision of this build (the length in digits is variable, do not always consider to be 3!).

For example "01.23 $Revision: 111 $".

Note
If the version value returned by this function does not match the value of LARLIB_VERSION, there is a mismatch between header and library.
Returns
The library version and SVN revision of LarLib binary library file.
Generated on Mon Mar 27 2017 15:42:52 for LAR Library by   doxygen 1.8.9.1