TutPtrAryChangeCbCreate


Name

TutPtrAryChangeCbCreate — create a callback that is called when a pointer array changes

Synopsis

T_CB TutPtrAryChangeCbCreate(ptr_ary, change_func, arg) 
T_PTR_ARY ptr_ary; 
T_PTR_ARY_CHANGE_CB_FUNC change_func; 
T_CB_ARG arg; 

Arguments

ptr_ary — pointer array to register the change callback for

change_func — callback function

arg — callback function argument

Return Values

New callback if successful, NULL otherwise.

Diagnostics

If TutPtrAryChangeCbCreate fails, it returns NULL and sets the global SmartSockets error number to:

Description

TutPtrAryChangeCbCreate attaches the change_func callback to ptr_ary. When an item in ptr_ary is inserted or removed, change_func is called with three arguments:

Caution

The T_ENTRY declaration specifier is required in the definition of all callback functions in addition to their prototypes.

See Also

TutPtrAryChangeCbLookup

Examples

This example displays output when a pointer array changes:

void T_ENTRY PtrAryChanged(ptr_ary, data, arg) 
T_PTR_ARY ptr_ary; 
T_PTR_ARY_CHANGE_CB_DATA data; 
T_CB_ARG arg; 
{ 
  TutOut("Pointer array change reason is %d.\n", data->reason); 
} /* PtrAryChanged */ 
. 
. 
. 
T_CB cb;  
 
cb = TutPtrAryChangeCbCreate(ptr_ary, PtrAryChanged, NULL); 
if (cb == NULL) { 
  /* error */ 
} 

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