blob: 36492ff66eb92234e2587029479627aa18bf6845 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// -*- C++ -*-
// $Id$
module Bank
{
// = TITLE
// This module has two interfaces. One represents a bank Account and
// the other is a factory to create the Account Objects.
interface Account
{
// = TITLE
// This interface represents an account with operations to check
// balance, deposit and withdraw.
exception Overdraft
{
// = TITLE
// This exception is raised if the client tries to
// withdraw more money than the current balance.
string reason;
};
readonly attribute float balance;
// Attribute to obtain the current <balance>.
void deposit (in float amount);
// Add <amount> to this account.
void withdraw (in float amount) raises (Overdraft);
//void withdraw (in float amount);
// Withdraw <amount> from this account.
attribute string name;
// The <name> of this account.
};
interface AccountManager
{
// = TITLE
// This interface is a factory for the <Account> objects. It has
// operations to create <Account>s and to delete them.
Account open (in string name,
in float initial_balance);
// Returns the <Account> associated with <name>. If this is the
// first time <name> has been seen, the server will create the
// account. Otherwise, the server will return back an object
// reference to a previously created account.
void close (in Account account);
// Close down the account and release its resources if it's the
// last reference to the <account>. Once this call is made it
// is no longer valid to access the <account>.
void shutdown ();
// This operation shuts down the server.
};
};
|