Interpreter_Utils_T.cpp

Go to the documentation of this file.
00001 // $Id: Interpreter_Utils_T.cpp 76626 2007-01-26 13:50:03Z elliott_c $
00002 
00003 #ifndef TAO_INTERPRETER_UTILS_CPP
00004 #define TAO_INTERPRETER_UTILS_CPP
00005 
00006 #include "orbsvcs/Trader/Interpreter_Utils_T.h"
00007 #include "orbsvcs/Trader/Constraint_Visitors.h"
00008 #include "tao/DynamicAny/DynSequence_i.h"
00009 
00010 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00011 
00012 template <class OPERAND_TYPE> CORBA::Boolean
00013 TAO_find (const CORBA::Any& sequence, const OPERAND_TYPE& element)
00014 {
00015   CORBA::Boolean return_value = 0;
00016   TAO_Element_Equal<OPERAND_TYPE> functor;
00017   TAO_DynSequence_i dyn_seq;
00018 
00019   try
00020     {
00021       dyn_seq.init (sequence);
00022 
00023       CORBA::ULong length =
00024         dyn_seq.get_length ( );
00025 
00026       dyn_seq.rewind( );
00027 
00028       for (CORBA::ULong i = 0 ; i < length && ! return_value; i++)
00029         {
00030           if (functor (dyn_seq, element))
00031             return_value = 1;
00032 
00033           dyn_seq.next( );
00034         }
00035     }
00036   catch (const CORBA::Exception&)
00037     {
00038       return 0;
00039     }
00040 
00041   return return_value;
00042 }
00043 
00044 TAO_END_VERSIONED_NAMESPACE_DECL
00045 
00046 #endif /* TAO_INTERPRETER_UTILS_CPP */

Generated on Tue Feb 2 17:49:26 2010 for TAO_CosTrader by  doxygen 1.4.7