summaryrefslogtreecommitdiff
path: root/ace/Functor_T.i
blob: cf4171c09845f804d9d397624b0e6b35f0bf4d35 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    ace
//
// = FILENAME
//    Functor_T.i
//
// = DESCRIPTION
//    Inlinable method definitions for templatized classes
//    implementing the GOF Command Pattern, also known as functors
//    or function objects.
//
// = AUTHOR
//    Chris Gill           <cdgill@cs.wustl.edu>
//
//    Based on Command Pattern implementations originally done by
//
//    Carlos O'Ryan        <coryan@cs.wustl.edu>  and
//    Douglas C. Schmidt   <schmidt@cs.wustl.edu> and
//    Sergio Flores-Gaitan <sergio@cs.wustl.edu>
//
// ============================================================================


// Invokes the less than function object.

template <class OPERAND1, class OPERAND2> ACE_INLINE int
ACE_Less_Than_Functor<OPERAND1, OPERAND2>::execute (const OPERAND1 &operand1,
                                                    const OPERAND2 &operand2)
{
  return (operand1 < operand2) ? 1 : 0;
}

// Creates another object of the same type.

template <class OPERAND1, class OPERAND2> ACE_INLINE
ACE_Const_Binary_Functor_Base<OPERAND1, OPERAND2> *
ACE_Less_Than_Functor<OPERAND1, OPERAND2>::clone ()
{
  return new ACE_Less_Than_Functor<OPERAND1, OPERAND2>;
}