blob: c56a9ec5ee6c81c6ebbc619024210f02d0ea58bc (
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
|
//=============================================================================
/**
* @file Criteria_Evaluator.cpp
*
* $Id$
*
* An Evaluator for the CosLifeCycle Criteria
*
*
* @author Michael Kircher (mk1@cs.wustl.edu)
*/
//=============================================================================
#include "Criteria_Evaluator.h"
#include "ace/OS_NS_string.h"
Criteria_Evaluator::Criteria_Evaluator (const CosLifeCycle::Criteria &criteria)
: criteria_ (criteria)
{
}
Criteria_Evaluator::~Criteria_Evaluator ()
{
}
LifeCycleService::Criteria_Evaluator::SeqNamedValuePair *
Criteria_Evaluator::getInitialization (void)
{
LifeCycleService::Criteria_Evaluator::SeqNamedValuePair *sequence_ptr = 0;
CORBA::Any *any_ptr =
this->getCriteriaMember ("initialization");
if (any_ptr == 0)
throw LifeCycleService::Criteria_Evaluator::NotAvailable(
"No initialization member found.\n");
*any_ptr >>= sequence_ptr;
return sequence_ptr;
}
char *
Criteria_Evaluator::getFilter (void)
{
const char* string;
CORBA::Any value;
CORBA::Any_ptr any_ptr = this->getCriteriaMember ("filter");
if (any_ptr == 0)
throw LifeCycleService::Criteria_Evaluator::NotAvailable(
"No filter member found.\n");
*any_ptr >>= string;
return CORBA::string_dup (string);
}
CORBA::Any *
Criteria_Evaluator::getCriteriaMember (const char *member_name)
{
if (!ACE_OS::strcmp(member_name, "initialization")
&& !ACE_OS::strcmp(member_name, "filter")
&& !ACE_OS::strcmp(member_name, "logical location")
&& !ACE_OS::strcmp(member_name, "preferences"))
return 0;
for (u_int i = 0;
i < criteria_.length();
i++)
if (ACE_OS::strcmp (member_name,
criteria_[i].name) == 0)
{
CORBA::Any_ptr value_ptr;
// @@ We should use ACE_NEW_THROW_EX + ACE_CHECK_RETURN here.
ACE_NEW_RETURN (value_ptr,
CORBA::Any(criteria_[i].value),
0);
return value_ptr;
}
return 0;
}
|