account_i.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 80 行
CPP
80 行
// Account_i.cpp,v 1.9 2002/01/29 20:20:41 okellogg Exp
#include "Account_i.h"
ACE_RCSID(Bank, Account_i, "Account_i.cpp,v 1.9 2002/01/29 20:20:41 okellogg Exp")
// Constructor
Account_i::Account_i (void)
{
// no-op
}
Account_i::Account_i (const char *name,
CORBA::Float balance)
: balance_ (balance),
name_ (CORBA::string_dup (name))
{
}
// Destructor
Account_i::~Account_i (void)
{
CORBA::string_free (name_);
}
// Set the ORB pointer.
void
Account_i::orb (CORBA::ORB_ptr o)
{
this->orb_ = CORBA::ORB::_duplicate (o);
}
// Return the current balance on the server.
CORBA::Float
Account_i::balance (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return balance_;
}
void
Account_i::deposit (CORBA::Float deposit
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
balance_ += deposit;
}
void
Account_i::withdraw (CORBA::Float withdrawl
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
Bank::Account::Overdraft))
{
if (balance_ >= withdrawl)
balance_ -= withdrawl;
else
ACE_THROW (Bank::Account::Overdraft ("Exception::Overdraft\n"));
}
char *
Account_i::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return CORBA::string_dup (this->name_.in ());
}
void
Account_i::name (const char *name
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
this->name_ = CORBA::string_dup (name);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?