Componentes.Terceros.RemObj.../internal/6.0.43.801/1/RemObjects Samples/RemObjects SDK for Delphi/Proxy Server/ProxyServerMainLibrary_Intf.pas
2010-01-29 16:17:43 +00:00

248 lines
7.5 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. }
{----------------------------------------------------------------------------}
{$I RemObjects.inc}
interface
uses
{vcl:} Classes, TypInfo,
{RemObjects:} uROXMLIntf, uROClasses, uROClient, uROTypes, uROClientIntf;
const
{ Library ID }
LibraryUID = '{00B1E82E-7479-4679-AB2F-4D18228C6F44}';
TargetNamespace = '';
{ Service Interface ID's }
IProxyServerMainService_IID : TGUID = '{00B1E82E-7479-4679-AB2F-4D18228C6F44}';
{ Event ID's }
type
TSeekOrigin = Classes.TSeekOrigin; // fake declaration
{ Forward declarations }
IProxyServerMainService = interface;
TestStruct = class;
{ TestStruct }
TestStruct = class(TROComplexType)
private
fName: AnsiString;
fIntNumber: Integer;
public
procedure Assign(iSource: TPersistent); override;
procedure ReadComplex(ASerializer: TObject); override;
procedure WriteComplex(ASerializer: TObject); override;
published
property Name:AnsiString read fName write fName;
property IntNumber:Integer read fIntNumber write fIntNumber;
end;
{ TestStructCollection }
TestStructCollection = class(TROCollection)
protected
constructor Create(aItemClass: TCollectionItemClass); overload;
function GetItems(aIndex: integer): TestStruct;
procedure SetItems(aIndex: 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, uROSerializer, uRORes;
{ TestStruct }
procedure TestStruct.Assign(iSource: TPersistent);
var lSource: ProxyServerMainLibrary_Intf.TestStruct;
begin
inherited Assign(iSource);
if (iSource is ProxyServerMainLibrary_Intf.TestStruct) then begin
lSource := ProxyServerMainLibrary_Intf.TestStruct(iSource);
Name := lSource.Name;
IntNumber := lSource.IntNumber;
end;
end;
procedure TestStruct.ReadComplex(ASerializer: TObject);
var
l_IntNumber: Integer;
l_Name: AnsiString;
begin
if TROSerializer(ASerializer).RecordStrictOrder then begin
l_Name := Name;
TROSerializer(ASerializer).ReadAnsiString('Name', l_Name);
Name := l_Name;
l_IntNumber := IntNumber;
TROSerializer(ASerializer).ReadInteger('IntNumber', otSLong, l_IntNumber);
IntNumber := l_IntNumber;
end
else begin
l_IntNumber := IntNumber;
TROSerializer(ASerializer).ReadInteger('IntNumber', otSLong, l_IntNumber);
IntNumber := l_IntNumber;
l_Name := Name;
TROSerializer(ASerializer).ReadAnsiString('Name', l_Name);
Name := l_Name;
end;
end;
procedure TestStruct.WriteComplex(ASerializer: TObject);
var
l_IntNumber: Integer;
l_Name: AnsiString;
begin
if TROSerializer(ASerializer).RecordStrictOrder then begin
TROSerializer(ASerializer).ChangeClass(TestStruct);
l_Name := Name;
TROSerializer(ASerializer).WriteAnsiString('Name', l_Name);
l_IntNumber := IntNumber;
TROSerializer(ASerializer).WriteInteger('IntNumber', otSLong, l_IntNumber);
end
else begin
l_IntNumber := IntNumber;
TROSerializer(ASerializer).WriteInteger('IntNumber', otSLong, l_IntNumber);
l_Name := Name;
TROSerializer(ASerializer).WriteAnsiString('Name', l_Name);
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(aIndex: integer): TestStruct;
begin
result := TestStruct(inherited Items[aIndex]);
end;
procedure TestStructCollection.SetItems(aIndex: integer; const Value: TestStruct);
begin
TestStruct(inherited Items[aIndex]).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.UnsetAttributes(__TransportChannel);
__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.UnsetAttributes(__TransportChannel);
__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.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
initialization
RegisterROClass(TestStruct);
RegisterProxyClass(IProxyServerMainService_IID, TProxyServerMainService_Proxy);
finalization
UnregisterROClass(TestStruct);
UnregisterProxyClass(IProxyServerMainService_IID);
end.