blob: 487aa3d7c3539c9ca3af43a47620b908c700b2d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// -*- C++ -*-
//=============================================================================
/**
* @file AccountManager_i.h
*
* This class implements the Bank::AccountManager IDL interface.
*
*
* @author Vishal Kachroo <vishal@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACCOUNTMANAGER_I_H
#define ACCOUNTMANAGER_I_H
#include "BankS.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "Account_i.h"
#include "ace/Hash_Map_Manager.h"
#include "ace/ACE.h"
#include "ace/SString.h"
#include "ace/Null_Mutex.h"
#include "tao/Intrusive_Ref_Count_Handle_T.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
class TAO_ORB_Manager;
TAO_END_VERSIONED_NAMESPACE_DECL
/**
* @class AccountManager_i
*
* @brief Account Manager object implementation.
*
* Implementation of a simple object that has two methods, one
* that returns an Account Interface and the other that shuts
* down the server.
*/
class AccountManager_i : public POA_Bank::AccountManager
{
public:
// = Initialization and termination methods.
/// Constructor.
AccountManager_i (void);
/// Destructor.
virtual ~AccountManager_i (void);
/// Return the Account interface with the given name from the server.
/// Put the initial balance specified in the new account.
virtual Bank::Account_ptr open (const char *name,
CORBA::Float initial_balance);
/// Close the given account.
virtual void close (Bank::Account_ptr);
/// Shutdown the server.
virtual void shutdown (void);
/// Set the ORB pointer.
void orb (CORBA::ORB_ptr o);
/// Set the POA pointer.
void poa (PortableServer::POA_ptr poa);
/// Set the ORB Manager.
void set_orb_manager (TAO_ORB_Manager *orb_manager);
/// The ORB manager.
TAO_ORB_Manager *orb_manager_;
private:
/// ORB pointer.
CORBA::ORB_var orb_;
/// POA pointer.
PortableServer::POA_var poa_;
typedef TAO_Intrusive_Ref_Count_Handle<Account_i> Account_i_var;
typedef ACE_Hash_Map_Manager<ACE_CString,
Account_i_var,
ACE_Null_Mutex> MAP_MANAGER_TYPE;
/**
* Calls to <open> will create a new instance of <Account_i> and
* bind into the hash map manager if <name> is unique, else it will
* return a previously bound entry.
*/
MAP_MANAGER_TYPE hash_map_;
void operator= (const AccountManager_i &);
};
#endif /* ACCOUNTMANAGER_I_H */
|