EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
dbDefs.h File Reference

Miscellaneous macro definitions. More...

#include <stddef.h>
Include dependency graph for dbDefs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TRUE   1
 
#define FALSE   0
 
#define LOCAL   static
 Deprecated synonym for static.
 
#define NELEMENTS(array)   (sizeof (array) / sizeof ((array) [0]))
 Number of elements in array.
 
#define OFFSET(structure, member)   offsetof(structure, member)
 Deprecated synonym for offsetof.
 
#define CONTAINER(ptr, structure, member)   ((structure*)((char*)(ptr) - offsetof(structure, member)))
 Find parent object from a member pointer. More...
 
#define PVNAME_STRINGSZ   61
 Size of a record name including the nil terminator.
 
#define PVNAME_SZ   (PVNAME_STRINGSZ - 1)
 Size of a record name without the nil terminator.
 
#define PVLINK_STRINGSZ   1024
 Buffer size for the string representation of a DBF_*LINK field.
 
#define DB_MAX_CHOICES   30
 dbAccess enums/menus can have up to this many choices
 

Detailed Description

Author
Marty Kraimer

This file defines several miscellaneous macros.

Definition in file dbDefs.h.

Macro Definition Documentation

#define CONTAINER (   ptr,
  structure,
  member 
)    ((structure*)((char*)(ptr) - offsetof(structure, member)))

Subtracts the byte offset of the member in the structure from the pointer to the member itself, giving a pointer to parent structure.

Parameters
ptrPointer to a member data field of a structure
structureType name of the parent structure
memberField name of the data member
Returns
Pointer to the parent structure
Note
Both GCC and Clang will type-check this macro.

Definition at line 67 of file dbDefs.h.