00001 # ifndef CPPAD_BOOL_FUN_LINK_INCLUDED 00002 # define CPPAD_BOOL_FUN_LINK_INCLUDED 00003 00004 /* -------------------------------------------------------------------------- 00005 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell 00006 00007 CppAD is distributed under multiple licenses. This distribution is under 00008 the terms of the 00009 Common Public License Version 1.0. 00010 00011 A copy of this license is included in the COPYING file of this distribution. 00012 Please visit http://www.coin-or.org/CppAD/ for information on other licenses. 00013 -------------------------------------------------------------------------- */ 00014 00015 /* 00016 $begin BoolFunLink$$ $comment CppAD Developer Documentation$$ 00017 00018 $spell 00019 inline 00020 bool 00021 Cpp 00022 const 00023 $$ 00024 00025 $section CppAD Boolean Valued User Defined Functions Implementation$$ 00026 00027 $head UnaryBool$$ 00028 $index UnaryBool$$ 00029 The procedure call 00030 $syntax% 00031 inline bool UnaryBool( 00032 bool %FunName%(const %Base% &%x%), 00033 const AD<%Base%> &%x%) 00034 %$$ 00035 uses a call to the procedure $italic FunName$$ to evaluate a unary 00036 boolean valued function of a base type argument 00037 and returns it as the value of the corresponding AD argument. 00038 00039 00040 $head BinaryBool$$ 00041 $index BinaryBool$$ 00042 The procedure call 00043 $syntax% 00044 inline bool BinaryBool( 00045 bool %FunName%(const %Base% &%x%, const %Base% &%y%), 00046 const AD<%Base%> &%x%, const AD<%Base%> &%y%) 00047 %$$ 00048 uses a call to the procedure $italic FunName$$ to evaluate a binary 00049 boolean valued function of two base type arguments 00050 and returns it as the value of the corresponding AD arguments. 00051 00052 00053 00054 $end 00055 */ 00056 00057 // BEGIN CppAD namespace 00058 namespace CppAD { 00059 00060 template <class Base> 00061 inline bool AD<Base>::UnaryBool( 00062 bool FunName(const Base &x), 00063 const AD<Base> &x 00064 ) 00065 { 00066 return FunName(x.value_); 00067 } 00068 00069 template <class Base> 00070 inline bool AD<Base>::BinaryBool( 00071 bool FunName(const Base &x, const Base &y), 00072 const AD<Base> &x, const AD<Base> &y 00073 ) 00074 { 00075 return FunName(x.value_, y.value_); 00076 } 00077 00078 } // END CppAD namespace 00079 00080 # endif