File: README

package info (click to toggle)
gnat-glade 3.14p-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,588 kB
  • ctags: 1,976
  • sloc: ada: 70,532; ansic: 5,258; sh: 2,321; makefile: 538
file content (132 lines) | stat: -rw-r--r-- 1,940 bytes parent folder | download | duplicates (7)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
This example describes a way to develop client / server
applications. To provide advanced features, in this example, we had a
mechanism of notification.

There are three main ada units in this bank example. The "bank" that
manages the client accounts, a "manager" which loads the accounts from
a small database and provides some utilities and clients which modify
their accounts and transfer money from their account to the account of
someone else. This is always the same executable for the different
clients, but of course, they don't get the same partition id in order
to differentiate them.

To proove this, the bank server notifies a customer when its account
has been granted with money by another customer.

--

To play with this example, you can do the following :

% gnatdist simcity

Open (at least) 3 sessions.

[On session 1, starts the scenario, load "example" database and print
the account status]

% bank_server

Menu :

   Create
   Load
   Print
   Quit
   Save

Request : l

=> Load
Filename : example

Menu :

   Create
   Load
   Print
   Quit
   Save

Request : p

=> Print

   Customer : poor
   Password : xxxx
   Customer :  25

   Customer : middle
   Password : yyyy
   Customer :  250

   Customer : rich
   Password : zzzz
   Customer :  2500


Menu :

   Create
   Load
   Print
   Quit
   Save

[On session 2, start the poor client]

% bank_client
Customer : poor
Password : xxxx

Balance : 25

Menu :

   Balance
   Deposit
   Transfer
   Withdraw

Request : 

[On session 3, start the rich client and transfer money from rich to poor]

% bank_client
Customer : rich
Password : zzzz

Balance : 2500

Menu :

   Balance
   Deposit
   Transfer
   Withdraw

Request : t

=> Transfer

   Amount : 1000
   Customer : poor

Balance : 1500

Menu :

   Balance
   Deposit
   Transfer
   Withdraw

[and then you will realize that on session 2, poor has been notified
of the donation]

=> Receive 1000 from rich