⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iqtest_c.pas

📁 Delphi 7组件与分布式应用开发源码,介绍了基础的组件应用实例
💻 PAS
字号:
unit IQTest_c;

{This file was generated on 16 Nov 2002 13:58:26 GMT by version 03.03.03.C1.A2}
{of the Inprise VisiBroker idl2pas CORBA IDL compiler.                        }

{Please do not edit the contents of this file. You should instead edit and    }
{recompile the original IDL which was located in the file Examination.idl.    }

{Delphi Pascal unit      : IQTest_c                                           }
{derived from IDL module : IQTest                                             }



interface

uses
  CORBA,
  IQTest_i;

type
  TIIQTestHelper = class;
  TIIQTestStub = class;
  TIQTestFactoryHelper = class;
  TIQTestFactoryStub = class;

  TIIQTestHelper = class
    class procedure Insert (var _A: CORBA.Any; const _Value : IQTest_i.IIQTest);
    class function  Extract(var _A: CORBA.Any) : IQTest_i.IIQTest;
    class function  TypeCode     : CORBA.TypeCode;
    class function  RepositoryId : string;
    class function  Read (const _Input  : CORBA.InputStream) : IQTest_i.IIQTest;
    class procedure Write(const _Output : CORBA.OutputStream; const _Value : IQTest_i.IIQTest);
    class function  Narrow(const _Obj   : CORBA.CORBAObject; _IsA : Boolean = False) : IQTest_i.IIQTest;
    class function  Bind(const _InstanceName : string = ''; _HostName : string = '') : IQTest_i.IIQTest; overload;
    class function  Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName: string = '') : IQTest_i.IIQTest; overload;
  end;

  TIIQTestStub = class(CORBA.TCORBAObject, IQTest_i.IIQTest)
  public
    function  Check ( const QuestionNo : Integer;
                      const QuestionAnswer : Integer): Boolean; virtual;
    function  Score : Integer; virtual;
  end;

  TIQTestFactoryHelper = class
    class procedure Insert (var _A: CORBA.Any; const _Value : IQTest_i.IQTestFactory);
    class function  Extract(var _A: CORBA.Any) : IQTest_i.IQTestFactory;
    class function  TypeCode     : CORBA.TypeCode;
    class function  RepositoryId : string;
    class function  Read (const _Input  : CORBA.InputStream) : IQTest_i.IQTestFactory;
    class procedure Write(const _Output : CORBA.OutputStream; const _Value : IQTest_i.IQTestFactory);
    class function  Narrow(const _Obj   : CORBA.CORBAObject; _IsA : Boolean = False) : IQTest_i.IQTestFactory;
    class function  Bind(const _InstanceName : string = ''; _HostName : string = '') : IQTest_i.IQTestFactory; overload;
    class function  Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName: string = '') : IQTest_i.IQTestFactory; overload;
  end;

  TIQTestFactoryStub = class(CORBA.TCORBAObject, IQTest_i.IQTestFactory)
  public
    function  CreateInstance ( const InstanceName : AnsiString): IQTest_i.IIQTest; virtual;
  end;


implementation

class procedure TIIQTestHelper.Insert(var _A : CORBA.Any; const _Value : IQTest_i.IIQTest);
begin
  _A := Orb.MakeObjectRef( TIIQTestHelper.TypeCode, _Value as CORBA.CORBAObject);
end;

class function TIIQTestHelper.Extract(var _A : CORBA.Any): IQTest_i.IIQTest;
var
  _obj : Corba.CorbaObject;
begin
  _obj := Orb.GetObjectRef(_A);
  Result := TIIQTestHelper.Narrow(_obj, True);
end;

class function TIIQTestHelper.TypeCode : CORBA.TypeCode;
begin
  Result := ORB.CreateInterfaceTC(RepositoryId, 'IIQTest');
end;

class function TIIQTestHelper.RepositoryId : string;
begin
  Result := 'IDL:IQTest/IIQTest:1.0';
end;

class function TIIQTestHelper.Read(const _Input : CORBA.InputStream) : IQTest_i.IIQTest;
var
  _Obj : CORBA.CORBAObject;
begin
  _Input.ReadObject(_Obj);
  Result := Narrow(_Obj, True)
end;

class procedure TIIQTestHelper.Write(const _Output : CORBA.OutputStream; const _Value : IQTest_i.IIQTest);
begin
  _Output.WriteObject(_Value as CORBA.CORBAObject);
end;

