Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / examples / Simple / bank / Account_i.cpp
blob5b2fb3a79546401dc70851accd88895676c2f648
1 #include "Account_i.h"
3 // Constructor
4 Account_i::Account_i ()
8 Account_i::Account_i (const char *name,
9 CORBA::Float balance)
10 : balance_ (balance),
11 name_ (CORBA::string_dup (name))
15 // Destructor
16 Account_i::~Account_i ()
20 // Set the ORB pointer.
21 void
22 Account_i::orb (CORBA::ORB_ptr o)
24 this->orb_ = CORBA::ORB::_duplicate (o);
27 // Return the current balance on the server.
28 CORBA::Float
29 Account_i::balance ()
31 return balance_;
34 void
35 Account_i::deposit (CORBA::Float deposit)
37 balance_ += deposit;
40 void
41 Account_i::withdraw (CORBA::Float withdrawl)
43 if (balance_ >= withdrawl)
44 balance_ -= withdrawl;
45 else
46 throw Bank::Account::Overdraft ("Exception::Overdraft\n");
49 char *
50 Account_i::name ()
52 return CORBA::string_dup (this->name_.in ());
55 void
56 Account_i::name (const char *name)
58 this->name_ = CORBA::string_dup (name);