blob: 5fd8a1b32ffd70728e9a85016300b25ecc2ab254 (
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
|
// $Id$
#include "OR_Handler.h"
#include "TP_Handler.h"
#include "TPL_Handler.h"
#include "CB_Handler.h"
#include "CIAOServerResources.hpp"
#include "ciao/ServerResourcesC.h"
namespace CIAO
{
namespace Config_Handlers
{
bool OR_Handler::orb_resources (const ORBResources &src,
::CIAO::DAnCE::ORBResources &dest)
{
// We know that there should be only one.
dest.length (1);
// Set the length of the threadpools
CORBA::ULong pos (dest[0].threadpool_list.length ());
dest[0].threadpool_list.length (pos + src.count_threadpool ());
for (ORBResources::threadpool_const_iterator i = src.begin_threadpool ();
i != src.end_threadpool ();
++i)
{
TP_Handler::thread_pool (*i,
dest[0].threadpool_list[pos++]);
}
pos = dest[0].threadpool_with_lanes_list.length ();
dest[0].threadpool_with_lanes_list.length (pos + src.count_threadpoolWithLanes ());
for (ORBResources::threadpoolWithLanes_const_iterator j = src.begin_threadpoolWithLanes();
j != src.end_threadpoolWithLanes();
j++)
{
TPL_Handler::threadpool_with_lanes (*j,
dest[0].threadpool_with_lanes_list [pos++]);
}
pos = dest[0].connection_bands_list.length ();
dest[0].connection_bands_list.length (pos + src.count_connectionBands ());
for (ORBResources::connectionBands_const_iterator k = src.begin_connectionBands();
k != src.end_connectionBands();
k++)
{
CB_Handler::connection_band (*k,
dest[0].connection_bands_list[pos++]);
}
return true;
}
ORBResources OR_Handler::orb_resources (const ::CIAO::DAnCE::ORBResources &src)
throw (OR_Handler::No_Resource)
{
if (src.length () == 0 ||
src[0].threadpool_list.length () == 0 ||
src[0].threadpool_with_lanes_list.length () == 0 ||
src[0].connection_bands_list.length () == 0)
{
throw No_Resource ();
}
size_t len; //For checking the length of sequences
ORBResources ores;
len = src[0].threadpool_list.length();
for(size_t i = 0; i < len; ++i)
{
ores.add_threadpool (TP_Handler::thread_pool (src[0].threadpool_list[i]));
}
len = src[0].threadpool_with_lanes_list.length();
for(size_t j = 0; j < len; ++j)
{
ores.add_threadpoolWithLanes(TPL_Handler::threadpool_with_lanes (src[0].threadpool_with_lanes_list[j]));
}
len = src[0].connection_bands_list.length();
for(size_t k = 0; k < len; k++)
{
ores.add_connectionBands (CB_Handler::connection_band (src[0].connection_bands_list[k]));
}
return ores;
}
}
}
|