On Mon, Mar 24, 2008 at 12:58:07PM -0700, Steven Dake wrote:
> dataconf_error_t dataconf_initialize (
>       dataconf_handle_t *handle,
>       dataconf_callbacks_t *callbacks);
<snip>
> dataconf_error_t dataconf_track (
>       dataconf_handle_t dataconf_handle,
>       char *xml_request,
>       int track_flags);

        Why do we have a single callback, btw?  Why aren't we doing:

dataconf_error_t dataconf_initialize(dataconf_handle_t *handle);
dataconf_error_t dataconf_track(
        dataconf_handle_t handle,
        char *xml_request,
        int track_flags,
        void (*callback)(void *obj, void *key, void *value, void *user_data),
        void *user_data);

In this fashion, the user could have many callbacks, each specific
to the type of data they are expecting.  Then the caller doesn't have
to have a giant if() block:

    classic_ais_callback(void *obj, void *key, void *value)
    {
            if (object == obj1)
                    call_one(object, key, value)
            else if (object == obj2)
                    call_two(object, key, value)
            ...
    }

Joel

-- 

"The whole principle is wrong; it's like demanding that grown men 
 live on skim milk because the baby can't eat steak."
        - author Robert A. Heinlein on censorship

Joel Becker
Principal Software Developer
Oracle
E-mail: [EMAIL PROTECTED]
Phone: (650) 506-8127
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to