class function TIIQTestHelper.Narrow(const _Obj : CORBA.CORBAObject; _IsA : Boolean) : IQTest_i.IIQTest;
begin
  Result := nil;
  if (_Obj = nil) or (_Obj.QueryInterface(IQTest_i.IIQTest, Result) = 0) then
    exit;
  if _IsA and _Obj._IsA(RepositoryId) then
    Result := TIIQTestStub.Create(_Obj);
end;

class function TIIQTestHelper.Bind(const _InstanceName : string = ''; _HostName: string = '') : IQTest_i.IIQTest;
begin
  Result := Narrow(ORB.bind(RepositoryId, _InstanceName, _HostName), True);
end;

class function TIIQTestHelper.Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName : string = '') : IQTest_i.IIQTest;
begin
  Result := Narrow(ORB.bind(RepositoryId, _Options, _InstanceName, _HostName), True);
end;

function  TIIQTestStub.Check ( const QuestionNo : Integer;
                               const QuestionAnswer : Integer): Boolean;
var
  _Output: CORBA.OutputStream;
  _Input : CORBA.InputStream;
begin
  inherited _CreateRequest('Check',True, _Output);
  _Output.WriteLong(QuestionNo);
  _Output.WriteLong(QuestionAnswer);
  inherited _Invoke(_Output, _Input);
  _Input.ReadBoolean(Result);
end;

function  TIIQTestStub.Score : Integer;
var
  _Output: CORBA.OutputStream;
  _Input : CORBA.InputStream;
begin
  inherited _CreateRequest('Score',True, _Output);
  inherited _Invoke(_Output, _Input);
  _Input.ReadLong(Result);
end;

class procedure TIQTestFactoryHelper.Insert(var _A : CORBA.Any; const _Value : IQTest_i.IQTestFactory);
begin
  _A := Orb.MakeObjectRef( TIQTestFactoryHelper.TypeCode, _Value as CORBA.CORBAObject);
end;

class function TIQTestFactoryHelper.Extract(var _A : CORBA.Any): IQTest_i.IQTestFactory;
var
  _obj : Corba.CorbaObject;
begin
  _obj := Orb.GetObjectRef(_A);
  Result := TIQTestFactoryHelper.Narrow(_obj, True);
end;

class function TIQTestFactoryHelper.TypeCode : CORBA.TypeCode;
begin
  Result := ORB.CreateInterfaceTC(RepositoryId, 'IQTestFactory');
end;

class function TIQTestFactoryHelper.RepositoryId : string;
begin
  Result := 'IDL:IQTest/IQTestFactory:1.0';
end;

class function TIQTestFactoryHelper.Read(const _Input : CORBA.InputStream) : IQTest_i.IQTestFactory;
var
  _Obj : CORBA.CORBAObject;
begin
  _Input.ReadObject(_Obj);
  Result := Narrow(_Obj, True)
end;

class procedure TIQTestFactoryHelper.Write(const _Output : CORBA.OutputStream; const _Value : IQTest_i.IQTestFactory);
begin
  _Output.WriteObject(_Value as CORBA.CORBAObject);
end;

class function TIQTestFactoryHelper.Narrow(const _Obj : CORBA.CORBAObject; _IsA : Boolean) : IQTest_i.IQTestFactory;
begin
  Result := nil;
  if (_Obj = nil) or (_Obj.QueryInterface(IQTest_i.IQTestFactory, Result) = 0) then
    exit;
  if _IsA and _Obj._IsA(RepositoryId) then
    Result := TIQTestFactoryStub.Create(_Obj);
end;

class function TIQTestFactoryHelper.Bind(const _InstanceName : string = ''; _HostName: string = '') : IQTest_i.IQTestFactory;
begin
  Result := Narrow(ORB.bind(RepositoryId, _InstanceName, _HostName), True);
end;

class function TIQTestFactoryHelper.Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName : string = '') : IQTest_i.IQTestFactory;
begin
  Result := Narrow(ORB.bind(RepositoryId, _Options, _InstanceName, _HostName), True);
end;

function  TIQTestFactoryStub.CreateInstance ( const InstanceName : AnsiString): IQTest_i.IIQTest;
var
  _Output: CORBA.OutputStream;
  _Input : CORBA.InputStream;
begin
  inherited _CreateRequest('CreateInstance',True, _Output);
  _Output.WriteString(InstanceName);
  inherited _Invoke(_Output, _Input);
  Result := IQTest_c.TIIQTestHelper.Read(_Input);
end;


initialization


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -