Componentes.Terceros.RemObj.../internal/5.0.23.613/1/RemObjects SDK for Delphi/Samples/Proxy Server/ProxyServerMainLibrary_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

195 lines
5.7 KiB
ObjectPascal

unit ProxyServerMainLibrary_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 = '{00B1E82E-7479-4679-AB2F-4D18228C6F44}';
{ Service Interface ID's }
IProxyServerMainService_IID : TGUID = '{00B1E82E-7479-4679-AB2F-4D18228C6F44}';
{ Event ID's }
type
{ Forward declarations }
IProxyServerMainService = interface;
TestStruct = class;
{ TestStruct }
TestStruct = class(TROComplexType)
private
fName: String;
fIntNumber: Integer;
public
procedure Assign(iSource: TPersistent); override;
published
property Name:String read fName write fName;
property IntNumber:Integer read fIntNumber write fIntNumber;
end;
{ TestStructCollection }
TestStructCollection = class(TROCollection)
protected
constructor Create(aItemClass: TCollectionItemClass); overload;
function GetItems(Index: integer): TestStruct;
procedure SetItems(Index: integer; const Value: TestStruct);
public
constructor Create; overload;
function Add: TestStruct; reintroduce;
property Items[Index: integer]:TestStruct read GetItems write SetItems; default;
end;
{ IProxyServerMainService }
IProxyServerMainService = interface
['{00B1E82E-7479-4679-AB2F-4D18228C6F44}']
function Sum(const A: Integer; const B: Integer): Integer;
function GetServerTime: DateTime;
function EchoStruct(const aTestStruct: TestStruct): TestStruct;
end;
{ CoProxyServerMainService }
CoProxyServerMainService = class
class function Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IProxyServerMainService;
end;
{ TProxyServerMainService_Proxy }
TProxyServerMainService_Proxy = class(TROProxy, IProxyServerMainService)
protected
function __GetInterfaceName:string; override;
function Sum(const A: Integer; const B: Integer): Integer;
function GetServerTime: DateTime;
function EchoStruct(const aTestStruct: TestStruct): TestStruct;
end;
implementation
uses
{vcl:} SysUtils,
{RemObjects:} uROEventRepository, uRORes;
{ TestStruct }
procedure TestStruct.Assign(iSource: TPersistent);
var lSource:TestStruct;
begin
inherited Assign(iSource);
if (iSource is TestStruct) then begin
lSource := TestStruct(iSource);
Name := lSource.Name;
IntNumber := lSource.IntNumber;
end;
end;
{ TestStructCollection }
constructor TestStructCollection.Create;
begin
inherited Create(TestStruct);
end;
constructor TestStructCollection.Create(aItemClass: TCollectionItemClass);
begin
inherited Create(aItemClass);
end;
function TestStructCollection.Add: TestStruct;
begin
result := TestStruct(inherited Add);
end;
function TestStructCollection.GetItems(Index: integer): TestStruct;
begin
result := TestStruct(inherited Items[Index]);
end;
procedure TestStructCollection.SetItems(Index: integer; const Value: TestStruct);
begin
TestStruct(inherited Items[Index]).Assign(Value);
end;
{ CoProxyServerMainService }
class function CoProxyServerMainService.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IProxyServerMainService;
begin
result := TProxyServerMainService_Proxy.Create(aMessage, aTransportChannel);
end;
{ TProxyServerMainService_Proxy }
function TProxyServerMainService_Proxy.__GetInterfaceName:string;
begin
result := 'ProxyServerMainService';
end;
function TProxyServerMainService_Proxy.Sum(const A: Integer; const B: Integer): Integer;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ProxyServerMainLibrary', __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 TProxyServerMainService_Proxy.GetServerTime: DateTime;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ProxyServerMainLibrary', __InterfaceName, 'GetServerTime');
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(DateTime), result, [paIsDateTime]);
finally
__Message.FreeStream;
end
end;
function TProxyServerMainService_Proxy.EchoStruct(const aTestStruct: TestStruct): TestStruct;
begin
try
result := nil;
__Message.InitializeRequestMessage(__TransportChannel, 'ProxyServerMainLibrary', __InterfaceName, 'EchoStruct');
__Message.Write('aTestStruct', TypeInfo(ProxyServerMainLibrary_Intf.TestStruct), aTestStruct, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(ProxyServerMainLibrary_Intf.TestStruct), result, []);
finally
__Message.FreeStream;
end
end;
initialization
RegisterROClass(TestStruct);
RegisterProxyClass(IProxyServerMainService_IID, TProxyServerMainService_Proxy);
finalization
UnregisterROClass(TestStruct);
UnregisterProxyClass(IProxyServerMainService_IID);
end.