blob: 37666fbba22f69ea56c1edefc7b9723df599f7b6 (
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
|
// $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 (CORBA::Environment &env)
{
LifeCycleService::Criteria_Evaluator::SeqNamedValuePair_ptr sequence_ptr = 0;
CORBA::Any * any_ptr = this->getCriteriaMember ("initialization");
if (any_ptr == 0)
{
env.exception (new LifeCycleService::Criteria_Evaluator::NotAvailable ("No initialization member found.\n"));
return 0;
}
*any_ptr >>= sequence_ptr;
return sequence_ptr;
}
char *
Criteria_Evaluator::getFilter (CORBA::Environment &env)
{
CORBA::String string;
CORBA::Any value;
CORBA::Any_ptr any_ptr = this->getCriteriaMember ("filter");
if (any_ptr == 0)
{
env.exception (new LifeCycleService::Criteria_Evaluator::NotAvailable ("No filter member found.\n"));
return 0;
}
*any_ptr >>= string;
return string;
}
CORBA::Any *
Criteria_Evaluator::getCriteriaMember (const CORBA::String 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 (unsigned int i = 0; i < criteria_.length(); i++)
{
if (ACE_OS::strcmp (member_name, criteria_[i].name) == 0)
{
CORBA::Any_ptr value_ptr;
ACE_NEW_RETURN (value_ptr,
CORBA::Any(criteria_[i].value),
0);
return value_ptr;
}
}
return 0;
}
|