blob: 796712d4f5f575cb2bee9d75cc84f20f21642962 (
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
|
// $Id$
// ============================================================================
//
// = FILENAME
// Criteria_Evaluator.cpp
//
// = DESCRIPTION
// An Evaluator for the CosLifeCycle Criteria
//
// = AUTHOR
// Michael Kircher (mk1@cs.wustl.edu)
//
// ============================================================================
#include "Criteria_Evaluator.h"
ACE_RCSID(LifeCycle_Service, Criteria_Evaluator, "$Id$")
Criteria_Evaluator::Criteria_Evaluator (const CosLifeCycle::Criteria &criteria)
: criteria_ (criteria)
{
}
Criteria_Evaluator::~Criteria_Evaluator ()
{
}
LifeCycleService::Criteria_Evaluator::SeqNamedValuePair *
Criteria_Evaluator::getInitialization (ACE_ENV_SINGLE_ARG_DECL)
{
LifeCycleService::Criteria_Evaluator::SeqNamedValuePair *sequence_ptr = 0;
CORBA::Any *any_ptr =
this->getCriteriaMember ("initialization");
if (any_ptr == 0)
ACE_THROW_RETURN (LifeCycleService::Criteria_Evaluator::NotAvailable
("No initialization member found.\n"),
0);
*any_ptr >>= sequence_ptr;
return sequence_ptr;
}
char *
Criteria_Evaluator::getFilter (ACE_ENV_SINGLE_ARG_DECL)
{
const char* string;
CORBA::Any value;
CORBA::Any_ptr any_ptr = this->getCriteriaMember ("filter");
if (any_ptr == 0)
ACE_THROW_RETURN (LifeCycleService::Criteria_Evaluator::NotAvailable
("No filter member found.\n"),
0);
*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;
}
|