summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.cpp
blob: 8fd86f25d983d87ca4e801cd495896c6dc3ff590 (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
// $Id$

#ifndef TAO_INTERPRETER_UTILS_CPP
#define TAO_INTERPRETER_UTILS_CPP

#include "orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.h"
#include "orbsvcs/orbsvcs/Trader/Constraint_Visitors.h"

template <class OPERAND_TYPE> CORBA::Boolean
TAO_find (const CORBA::Any& sequence, const OPERAND_TYPE& element)
{
  CORBA::Boolean return_value = 0;
  TAO_Element_Equal<OPERAND_TYPE> functor;
  TAO_DynSequence_i dyn_seq (sequence);

  CORBA::ULong length = dyn_seq.length ();

  for (CORBA::ULong i = 0; i < length && ! return_value; i++)
    if (functor (dyn_seq, element))
      return_value = 1;

  return return_value;
}

#endif /* TAO_INTERPRETER_UTILS_CPP */