ASN1C C/C++ Common Runtime  ASN1C v7.2.x
Classes | Macros | Typedefs | Functions
Stack Utility Functions

Classes

struct  _OSRTStack
 

Macros

#define rtxStackIsEmpty(stack)   (OSBOOL)((stack).dlist.count == 0)
 

Typedefs

typedef struct _OSRTStack OSRTStack
 

Functions

OSRTStackrtxStackCreate (struct OSCTXT *pctxt)
 
void rtxStackInit (struct OSCTXT *pctxt, OSRTStack *pStack)
 
void * rtxStackPop (OSRTStack *pStack)
 
int rtxStackPush (OSRTStack *pStack, void *pData)
 
void * rtxStackPeek (OSRTStack *pStack)
 

Detailed Description

This is a simple stack structure with supporting push and pop functions. Different initialization routines are provided to permit different memory management schemes.

Macro Definition Documentation

◆ rtxStackIsEmpty

#define rtxStackIsEmpty (   stack)    (OSBOOL)((stack).dlist.count == 0)

This macro tests if the stack is empty.

Parameters
stackStack structure variable to be tested.

Function Documentation

◆ rtxStackCreate()

OSRTStack* rtxStackCreate ( struct OSCTXT pctxt)

This function creates a new stack structure. It allocates memory for the structure and calls rtxStackInit to initialize the structure.

Parameters
pctxtA pointer to the context with which the stack is associated.
Returns
A pointer to an allocated stack structure.

◆ rtxStackInit()

void rtxStackInit ( struct OSCTXT pctxt,
OSRTStack pStack 
)

This function initializes a stack structure. It sets the number of elements to zero and sets all internal pointer values to NULL.

Parameters
pctxtA pointer to the context with which the stack is associated.
pStackA pointer to a stack structure to be initialized.

◆ rtxStackPeek()

void* rtxStackPeek ( OSRTStack pStack)

This functions returns the data item on the top of the stack.

Parameters
pStackA pointer to the structure onto which the data item is to be pushed. The pointer updated to the stack structure
Returns
Pointer to data item at top of stack or NULL if stack empty.
  • 0 (0) = success,
  • negative return value is error.

◆ rtxStackPop()

void* rtxStackPop ( OSRTStack pStack)

This function pops an item off the stack.

Parameters
pStackThe pointer to the stack structure from which the value is to be popped. Pointer to the updated stack structure.
Returns
The pointer to the item popped from the stack

◆ rtxStackPush()

int rtxStackPush ( OSRTStack pStack,
void *  pData 
)

This function pushes an item onto the stack.

Parameters
pStackA pointer to the structure onto which the data item is to be pushed. The pointer updated to the stack structure
pDataA pointer to the data item to be pushed on the stack.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.