home *** CD-ROM | disk | FTP | other *** search
- unit DrBob42_impl;
-
- {This file was generated on 29 Dec 2000 10:32:07 GMT by version 03.03.03.C1.06}
- {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 }
- {C:\DrBob42\Drbob42.idl. }
-
- {Delphi Pascal unit : DrBob42_impl }
- {derived from IDL module: DrBob42 }
-
- interface
- uses
- SysUtils,
- CORBA,
- DrBob42_i,
- DrBob42_c;
-
- type
- TRates = class;
- TAccount = class;
- TMyAccount = class;
- TADT = class;
- TSeqAccount = class;
-
- TRates = class(TInterfacedObject, DrBob42_i.Rates)
- protected
- finterest_rate: Single;
- public
- constructor Create;
- function interest_rate: Single;
- end;
-
- TAccount = class(TInterfacedObject, DrBob42_i.Account)
- protected
- fbalance: Single;
- public
- constructor Create;
- function balance: Single;
- function get_rates(const myRates: DrBob42_i.Rates): Single;
- end;
-
- TMyAccount = class(TInterfacedObject, DrBob42_i.MyAccount)
- protected
- fbalance: Single;
- public
- constructor Create;
- procedure deposit(const amount: Single);
- procedure withdraw(const amount: Single);
- function balance: Single;
- function get_rates(const myRates: DrBob42_i.Rates): Single;
- end;
-
- TADT = class(TInterfacedObject, DrBob42_i.ADT)
- protected
- {******************************}
- {*** User variables go here ***}
- {******************************}
- public
- constructor Create;
- procedure test(const one: DrBob42_i.Identifier;
- const two: DrBob42_i.EnumType;
- const three: DrBob42_i.StructType;
- const four: DrBob42_i.UnionType;
- const five: DrBob42_i.StructArray;
- const six: DrBob42_i.StructSequence);
- end;
-
- TSeqAccount = class(TInterfacedObject, DrBob42_i.SeqAccount)
- protected
- {******************************}
- {*** User variables go here ***}
- {******************************}
- public
- constructor Create;
- function balance(const mySeq: DrBob42_i.IntSeq): Single;
- end;
-
-
- implementation
- uses
- Dialogs;
-
- constructor TRates.Create;
- begin
- inherited;
- finterest_rate := 7;
- ShowMessage('TRates.Create');
- end;
-
- function TRates.interest_rate: Single;
- begin
- Result := finterest_rate;
- end;
-
- constructor TAccount.Create;
- begin
- inherited;
- fbalance := 42;
- ShowMessage('TAccount.Create');
- end;
-
- function TAccount.balance: Single;
- begin
- Result := fbalance;
- end;
-
- function TAccount.get_rates(const myRates: DrBob42_i.Rates): Single;
- begin
- Result := myRates.interest_rate
- end;
-
- constructor TMyAccount.Create;
- begin
- inherited;
- fbalance := 0;
- ShowMessage('TMyAccount.Create');
- end;
-
- procedure TMyAccount.deposit(const amount: Single);
- begin
- fbalance := fbalance + amount;
- end;
-
- procedure TMyAccount.withdraw(const amount: Single);
- var
- Error: TAccountError;
- begin
- if amount <= 0 then
- begin
- writeln('Cannot withdraw negative amount ',amount:1:2);
- Error := TAccountError.Create(amount,'Cannot withdraw negative amount %f');
- raise EAccountException.Create(Error);
- end
- else
- if fbalance <= 0 then
- begin
- writeln('Balance zero or negative: ',fbalance:1:2);
- Error := TAccountError.Create(fbalance,'Balance zero or negative: %f');
- raise EAccountException.Create(Error);
- end
- else
- if amount > fbalance then
- begin
- writeln('Balance not enough: ',fbalance:1:2);
- Error := TAccountError.Create(fbalance,'Balance not enough: %f');
- raise EAccountException.Create(Error);
- end
- else
- fbalance := fbalance - amount;
- end;
-
- function TMyAccount.balance: Single;
- begin
- Result := fbalance;
- end;
-
- function TMyAccount.get_rates(const myRates: DrBob42_i.Rates): Single;
- begin
- Result := myRates.interest_rate
- end;
-
- constructor TADT.Create;
- begin
- inherited;
- { *************************** }
- { *** User code goes here *** }
- { *************************** }
- end;
-
- procedure TADT.test(const one: DrBob42_i.Identifier;
- const two: DrBob42_i.EnumType;
- const three: DrBob42_i.StructType;
- const four: DrBob42_i.UnionType;
- const five: DrBob42_i.StructArray;
- const six: DrBob42_i.StructSequence);
- begin
- { *************************** }
- { *** User code goes here *** }
- { *************************** }
- end;
-
- constructor TSeqAccount.Create;
- begin
- inherited;
- { *************************** }
- { *** User code goes here *** }
- { *************************** }
- end;
-
- function TSeqAccount.balance(const mySeq: DrBob42_i.IntSeq): Single;
- begin
- Result := 0;
- { *************************** }
- { *** User code goes here *** }
- { *************************** }
- end;
-
-
- initialization
-
-
- end.