function_list.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * The copyright in this software is being made available under the 2-clauses
  3. * BSD License, included below. This software may be subject to other third
  4. * party and contributor rights, including patent rights, and no such rights
  5. * are granted under this license.
  6. *
  7. * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
  20. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29. * POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. #ifndef OPJ_FUNCTION_LIST_H
  32. #define OPJ_FUNCTION_LIST_H
  33. /**
  34. * @file function_list.h
  35. * @brief Implementation of a list of procedures.
  36. * The functions in validation.c aims to have access to a list of procedures.
  37. */
  38. /** @defgroup VAL VAL - validation procedure*/
  39. /*@{*/
  40. /**************************************************************************************************
  41. ***************************************** FORWARD DECLARATION ************************************
  42. **************************************************************************************************/
  43. /**
  44. * declare a function pointer
  45. */
  46. typedef void (*opj_procedure)(void);
  47. /**
  48. * A list of procedures.
  49. */
  50. typedef struct opj_procedure_list {
  51. /**
  52. * The number of validation procedures.
  53. */
  54. OPJ_UINT32 m_nb_procedures;
  55. /**
  56. * The number of the array of validation procedures.
  57. */
  58. OPJ_UINT32 m_nb_max_procedures;
  59. /**
  60. * The array of procedures.
  61. */
  62. opj_procedure * m_procedures;
  63. } opj_procedure_list_t;
  64. /* ----------------------------------------------------------------------- */
  65. /**
  66. * Creates a validation list.
  67. *
  68. * @return the newly created validation list.
  69. */
  70. opj_procedure_list_t * opj_procedure_list_create(void);
  71. /**
  72. * Destroys a validation list.
  73. *
  74. * @param p_list the list to destroy.
  75. */
  76. void opj_procedure_list_destroy(opj_procedure_list_t * p_list);
  77. /**
  78. * Adds a new validation procedure.
  79. *
  80. * @param p_validation_list the list of procedure to modify.
  81. * @param p_procedure the procedure to add.
  82. * @param p_manager the user event manager.
  83. *
  84. * @return OPJ_TRUE if the procedure could be added.
  85. */
  86. OPJ_BOOL opj_procedure_list_add_procedure(opj_procedure_list_t *
  87. p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager);
  88. /**
  89. * Gets the number of validation procedures.
  90. *
  91. * @param p_validation_list the list of procedure to modify.
  92. *
  93. * @return the number of validation procedures.
  94. */
  95. OPJ_UINT32 opj_procedure_list_get_nb_procedures(opj_procedure_list_t *
  96. p_validation_list);
  97. /**
  98. * Gets the pointer on the first validation procedure. This function is similar to the C++
  99. * iterator class to iterate through all the procedures inside the validation list.
  100. * the caller does not take ownership of the pointer.
  101. *
  102. * @param p_validation_list the list of procedure to get the first procedure from.
  103. *
  104. * @return a pointer to the first procedure.
  105. */
  106. opj_procedure* opj_procedure_list_get_first_procedure(opj_procedure_list_t *
  107. p_validation_list);
  108. /**
  109. * Clears the list of validation procedures.
  110. *
  111. * @param p_validation_list the list of procedure to clear.
  112. *
  113. */
  114. void opj_procedure_list_clear(opj_procedure_list_t * p_validation_list);
  115. /*@}*/
  116. #endif /* OPJ_FUNCTION_LIST_H */