< Free Open Study > |
// Bankmain.cpp: The main driver function for the Bank side of the // application. This main method builds a network, creates a bank, // initializing its accounts to the data in a user-provided file, // and builds an ATM proxy, which is then activated. The ATM proxy // will listen on the network for a data packet. When it arrives, // this packet is parsed to build an appropriate transaction. The // Bank is then asked to process the transaction, and the results // are shipped back to the sender. In this simulation, the network // is really a user typing in packets with the appropriate format. // The reader can replace these calls to getline with any // appropriate byte-transfer mechanism. #include <iostream.h> #include ''bank.hpp'' #include ''trans.hpp'' main(int argc, char** argv) { if (argc != 2) { cout << ''Usage: '' << argv[0] << '' AccountsFile\n''; return(1); } Network* network = new Network; Bank* mybank = new Bank(100, argv[1]); ATMProxy* atm = new ATMProxy(mybank, network); atm->activate(); delete mybank; delete atm; return(0); } |
< Free Open Study > |