Archived

This forum has been archived. Please start a new discussion on GitHub.

Callback Inheritance

I saw a related question in the forum related to C#, and perhaps there is already an easy way to do this, but it would seem useful to have the option of creating a hierarchy of AMD callback classes.

For example, given these 2 AMD methods:

["amd"] void getData1( string param1, out int result );
["amd"] void getData2( string param1, string param2, out int result );


In the server implementation, the callback method signatures (ice_response, ice_exception) would be identical. It would be convenient to have the 2 callback classes derive from a common base class or interface. This way, the server could handle callbacks without concern for the specific type of callback object. This would be especially useful when handling general server exceptions, giving the server the ability to raise an exception to any callback object.

Obviously, I can modify the generated code to achieve this, but it seems to me that this capability would have general usefulness. Perhaps this could be an additional Slice metadata directive. For example:

["amd", “callback:implements:namespace.class”] void getData1( string param1, out int result );
["amd", “callback:implements:namespace.class”] void getData2( string param1, string param2, out int result );


Thanks
Trevor