pair.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*!
  2. Temelia - Pair interface.
  3. Copyright (C) 2008, 2009 Ceata (http://cod.ceata.org/proiecte/temelia).
  4. @author Dascalu Laurentiu
  5. This program is free software; you can redistribute it and
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 3
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. */
  17. #ifndef PAIR_H_
  18. #define PAIR_H_
  19. #include "platform.h"
  20. struct _pair_t;
  21. typedef struct _pair_t *pair_t;
  22. /*!
  23. * @brief Constructor - returns a pair containing key and value.
  24. * Complexity O(1)
  25. *
  26. * @param Key
  27. * @param Value
  28. */
  29. DECLSPEC pair_t pair_new(void *key, void *value);
  30. /*!
  31. * @brief Destructor - frees the memory occupied by pair.
  32. * Complexity O(1)
  33. *
  34. * @param Pair
  35. */
  36. DECLSPEC void pair_delete(pair_t pair);
  37. /*!
  38. * @brief Sets key of pair.
  39. * Complexity O(1)
  40. *
  41. * @param Pair
  42. * @param Key
  43. */
  44. DECLSPEC void pair_set_key(pair_t pair, void *key);
  45. /*!
  46. * @brief Sets value of pair.
  47. * Complexity O(1)
  48. *
  49. * @param Pair
  50. * @param Value
  51. */
  52. DECLSPEC void pair_set_value(pair_t pair, void *value);
  53. /*!
  54. * @brief Returns key of pair.
  55. * Complexity O(1)
  56. *
  57. * @param Pair
  58. */
  59. DECLSPEC void *pair_get_key(pair_t pair);
  60. /*!
  61. * @brief Returns value of pair.
  62. * Complexity O(1)
  63. *
  64. * @param Pair
  65. */
  66. DECLSPEC void *pair_get_value(pair_t pair);
  67. #endif /*! PAIR_H_ */