/home/dko/Projects/mobilec/src/include/ap_queue_template.h File Reference

#include "macros.h"
#include "mc_error.h"
#include <embedch.h>

Go to the source code of this file.

Data Structures

struct  AP_GENERIC_s

Defines

#define AP_QUEUE_DECL_TEMPLATE(name, node_type)
#define AP_QUEUE_GENERIC_DECL_TEMPLATE(name, func_name, return_type, search_type)   return_type name##_##func_name(name##_p name, const search_type key);
#define AP_QUEUE_STD_DEFN_TEMPLATE(name, node_type)
#define AP_QUEUE_SEARCH_TEMPLATE(name, func_name, node_type, search_type, search_expression)
#define AP_QUEUE_REMOVE_TEMPLATE(name, func_name, node_type, search_type, search_expression)

Typedefs

typedef struct AP_GENERIC_s AP_GENERIC_t
typedef AP_GENERIC_tAP_GENERIC_p

Functions

AP_GENERIC_p interpreter_queue_CreateRetrieve (struct interpreter_queue_s *queue, ChOptions_t *interp_options)

Define Documentation

#define AP_QUEUE_DECL_TEMPLATE ( name,
node_type   ) 
Value:
typedef struct name##_s \
{ \
  int size; \
  list_p list; \
  MUTEX_T* lock; \
  COND_T* cond; \
} name##_t; \
  \
typedef name##_t* name##_p; \
  \
name##_p name##_New( void ); \
int name##_Destroy( name##_p name ); \
int name##_Add( name##_p name, struct node_type##_s* node ); \
name##_p name##_Copy(name##_p name); \
struct node_type##_s* name##_Pop( name##_p name ); \
struct node_type##_s* name##_WaitPop( name##_p name ); \
struct node_type##_s* name##_SearchIndex( name##_p name, int index ); \
int name##_RemoveIndex(name##_p name, int index);

Definition at line 46 of file ap_queue_template.h.

#define AP_QUEUE_GENERIC_DECL_TEMPLATE ( name,
func_name,
return_type,
search_type   )     return_type name##_##func_name(name##_p name, const search_type key);

Definition at line 66 of file ap_queue_template.h.

#define AP_QUEUE_REMOVE_TEMPLATE ( name,
func_name,
node_type,
search_type,
search_expression   ) 
Value:
int name##_##func_name( name##_p name, const search_type key ) \
{ \
  int err_code = MC_ERR_NOT_FOUND; \
  struct listNode_s* parsenode; \
  struct node_type##_s* node; \
  node = NULL; \
  \
  MUTEX_LOCK(name->lock); \
  if (name->list->listhead == NULL) { \
    MUTEX_UNLOCK(name->lock); \
    return MC_ERR_NOT_FOUND; \
  } \
  for( \
      parsenode = (listNode_t*)name->list->listhead; \
      parsenode->next != NULL; \
      parsenode = (listNode_t*)parsenode->next \
     ) \
  { \
    node = (node_type##_t*)parsenode->node_data; \
    if (search_expression) { \
      break; \
      err_code = MC_SUCCESS; \
    } \
  } \
  MUTEX_UNLOCK(name->lock); \
  return err_code; \
}

Definition at line 224 of file ap_queue_template.h.

#define AP_QUEUE_SEARCH_TEMPLATE ( name,
func_name,
node_type,
search_type,
search_expression   ) 
Value:
struct node_type##_s* name##_##func_name( name##_p name, const search_type key ) \
{ \
  listNode_t* parsenode; \
  struct node_type##_s* node; \
  struct node_type##_s* ret = NULL; \
  node = NULL; \
  \
  MUTEX_LOCK(name->lock); \
  if (name->list->listhead == NULL) { \
    MUTEX_UNLOCK(name->lock); \
    return NULL; \
  } \
  for( \
      parsenode = (listNode_t*)name->list->listhead; \
      parsenode != NULL; \
      parsenode = (listNode_t*)parsenode->next \
     ) \
  { \
    node = (node_type##_t*)parsenode->node_data; \
    if (search_expression){ \
      ret = node; \
      break; \
    } \
  } \
  MUTEX_UNLOCK(name->lock); \
  return ret; \
}

Definition at line 194 of file ap_queue_template.h.

#define AP_QUEUE_STD_DEFN_TEMPLATE ( name,
node_type   ) 

Definition at line 69 of file ap_queue_template.h.


Typedef Documentation

Definition at line 43 of file ap_queue_template.h.

typedef struct AP_GENERIC_s AP_GENERIC_t

Definition at line 42 of file ap_queue_template.h.


Function Documentation

AP_GENERIC_p interpreter_queue_CreateRetrieve ( struct interpreter_queue_s *  queue,
ChOptions_t *  interp_options 
)

Referenced by agent_RunChScriptThread().

Generated on Tue Dec 28 15:15:27 2010 for Mobile-C by  doxygen 1.6.3