Previous Section  < Free Open Study >  Next Section

The Bank Side of the Application

// 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'';



   Network* network = new Network;

   Bank* mybank = new Bank(100, argv[1]);

   ATMProxy* atm = new ATMProxy(mybank, network);


   delete mybank;

   delete atm;



    Previous Section  < Free Open Study >  Next Section