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"
17 Criteria_Evaluator::Criteria_Evaluator (const CosLifeCycle::Criteria
&criteria
)
18 : criteria_ (criteria
)
22 Criteria_Evaluator::~Criteria_Evaluator ()
26 const LifeCycleService::Criteria_Evaluator::SeqNamedValuePair
*
27 Criteria_Evaluator::getInitialization ()
29 const LifeCycleService::Criteria_Evaluator::SeqNamedValuePair
*sequence_ptr
= 0;
31 CORBA::Any_ptr any_ptr
=
32 this->getCriteriaMember ("initialization");
35 throw LifeCycleService::Criteria_Evaluator::NotAvailable(
36 "No initialization member found.\n");
38 *any_ptr
>>= sequence_ptr
;
44 Criteria_Evaluator::getFilter ()
48 CORBA::Any_ptr any_ptr
= this->getCriteriaMember ("filter");
51 throw LifeCycleService::Criteria_Evaluator::NotAvailable(
52 "No filter member found.\n");
54 return CORBA::string_dup (string
);
58 Criteria_Evaluator::getCriteriaMember (const char *member_name
)
60 if (!ACE_OS::strcmp(member_name
, "initialization")
61 && !ACE_OS::strcmp(member_name
, "filter")
62 && !ACE_OS::strcmp(member_name
, "logical location")
63 && !ACE_OS::strcmp(member_name
, "preferences"))
67 i
< criteria_
.length();
69 if (ACE_OS::strcmp (member_name
,
70 criteria_
[i
].name
) == 0)
72 CORBA::Any_ptr value_ptr
;
74 // @@ We should use ACE_NEW_THROW_EX + ACE_CHECK_RETURN here.
75 ACE_NEW_RETURN (value_ptr
,
76 CORBA::Any(criteria_
[i
].value
),