summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.cpp b/TAO/orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.cpp
new file mode 100644
index 00000000000..6e7c39acff6
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Trader/Interpreter_Utils_T.cpp
@@ -0,0 +1,46 @@
+// $Id$
+
+#ifndef TAO_INTERPRETER_UTILS_CPP
+#define TAO_INTERPRETER_UTILS_CPP
+
+#include "orbsvcs/Trader/Interpreter_Utils_T.h"
+#include "orbsvcs/Trader/Constraint_Visitors.h"
+#include "tao/DynamicAny/DynSequence_i.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+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;
+
+ try
+ {
+ dyn_seq.init (sequence);
+
+ CORBA::ULong length =
+ dyn_seq.get_length ( );
+
+ dyn_seq.rewind( );
+
+ for (CORBA::ULong i = 0 ; i < length && ! return_value; i++)
+ {
+ if (functor (dyn_seq, element))
+ return_value = 1;
+
+ dyn_seq.next( );
+ }
+ }
+ catch (const CORBA::Exception&)
+ {
+ return 0;
+ }
+
+ return return_value;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_INTERPRETER_UTILS_CPP */