📄 project1_tlb.~pas
字号:
unit Project1_TLB;
// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// PASTLWTR : $Revision: 1.130 $
// File generated on 2001-9-9 15:55:51 from Type Library described below.
// ************************************************************************ //
// Type Lib: E:\delphibook\第五章 CORBA分布式应用程序结构\S5_1\ServerApp.tlb (1)
// LIBID: {1644E75B-213F-44B6-853E-28B0B893EBB0}
// LCID: 0
// Helpfile:
// DepndLst:
// (1) v2.0 stdole, (D:\WINNT\System32\stdole2.tlb)
// (2) v4.0 StdVCL, (D:\WINNT\System32\stdvcl40.dll)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
interface
uses ActiveX, Classes, CORBAObj, CorbaStd, Graphics, OrbPas, StdVCL,
SysUtils, Variants, Windows;
// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
Project1MajorVersion = 1;
Project1MinorVersion = 0;
LIBID_Project1: TGUID = '{1644E75B-213F-44B6-853E-28B0B893EBB0}';
IID_ICorbaSample: TGUID = '{63D6D180-94AB-45B5-B43E-A369AB54FA5C}';
CLASS_CorbaSample: TGUID = '{FBB214BB-2D5B-4D6A-9BB5-A365A16B7769}';
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
ICorbaSample = interface;
ICorbaSampleDisp = dispinterface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
CorbaSample = ICorbaSample;
// *********************************************************************//
// Interface: ICorbaSample
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {63D6D180-94AB-45B5-B43E-A369AB54FA5C}
// *********************************************************************//
ICorbaSample = interface(IDispatch)
['{63D6D180-94AB-45B5-B43E-A369AB54FA5C}']
function Add(x: Integer; y: Integer): Integer; safecall;
function Subtract(x: Integer; y: Integer): Integer; safecall;
function Multiply(x: Integer; y: Integer): Integer; safecall;
function Divide(x: Integer; y: Integer): Single; safecall;
end;
// *********************************************************************//
// DispIntf: ICorbaSampleDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {63D6D180-94AB-45B5-B43E-A369AB54FA5C}
// *********************************************************************//
ICorbaSampleDisp = dispinterface
['{63D6D180-94AB-45B5-B43E-A369AB54FA5C}']
function Add(x: Integer; y: Integer): Integer; dispid 1;
function Subtract(x: Integer; y: Integer): Integer; dispid 2;
function Multiply(x: Integer; y: Integer): Integer; dispid 3;
function Divide(x: Integer; y: Integer): Single; dispid 4;
end;
TCorbaSampleStub = class(TCorbaDispatchStub, ICorbaSample)
public
function Add(x: Integer; y: Integer): Integer; safecall;
function Subtract(x: Integer; y: Integer): Integer; safecall;
function Multiply(x: Integer; y: Integer): Integer; safecall;
function Divide(x: Integer; y: Integer): Single; safecall;
end;
TCorbaSampleSkeleton = class(TCorbaSkeleton)
private
FIntf: ICorbaSample;
public
constructor Create(const InstanceName: string; const Impl: IUnknown); override;
procedure GetImplementation(out Impl: IUnknown); override; stdcall;
published
procedure Add(const InBuf: IMarshalInBuffer; Cookie: Pointer);
procedure Subtract(const InBuf: IMarshalInBuffer; Cookie: Pointer);
procedure Multiply(const InBuf: IMarshalInBuffer; Cookie: Pointer);
procedure Divide(const InBuf: IMarshalInBuffer; Cookie: Pointer);
end;
// *********************************************************************//
// The Class CoCorbaSample provides a Create and CreateRemote method to
// create instances of the default interface ICorbaSample exposed by
// the CoClass CorbaSample. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoCorbaSample = class
class function Create: ICorbaSample;
class function CreateRemote(const MachineName: string): ICorbaSample;
end;
TCorbaSampleCorbaFactory = class
class function CreateInstance(const InstanceName: string): ICorbaSample;
end;
implementation
uses ComObj;
{ TCorbaSampleStub }
function TCorbaSampleStub.Add(x: Integer; y: Integer): Integer;
var
OutBuf: IMarshalOutBuffer;
InBuf: IMarshalInBuffer;
begin
FStub.CreateRequest('Add', True, OutBuf);
OutBuf.PutLong(x);
OutBuf.PutLong(y);
FStub.Invoke(OutBuf, InBuf);
Result := InBuf.GetLong;
end;
function TCorbaSampleStub.Subtract(x: Integer; y: Integer): Integer;
var
OutBuf: IMarshalOutBuffer;
InBuf: IMarshalInBuffer;
begin
FStub.CreateRequest('Subtract', True, OutBuf);
OutBuf.PutLong(x);
OutBuf.PutLong(y);
FStub.Invoke(OutBuf, InBuf);
Result := InBuf.GetLong;
end;
function TCorbaSampleStub.Multiply(x: Integer; y: Integer): Integer;
var
OutBuf: IMarshalOutBuffer;
InBuf: IMarshalInBuffer;
begin
FStub.CreateRequest('Multiply', True, OutBuf);
OutBuf.PutLong(x);
OutBuf.PutLong(y);
FStub.Invoke(OutBuf, InBuf);
Result := InBuf.GetLong;
end;
function TCorbaSampleStub.Divide(x: Integer; y: Integer): Single;
var
OutBuf: IMarshalOutBuffer;
InBuf: IMarshalInBuffer;
begin
FStub.CreateRequest('Divide', True, OutBuf);
OutBuf.PutLong(x);
OutBuf.PutLong(y);
FStub.Invoke(OutBuf, InBuf);
Result := InBuf.GetFloat;
end;
{ TCorbaSampleSkeleton }
constructor TCorbaSampleSkeleton.Create(const InstanceName: string; const Impl: IUnknown);
begin
inherited;
inherited InitSkeleton('CorbaSample', InstanceName, 'IDL:Project1/ICorbaSample:1.0', tmMultiThreaded, True);
FIntf := Impl as ICorbaSample;
end;
procedure TCorbaSampleSkeleton.GetImplementation(out Impl: IUnknown);
begin
Impl := FIntf;
end;
procedure TCorbaSampleSkeleton.Add(const InBuf: IMarshalInBuffer; Cookie: Pointer);
var
OutBuf: IMarshalOutBuffer;
Retval: Integer;
x: Integer;
y: Integer;
begin
x := InBuf.GetLong;
y := InBuf.GetLong;
Retval := FIntf.Add(x, y);
FSkeleton.GetReplyBuffer(Cookie, OutBuf);
OutBuf.PutLong(Retval);
end;
procedure TCorbaSampleSkeleton.Subtract(const InBuf: IMarshalInBuffer; Cookie: Pointer);
var
OutBuf: IMarshalOutBuffer;
Retval: Integer;
x: Integer;
y: Integer;
begin
x := InBuf.GetLong;
y := InBuf.GetLong;
Retval := FIntf.Subtract(x, y);
FSkeleton.GetReplyBuffer(Cookie, OutBuf);
OutBuf.PutLong(Retval);
end;
procedure TCorbaSampleSkeleton.Multiply(const InBuf: IMarshalInBuffer; Cookie: Pointer);
var
OutBuf: IMarshalOutBuffer;
Retval: Integer;
x: Integer;
y: Integer;
begin
x := InBuf.GetLong;
y := InBuf.GetLong;
Retval := FIntf.Multiply(x, y);
FSkeleton.GetReplyBuffer(Cookie, OutBuf);
OutBuf.PutLong(Retval);
end;
procedure TCorbaSampleSkeleton.Divide(const InBuf: IMarshalInBuffer; Cookie: Pointer);
var
OutBuf: IMarshalOutBuffer;
Retval: Single;
x: Integer;
y: Integer;
begin
x := InBuf.GetLong;
y := InBuf.GetLong;
Retval := FIntf.Divide(x, y);
FSkeleton.GetReplyBuffer(Cookie, OutBuf);
OutBuf.PutFloat(Retval);
end;
class function CoCorbaSample.Create: ICorbaSample;
begin
Result := CreateComObject(CLASS_CorbaSample) as ICorbaSample;
end;
class function CoCorbaSample.CreateRemote(const MachineName: string): ICorbaSample;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CorbaSample) as ICorbaSample;
end;
class function TCorbaSampleCorbaFactory.CreateInstance(const InstanceName: string): ICorbaSample;
begin
Result := CorbaFactoryCreateStub('IDL:Project1/CorbaSampleFactory:1.0', 'CorbaSample',
InstanceName, '', ICorbaSample) as ICorbaSample;
end;
initialization
CorbaStubManager.RegisterStub(ICorbaSample, TCorbaSampleStub);
CorbaInterfaceIDManager.RegisterInterface(ICorbaSample, 'IDL:Project1/ICorbaSample:1.0');
CorbaSkeletonManager.RegisterSkeleton(ICorbaSample, TCorbaSampleSkeleton);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -