blob: 847a5f7c977cf23ad364fb2008acd3421b362c10 (
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#include "DAM_Map.h"
#include "ciao/CIAO_Config.h"
#include "ciao/CIAO_common.h"
ACE_RCSID (ExecutionManager,
DAM_Map,
"$Id$")
namespace CIAO
{
namespace Execution_Manager
{
DAM_Map::DAM_Map (void)
: map_ (CIAO_DEFAULT_MAP_SIZE)
{
}
size_t
DAM_Map::size (void)
{
return this->map_.current_size ();
}
bool
DAM_Map::is_plan_available (const ACE_CString &str)
{
CIAO_TRACE("Execution_Manager::DAM_Map::is_plan_available");
if (this->map_.find (str) == 0)
return true;
return false;
}
::Deployment::DomainApplicationManager_ptr
DAM_Map::fetch_dam_reference (const ACE_CString &str)
{
CIAO_TRACE("Execution_Manager::DAM_Map::fetch_dam_reference");
if (!this->is_plan_available (str))
return ::Deployment::DomainApplicationManager::_nil ();
::Deployment::DomainApplicationManager_var tmp;
/// There should be duplicate when assigning a _var to an _var.
int const retval = this->map_.find (str,
tmp);
if (CIAO::debug_level () > 9)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) CIAO_ExecutionManager: fetch_dam_reference, "
"result from find is [%d] \n",
retval));
}
return tmp._retn ();
}
bool
DAM_Map::bind_dam_reference (
const ACE_CString &str,
::Deployment::DomainApplicationManager_ptr dam)
{
CIAO_TRACE("Execution_Manager::DAM_Map::bind_dam_reference");
int const retval =
this->map_.rebind (str,
dam);
if (retval != 0)
return false;
return true;
}
Deployment::DomainApplicationManagers *
DAM_Map::get_dams (void)
{
CIAO_TRACE("Execution_Manager::DAM_Map::get_dams");
CORBA::ULong const sz =
this->map_.current_size ();
// Initialize the list of DomainApplication Managers
Deployment::DomainApplicationManagers_var list;
ACE_NEW_THROW_EX (list,
Deployment::DomainApplicationManagers (sz),
CORBA::NO_MEMORY());
// Add the manager to the list
list->length (sz);
Iterator end =
this->map_.end ();
CORBA::ULong i = 0;
for (Iterator b =
this->map_.begin (); b != end; ++b)
{
list [i] =
Deployment::DomainApplicationManager::_duplicate ((*b).int_id_.in ());
++i;
}
return list._retn ();
}
bool
DAM_Map::unbind_dam (const ACE_CString &str)
{
CIAO_TRACE("Execution_Manager::DAM_Map::unbind_dam");
int const retval =
this->map_.unbind (str);
if (retval != 0)
return false;
return true;
}
}
}
|