Componentes.Terceros.RemObj.../internal/5.0.23.613/1/RemObjects SDK for Delphi/Samples/Dynamic Request/DynamicRequestLibrary_Intf.pas
david 2824855ea7 - Modificación del paquete RemObjects_Core_D10 para que sea un paquete de runtime/designtime (antes era designtime sólo)
- Recompilación en Delphi10 de todos los paquetes de RO para generar las DCU's en Lib\D10
- Recompilación en Delphi10 de todos los paquetes de DA para generar las DCU's en Lib\D10

git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@9 b6239004-a887-0f4b-9937-50029ccdca16
2007-09-10 14:06:19 +00:00

204 lines
5.9 KiB
ObjectPascal

unit DynamicRequestLibrary_Intf;
{----------------------------------------------------------------------------}
{ This unit was automatically generated by the RemObjects SDK after reading }
{ the RODL file associated with this project . }
{ }
{ Do not modify this unit manually, or your changes will be lost when this }
{ unit is regenerated the next time you compile the project. }
{----------------------------------------------------------------------------}
interface
uses
{vcl:} Classes, TypInfo,
{RemObjects:} uROClasses, uROClient, uROTypes, uROClientIntf;
const
{ Library ID }
LibraryUID = '{D9821C1A-A084-4120-93F3-BCE6CF2AE0F4}';
{ Service Interface ID's }
IDynamicRequestService_IID : TGUID = '{D9821C1A-A084-4120-93F3-BCE6CF2AE0F4}';
{ Event ID's }
type
{ Forward declarations }
IDynamicRequestService = interface;
TPerson = class;
{ Enumerateds }
TSex = (sxMale,sxFemale);
{ TPerson }
TPerson = class(TROComplexType)
private
fFirstName: String;
fLastName: String;
fAge: Integer;
fSex: TSex;
public
procedure Assign(iSource: TPersistent); override;
published
property FirstName:String read fFirstName write fFirstName;
property LastName:String read fLastName write fLastName;
property Age:Integer read fAge write fAge;
property Sex:TSex read fSex write fSex;
end;
{ TPersonCollection }
TPersonCollection = class(TROCollection)
protected
constructor Create(aItemClass: TCollectionItemClass); overload;
function GetItems(Index: integer): TPerson;
procedure SetItems(Index: integer; const Value: TPerson);
public
constructor Create; overload;
function Add: TPerson; reintroduce;
property Items[Index: integer]:TPerson read GetItems write SetItems; default;
end;
{ IDynamicRequestService }
IDynamicRequestService = interface
['{D9821C1A-A084-4120-93F3-BCE6CF2AE0F4}']
function Sum(const A: Integer; const B: Integer): Integer;
function GetServerTime: DateTime;
procedure EchoPerson(const aPerson: TPerson; out anotherPerson: TPerson);
end;
{ CoDynamicRequestService }
CoDynamicRequestService = class
class function Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IDynamicRequestService;
end;
{ TDynamicRequestService_Proxy }
TDynamicRequestService_Proxy = class(TROProxy, IDynamicRequestService)
protected
function __GetInterfaceName:string; override;
function Sum(const A: Integer; const B: Integer): Integer;
function GetServerTime: DateTime;
procedure EchoPerson(const aPerson: TPerson; out anotherPerson: TPerson);
end;
implementation
uses
{vcl:} SysUtils,
{RemObjects:} uROEventRepository, uRORes;
{ TPerson }
procedure TPerson.Assign(iSource: TPersistent);
var lSource:TPerson;
begin
inherited Assign(iSource);
if (iSource is TPerson) then begin
lSource := TPerson(iSource);
FirstName := lSource.FirstName;
LastName := lSource.LastName;
Age := lSource.Age;
Sex := lSource.Sex;
end;
end;
{ TPersonCollection }
constructor TPersonCollection.Create;
begin
inherited Create(TPerson);
end;
constructor TPersonCollection.Create(aItemClass: TCollectionItemClass);
begin
inherited Create(aItemClass);
end;
function TPersonCollection.Add: TPerson;
begin
result := TPerson(inherited Add);
end;
function TPersonCollection.GetItems(Index: integer): TPerson;
begin
result := TPerson(inherited Items[Index]);
end;
procedure TPersonCollection.SetItems(Index: integer; const Value: TPerson);
begin
TPerson(inherited Items[Index]).Assign(Value);
end;
{ CoDynamicRequestService }
class function CoDynamicRequestService.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IDynamicRequestService;
begin
result := TDynamicRequestService_Proxy.Create(aMessage, aTransportChannel);
end;
{ TDynamicRequestService_Proxy }
function TDynamicRequestService_Proxy.__GetInterfaceName:string;
begin
result := 'DynamicRequestService';
end;
function TDynamicRequestService_Proxy.Sum(const A: Integer; const B: Integer): Integer;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'DynamicRequestLibrary', __InterfaceName, 'Sum');
__Message.Write('A', TypeInfo(Integer), A, []);
__Message.Write('B', TypeInfo(Integer), B, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Integer), result, []);
finally
__Message.FreeStream;
end
end;
function TDynamicRequestService_Proxy.GetServerTime: DateTime;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'DynamicRequestLibrary', __InterfaceName, 'GetServerTime');
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(DateTime), result, [paIsDateTime]);
finally
__Message.FreeStream;
end
end;
procedure TDynamicRequestService_Proxy.EchoPerson(const aPerson: TPerson; out anotherPerson: TPerson);
begin
try
anotherPerson := nil;
__Message.InitializeRequestMessage(__TransportChannel, 'DynamicRequestLibrary', __InterfaceName, 'EchoPerson');
__Message.Write('aPerson', TypeInfo(DynamicRequestLibrary_Intf.TPerson), aPerson, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('anotherPerson', TypeInfo(DynamicRequestLibrary_Intf.TPerson), anotherPerson, []);
finally
__Message.FreeStream;
end
end;
initialization
RegisterROClass(TPerson);
RegisterProxyClass(IDynamicRequestService_IID, TDynamicRequestService_Proxy);
finalization
UnregisterROClass(TPerson);
UnregisterProxyClass(IDynamicRequestService_IID);
end.