2 * Copyright (c) 2005, Herve Drolon, FreeImage Team
3 * Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
4 * Copyright (c) 2012, CS Systemes d'Information, France
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
32 @brief Implementation of a event callback system
34 The functions in EVENT.C have for goal to send output messages (errors, warnings, debug) to the user.
37 Message handler object
42 <li>Debugging messages
45 typedef struct opj_event_mgr
47 /** Data to call the event manager upon */
49 /** Data to call the event manager upon */
50 void * m_warning_data;
51 /** Data to call the event manager upon */
53 /** Error message callback if available, NULL otherwise */
54 opj_msg_callback error_handler;
55 /** Warning message callback if available, NULL otherwise */
56 opj_msg_callback warning_handler;
57 /** Debug message callback if available, NULL otherwise */
58 opj_msg_callback info_handler;
62 #define EVT_ERROR 1 /**< Error event type */
63 #define EVT_WARNING 2 /**< Warning event type */
64 #define EVT_INFO 4 /**< Debug event type */
66 /** @defgroup EVENT EVENT - Implementation of a event callback system */
69 /** @name Exported functions (see also openjpeg.h) */
71 /* ----------------------------------------------------------------------- */
74 /* ----------------------------------------------------------------------- */
77 * Write formatted data to a string and send the string to a user callback.
79 * @param event_mgr Event handler
80 * @param event_type Event type or callback to use to send the message
81 * @param fmt Format-control string (plus optional arguments)
83 * @return Returns true if successful, returns false otherwise
85 OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, int event_type, const char *fmt, ...);
86 /* ----------------------------------------------------------------------- */
89 * Set the event manager with the default callback function for the 3 levels.
91 void opj_set_default_event_handler(opj_event_mgr_t * p_manager);
97 #endif /* __EVENT_H */