2 //=============================================================================
4 * @file Criteria_Evaluator.cpp
6 * An Evaluator for the CosLifeCycle Criteria
8 * @author Michael Kircher (mk1@cs.wustl.edu)
10 //=============================================================================
13 #include "Criteria_Evaluator.h"
14 #include "ace/OS_NS_string.h"
18 Criteria_Evaluator::Criteria_Evaluator (const CosLifeCycle::Criteria
&criteria
)
19 : criteria_ (criteria
)
23 Criteria_Evaluator::~Criteria_Evaluator ()
27 const LifeCycleService::Criteria_Evaluator::SeqNamedValuePair
*
28 Criteria_Evaluator::getInitialization (void)
30 const LifeCycleService::Criteria_Evaluator::SeqNamedValuePair
*sequence_ptr
= 0;
32 CORBA::Any_ptr any_ptr
=
33 this->getCriteriaMember ("initialization");
36 throw LifeCycleService::Criteria_Evaluator::NotAvailable(
37 "No initialization member found.\n");
39 *any_ptr
>>= sequence_ptr
;
45 Criteria_Evaluator::getFilter (void)
49 CORBA::Any_ptr any_ptr
= this->getCriteriaMember ("filter");
52 throw LifeCycleService::Criteria_Evaluator::NotAvailable(
53 "No filter member found.\n");
55 return CORBA::string_dup (string
);
59 Criteria_Evaluator::getCriteriaMember (const char *member_name
)
61 if (!ACE_OS::strcmp(member_name
, "initialization")
62 && !ACE_OS::strcmp(member_name
, "filter")
63 && !ACE_OS::strcmp(member_name
, "logical location")
64 && !ACE_OS::strcmp(member_name
, "preferences"))
68 i
< criteria_
.length();
70 if (ACE_OS::strcmp (member_name
,
71 criteria_
[i
].name
) == 0)
73 CORBA::Any_ptr value_ptr
;
75 // @@ We should use ACE_NEW_THROW_EX + ACE_CHECK_RETURN here.
76 ACE_NEW_RETURN (value_ptr
,
77 CORBA::Any(criteria_
[i
].value
),