A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
LambdaTree.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * *
3  * Copyright 2018 Rice University *
4  * *
5  * Licensed under the Apache License, Version 2.0 (the "License"); *
6  * you may not use this file except in compliance with the License. *
7  * You may obtain a copy of the License at *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14  * See the License for the specific language governing permissions and *
15  * limitations under the License. *
16  * *
17  *****************************************************************************/
18 
19 #include <memory>
20 #include <vector>
21 #include <functional>
22 #include <mustache.h>
23 #include <mustache_helper.h>
24 #include "Object.h"
25 #include "Handle.h"
26 #include "Ptr.h"
27 #include "TupleSpec.h"
28 #include "ComputeExecutor.h"
29 #include "SimpleComputeExecutor.h"
30 #include "ComputeInfo.h"
31 #include "MultiInputsBase.h"
32 #include "TupleSetMachine.h"
33 
34 
35 #ifndef PDB_LAMBDATREE_H
36 #define PDB_LAMBDATREE_H
37 
38 namespace pdb {
39 
40 template<typename Out>
41 class TypedLambdaObject;
42 
57 template<typename ReturnType>
58 class LambdaTree {
59 
60  public:
61 
62  LambdaTree() = default;
63 
68  LambdaTree(const LambdaTree<ReturnType> &toMe) : me(toMe.me) {}
69 
75  unsigned int getInputIndex(int i) {
76  return me->getInputIndex(i);
77  }
78 
83  auto &getPtr() {
84  return me;
85  }
86 
92  return me.get();
93  }
94 
100  return *me;
101  }
102 
108  template<class Type>
109  explicit LambdaTree(std::shared_ptr<Type> meIn) {
110  me = meIn;
111  }
112 
119  me = toMe.me;
120  return *this;
121  }
122 
129  template<class Type>
130  LambdaTree<ReturnType> &operator=(std::shared_ptr<Type> toMe) {
131  me = toMe;
132  return *this;
133  }
134 
135 
136  private:
137 
141  std::shared_ptr<TypedLambdaObject<ReturnType>> me;
142 
143 };
144 
145 }
146 
147 #endif //PDB_LAMBDATREE_H
LambdaTree< ReturnType > * operator->() const
Definition: LambdaTree.h:91
LambdaTree< ReturnType > & operator*() const
Definition: LambdaTree.h:99
LambdaTree(const LambdaTree< ReturnType > &toMe)
Definition: LambdaTree.h:68
std::shared_ptr< TypedLambdaObject< ReturnType > > me
Definition: LambdaTree.h:141
unsigned int getInputIndex(int i)
Definition: LambdaTree.h:75
LambdaTree(std::shared_ptr< Type > meIn)
Definition: LambdaTree.h:109
LambdaTree< ReturnType > & operator=(std::shared_ptr< Type > toMe)
Definition: LambdaTree.h:130
LambdaTree()=default
auto & getPtr()
Definition: LambdaTree.h:83
LambdaTree< ReturnType > & operator=(const LambdaTree< ReturnType > &toMe)
Definition: LambdaTree.h:118