Distributed Systems Architecture: A Middleware Approach

Appendix D: Sample Application

Following are the complete source texts for the CORBA application presented in Chapter 3. The line numbers correspond to the extracts shown in Chapters 2 and 3. The design for the application and the UML class diagram can be found in Chapter 2.

D.1 Stand Alone Application in C++

The stand alone implementation is explained in Section 2.4.2 on page page 28.

1:   // File: account.cc 2: 3:   #include  4: 5: 6:   using namespace std; 7: 8:   // Implementation for interface Account 9:   class Account_impl 10:  { 11:  private: 12:    int _balance; 13: 14:  public: 15:    Account_impl () 16:    { 17:     _balance = 0;18:    } 19: 20:    void deposit (int amount) 21:    { 22:      cout << "Server: deposit " << amount << endl; 23:      _balance += amount; 24:    } 25: 26:    void withdraw (int amount) 27:    { 28:      cout << "Server: withdraw " << amount << endl; 29:      if (_balance >= amount) 30:        _balance -= amount; 31:      else 32:        cout << "Server: withdraw failed" << endl; 33:...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Bus Extenders
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.