TutCbGetFunction


Name

TutCbGetFunction — get the callback function of the specified callback

Synopsis

T_BOOL TutCbGetFunction(cb, func_return) 
T_CB cb; 
T_CB_FUNC *func_return; 

Arguments

cb — callback to get the function of

func_return — pointer to location for the result

Return Values

TRUE if successful, FALSE otherwise.

Diagnostics

None

Description

TutCbGetFunction returns the callback function that is called when cb is next processed and stores it in the location pointed to by func_return.

This function uses the generic callback function definition, so it is usually necessary to cast the type-specific callback function to the generic type when using this function.

Caution

None

See Also

TutCbSetFunction

Examples

This example creates a callback and then alternates between two functions for the callback function:

static void T_ENTRY time_change_cb_odd(dummy, data, arg) 
T_PTR dummy; /* always NULL */ 
T_TIME_CHANGE_CB_DATA data; 
T_CB_ARG arg; 
{ 
  T_CB_FUNC cb_func; 
  /* Forward declaration of the other callback function so the */ 
  /* compiler will recognize this symbol */ 
  extern T_TIME_CHANGE_CB_FUNC time_change_cb_even; 
 
  TutOut("Time change odd callback called\n"); 
  /* Make sure the callback function is set properly. */ 
  if (!TutCbGetFunction(data, &cb_func)) { 
    /* error */ 
  } 
  if (cb_func != (T_CB_FUNC)time_change_cb_odd) { 
    /* error */ 
  } 
  if (!TutCbSetFunction(data->cb, (T_CB_FUNC)time_change_cb_even)) 
{ 
    /* error */ 
  } 
} 
 
static void T_ENTRY time_change_cb_even(dummy, data, arg) 
T_PTR dummy; /* always NULL */ 
T_TIME_CHANGE_CB_DATA data; 
T_CB_ARG arg; 
{ 
  T_CB_FUNC cb_func; 
  TutOut("Time change even callback called\n"); 
  /* Make sure the callback function is set properly. */ 
  if (!TutCbGetFunction(data, &cb_func)) { 
  /* error */ 
  } 
  if (cb_func != (T_CB_FUNC)time_change_cb_even) { 
    /* error */ 
  } 
  if (!TutCbSetFunction(data->cb, (T_CB_FUNC)time_change_cb_odd)) 
{ 
    /* error */ 
  } 
} 
 
if (TutTimeChangeCbCreate(time_change_cb_even, NULL) == NULL) { 
  /* error */ 
} 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com