summaryrefslogtreecommitdiff
path: root/TAO/examples
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-18 03:11:08 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-18 03:11:08 +0000
commite320e2458157a9fb5b9827c9cbfb7efefe4f8f17 (patch)
tree2f913e9ac10fc45981aefe8ff823e5bb3a8e9b64 /TAO/examples
parent4e0db70e1c183c22ab48f8c41ef152915511c43c (diff)
downloadATCD-e320e2458157a9fb5b9827c9cbfb7efefe4f8f17.tar.gz
.
Diffstat (limited to 'TAO/examples')
-rw-r--r--TAO/examples/Simple/bank/AccountManager_i.cpp69
-rw-r--r--TAO/examples/Simple/bank/AccountManager_i.h9
-rw-r--r--TAO/examples/Simple/bank/Account_i.cpp6
-rw-r--r--TAO/examples/Simple/bank/Account_i.h17
4 files changed, 59 insertions, 42 deletions
diff --git a/TAO/examples/Simple/bank/AccountManager_i.cpp b/TAO/examples/Simple/bank/AccountManager_i.cpp
index fae106e9322..fdd8df7b895 100644
--- a/TAO/examples/Simple/bank/AccountManager_i.cpp
+++ b/TAO/examples/Simple/bank/AccountManager_i.cpp
@@ -45,48 +45,47 @@ Bank::Account_ptr
AccountManager_i::open (const char *name,
CORBA::Float initial_balance,
CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
Account_i *result = 0;
// If name is already in the map, <find> will assign <result> to the
// appropriate value.
-
- if (hash_map_.find (name, result) != 0)
+ if (hash_map_.find (name, result) != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "[SERVER] Process/Thread Id : (%P/%t) Opening Account (%s,%8.2f)\n",
+ name,
+ initial_balance));
+
+ ACE_NEW_THROW_EX (result,
+ Account_i (name,
+ initial_balance),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (Bank::Account::_nil ());
+
+ // Enter the new Account in the hash map. If the <bind> fails
+ // throw an UNKNOWN exception. <result> may be valid but since
+ // it is not properly bound, it's behaviour may be off, so
+ // delete it to be safe.
+
+ if (hash_map_.bind (name, result) == -1)
{
- ACE_DEBUG ((LM_DEBUG,
- "[SERVER] Process/Thread Id : (%P/%t) Opening Account (%s,%8.2f)\n",
- name,
- initial_balance));
-
- ACE_NEW_THROW_EX (result,
- Account_i (name,
- initial_balance),
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (Bank::Account::_nil ());
-
- // Enter the new Account in the hash map. If the <bind>
- // fails throw an UNKNOWN exception. <result> may be valid
- // but since it is not properly bound, it's behaviour may be
- // off, so delete it to be safe.
-
- if (hash_map_.bind (name, result) == -1)
- {
- delete result;
- TAO_THROW_RETURN (CORBA::UNKNOWN (),
- Bank::Account::_nil ());
- }
+ delete result;
+ TAO_THROW_RETURN (CORBA::UNKNOWN (),
+ Bank::Account::_nil ());
}
- else
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "[SERVER] Process/Thread Id : (%P/%t) Account already exists for %s\n",
- name));
- // Generate an IOR for the result object and register it with
- // the POA. In case the object already exists then the
- // previously generated IOR is returned.
-
- return result->_this ();
+ }
+ else if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "[SERVER] Process/Thread Id : (%P/%t) Account already exists for %s\n",
+ name));
+ // Generate an IOR for the result object and register it with the
+ // POA. In case the object already exists then the previously
+ // generated IOR is returned.
+
+ return result->_this ();
}
// Shutdown.
@@ -94,6 +93,7 @@ AccountManager_i::open (const char *name,
void
AccountManager_i::close (Bank::Account_ptr account,
CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_TRY
{
@@ -123,6 +123,7 @@ AccountManager_i::close (Bank::Account_ptr account,
void
AccountManager_i::shutdown (CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_DEBUG ((LM_DEBUG,
"\n[SERVER] Process/Thread Id : (%P/%t) %s\n",
diff --git a/TAO/examples/Simple/bank/AccountManager_i.h b/TAO/examples/Simple/bank/AccountManager_i.h
index c7333b19c5b..b1cfb0d7fcf 100644
--- a/TAO/examples/Simple/bank/AccountManager_i.h
+++ b/TAO/examples/Simple/bank/AccountManager_i.h
@@ -50,15 +50,18 @@ public:
virtual Bank::Account_ptr open (const char *name,
CORBA::Float initial_balance,
- CORBA::Environment &_env);
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
// Return the Account interface with the given name from the server.
// Put the initial balance specified in the new account.
virtual void close (Bank::Account_ptr,
- CORBA::Environment &env);
+ CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
// Close the given account.
- virtual void shutdown (CORBA::Environment &env);
+ virtual void shutdown (CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
// Shutdown the server.
void orb (CORBA::ORB_ptr o);
diff --git a/TAO/examples/Simple/bank/Account_i.cpp b/TAO/examples/Simple/bank/Account_i.cpp
index d8360e59393..4b944aea6aa 100644
--- a/TAO/examples/Simple/bank/Account_i.cpp
+++ b/TAO/examples/Simple/bank/Account_i.cpp
@@ -38,6 +38,7 @@ Account_i::orb (CORBA::ORB_ptr o)
CORBA::Float
Account_i::balance (CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
return balance_;
}
@@ -45,6 +46,7 @@ Account_i::balance (CORBA::Environment &)
void
Account_i::deposit (CORBA::Float deposit,
CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
balance_ += deposit;
}
@@ -52,6 +54,8 @@ Account_i::deposit (CORBA::Float deposit,
void
Account_i::withdraw (CORBA::Float withdrawl,
CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Bank::Account::Overdraft))
{
if (balance_ >= withdrawl)
balance_ -= withdrawl;
@@ -61,6 +65,7 @@ Account_i::withdraw (CORBA::Float withdrawl,
char *
Account_i::name (CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
return CORBA::string_dup (name_);
}
@@ -68,6 +73,7 @@ Account_i::name (CORBA::Environment &)
void
Account_i::name (const char *name,
CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
name_ = CORBA::string_dup (name);
}
diff --git a/TAO/examples/Simple/bank/Account_i.h b/TAO/examples/Simple/bank/Account_i.h
index 969d3cad1e2..915b7312d45 100644
--- a/TAO/examples/Simple/bank/Account_i.h
+++ b/TAO/examples/Simple/bank/Account_i.h
@@ -42,22 +42,29 @@ public:
~Account_i (void);
// Destructor.
- virtual CORBA::Float balance (CORBA::Environment &env);
+ virtual CORBA::Float balance (CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
// Get the current balance in the account.
- virtual char *name (CORBA::Environment &env);
+ virtual char *name (CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
// Get the name of the <Account> holder.
virtual void name (const char *name,
- CORBA::Environment &env);
+ CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
// Set the name of the <Account> holder.
virtual void deposit (CORBA::Float,
- CORBA::Environment &env);
+ CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
// Deposit money in the account.
virtual void withdraw (CORBA::Float,
- CORBA::Environment &env);
+ CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Bank::Account::Overdraft));
// Withdraw money in the account.
void orb (CORBA::ORB_ptr o);