Interpreter_Utils_T.cpp

Go to the documentation of this file.
00001 // Interpreter_Utils_T.cpp,v 1.9 2005/11/16 07:53:25 ossama Exp
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   ACE_DECLARE_NEW_CORBA_ENV;
00020   ACE_TRY
00021     {
00022       dyn_seq.init (sequence ACE_ENV_ARG_PARAMETER);
00023       ACE_TRY_CHECK;
00024 
00025       CORBA::ULong length =
00026         dyn_seq.get_length ( ACE_ENV_SINGLE_ARG_PARAMETER );
00027       ACE_TRY_CHECK;
00028           
00029       dyn_seq.rewind( ACE_ENV_SINGLE_ARG_PARAMETER );
00030       ACE_TRY_CHECK;
00031 
00032       for (CORBA::ULong i = 0 ; i < length && ! return_value; i++)
00033         {
00034           if (functor (dyn_seq, element))
00035             return_value = 1;
00036                 
00037           dyn_seq.next( ACE_ENV_SINGLE_ARG_PARAMETER );
00038           ACE_TRY_CHECK;
00039         }
00040     }
00041   ACE_CATCHANY
00042     {
00043       return 0;
00044     }
00045   ACE_ENDTRY;
00046 
00047   return return_value;
00048 }
00049 
00050 TAO_END_VERSIONED_NAMESPACE_DECL
00051 
00052 #endif /* TAO_INTERPRETER_UTILS_CPP */

Generated on Thu Nov 9 13:59:57 2006 for TAO_CosTrader by doxygen 1.3.6