[AWS] Callback Class?
Pascal Obry
p.obry@wanadoo.fr
Fri, 7 Jun 2002 22:35:07 +0200
Jeremy,
> Can anyone give me a short example or explain what the
> AWS.Services.Dispatchers.URI.Register_Default_Callback is looking for on
> it's Action parameter?
procedure Register_Default_Callback
(Dispatcher : in out Handler;
Action : in AWS.Dispatchers.Handler'Class);
It is looking for a dispatcher handler. Any type derived from
AWS.Dispatchers.Handler. For example:
function My_Default (S : Status.Data) return Response.Data is
...
end My_Default;
H : AWS.Services.Dispatchers.URI.Handler;
H_Default : AWS.Dispatchers.Callback.Handler;
...
AWS.Dispatchers.Callback.Create (H_Default, My_Default'Access);
Register_Default_Callback (H, H_Default);
> I am realitively new to Ada (not programming) and the request for a
> 'Class vs. a Callback is confusing me and I have not figured out how to
> utilize this important function.
A Callback is:
type Callback is access function (Request : in Status.Data) return Data;
and is an access to procedure, used with 'Access se above.
The T'Class is a class-wide type. In example above it means that Action can
handle an object of type AWS.Dispatchers.Handler and all types derived from
it. Action is called a class-wide object in Ada, it is called a polymorphic
object in C++. Please no war about polymorphic, I know that this term has
two different definitions.
Hope it is clear.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595