stack.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* $Id$
  2. *
  3. * Copyright 2001-2003, Meiosys (www.meiosys.com). All rights reserved.
  4. *
  5. * See the COPYING file for the terms of usage and distribution.
  6. */
  7. #ifndef __sd_stack_h
  8. #define __sd_stack_h
  9. /**
  10. * @file stack.h @ingroup sd
  11. *
  12. * @brief Generic stack object.
  13. *
  14. * @todo documentation
  15. * @todo API homogeneity with sd_list and sd_hash
  16. */
  17. #include <stddef.h>
  18. #include <sd/defs.h>
  19. __SD_BEGIN_DECLS
  20. typedef struct __sd_stack sd_stack_t;
  21. extern sd_stack_t* sd_stack_new(size_t max);
  22. extern void sd_stack_delete(sd_stack_t* astack, void (*free_data_fn)(void *));
  23. extern size_t sd_stack_get_nelem(const sd_stack_t* astack);
  24. extern void sd_stack_clear(sd_stack_t* astack, void (*free_data_fn)(void *));
  25. extern int sd_stack_push(sd_stack_t* astack, void *data);
  26. extern void* sd_stack_pop(sd_stack_t* astack);
  27. extern void* sd_stack_begin(sd_stack_t* astack);
  28. extern void* sd_stack_next(sd_stack_t* astack);
  29. extern void* sd_stack_end(sd_stack_t* astack);
  30. extern void* sd_stack_peek(sd_stack_t* astack);
  31. __SD_END_DECLS
  32. #endif