CppADCodeGen  HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
operation_path_node.hpp
1 #ifndef CPPAD_CG_OPERATION_PATH_NODE_INCLUDED
2 #define CPPAD_CG_OPERATION_PATH_NODE_INCLUDED
3 /* --------------------------------------------------------------------------
4  * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5  * Copyright (C) 2016 Ciengis
6  *
7  * CppADCodeGen is distributed under multiple licenses:
8  *
9  * - Eclipse Public License Version 1.0 (EPL1), and
10  * - GNU General Public License Version 3 (GPL3).
11  *
12  * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13  * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14  * ----------------------------------------------------------------------------
15  * Author: Joao Leal
16  */
17 
18 namespace CppAD {
19 namespace cg {
20 
21 template<class Base>
22 struct OperationPathNode {
30  size_t argIndex;
31 
32  inline OperationPathNode() :
33  node(nullptr),
34  argIndex(0) {
35  }
36 
38  size_t argIndex) :
39  node(node),
40  argIndex(argIndex) {
41  }
42 
43  inline bool operator<(const OperationPathNode<Base>& right) const {
44  return node < right.node || argIndex < right.argIndex;
45  }
46 
47 };
48 
49 template<class Base>
50 inline bool operator==(const OperationPathNode<Base>& left,
51  const OperationPathNode<Base>& right) {
52  return left.node == right.node && left.argIndex == right.argIndex;
53 }
54 
55 template<class Base>
56 inline bool operator!=(const OperationPathNode<Base>& left,
57  const OperationPathNode<Base>& right) {
58  return left.node != right.node || left.argIndex != right.argIndex;
59 }
60 
61 } // END cg namespace
62 } // END CppAD namespace
63 
64 #endif
OperationNode< Base > * node