Skip to content
Authors

File production_store.h

File List > production_store > src > production_store.h

Go to the documentation of this file

#ifndef PRODUCTION_STORE_H
#define PRODUCTION_STORE_H

/*************************************************************************************************/
/*************************** Includes ************************************************************/
/*************************************************************************************************/
#include <stddef.h>
#include <stdbool.h>

/*************************************************************************************************/
/*************************** Defines *************************************************************/
/*************************************************************************************************/

#define PRODSTR_TABLE_SIZE    (200u)

/*************************************************************************************************/
/*************************** Typedefs ************************************************************/
/*************************************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif

typedef const char * (*resolve_funptr_t)(const void *config);

typedef const char * (*terminate_funptr_t)(const void *config);

struct prodstr_obj_s {
    struct prodstr_obj_s *next;   
    char *                name;   
    char *                type;   
    void *                config; 
    resolve_funptr_t      res;    
    terminate_funptr_t    term;   
};

typedef struct prodstr_obj_s prodstr_obj_t;



typedef struct {
    prodstr_obj_t *table[PRODSTR_TABLE_SIZE]; 
    size_t         count;                     
} prodstr_store_t;
#ifdef __cplusplus
}
#endif
/*************************************************************************************************/
/*************************** Public Function Declarations ****************************************/
/*************************************************************************************************/

#ifdef __cplusplus
extern "C"
{
#endif

bool prodstr_add(prodstr_store_t *store, prodstr_obj_t *prd);

const prodstr_obj_t *prodstr_find(const prodstr_store_t *store,
                                  const char *name);

#ifdef __cplusplus
}
#endif

#endif /* end PRODUCTION_STORE_H*/