The Network.hpp File
// Network.hpp: The header file for the network implementation
// class. While not a first-class citizen in this design (i.e., a key
// abstraction), it is a very important implementation class. This
// class is a basic wrapper for the physical network, whatever it
// happens to be (a pipe, sockets, a LAN, a WAN, a telephone, two
// soup cans). The data of the Network class can be filled in with the
// reader's favorite mechanism. The methods of the class clearly
// state where a send buffer or receive buffer needs to be placed.
// This code has a simulation so that both sides of the application
// can be tested.
#ifndef _NETWORK_
#define _NETWORK_
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
#include ''consts.hpp''
#define BANK_SIDE
class Transaction;
class Network {
// The user's favorite byte-transmission method goes here. See the
// implementation of the four methods to determine where the send
// and receives for this method need to go.
public:
#ifdef ATM_SIDE
int send(Transaction* t);
int receive(int& status, char* buf);
#endif
#ifdef BANK_SIDE
Transaction* receive();
void send(int status, Transaction* t);
#endif
};
#endif
|