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
JoinTests.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 #ifndef JOIN_TESTS_H
20 #define JOIN_TESTS_H
21 
22 #include "Handle.h"
23 
24 // all of this nastiness allows us to call getSelection and getProjection on a join, using the
25 // correct number of args
26 namespace pdb {
27 
28 extern GenericHandle foofoo;
29 
30 struct HasTwoArgs {
31  template <typename U>
32  static auto test(U* x) -> decltype(x->getSelection(foofoo, foofoo)) {
33  return x->getSelection(foofoo, foofoo);
34  }
35 };
36 
37 struct HasThreeArgs {
38  template <typename U>
39  static auto test(U* x) -> decltype(x->getSelection(foofoo, foofoo, foofoo)) {
40  return x->getSelection(foofoo, foofoo, foofoo);
41  }
42 };
43 
44 struct HasFourArgs {
45  template <typename U>
46  static auto test(U* x) -> decltype(x->getSelection(foofoo, foofoo, foofoo, foofoo)) {
47  return x->getSelection(foofoo, foofoo, foofoo, foofoo);
48  }
49 };
50 
51 struct HasFiveArgs {
52  template <typename U>
53  static auto test(U* x) -> decltype(x->getSelection(foofoo, foofoo, foofoo, foofoo, foofoo)) {
54  return x->getSelection(foofoo, foofoo, foofoo, foofoo, foofoo);
55  }
56 };
57 
58 template <typename TypeToCallMethodOn>
59 auto callGetSelection(TypeToCallMethodOn& a, decltype(HasTwoArgs::test(&a)) * arg = nullptr) {
60  GenericHandle first(1);
61  GenericHandle second(2);
62  return a.getSelection(first, second);
63 }
64 
65 template <typename TypeToCallMethodOn>
66 auto callGetSelection(TypeToCallMethodOn& a, decltype(HasThreeArgs::test(&a)) * arg = nullptr) {
67  GenericHandle first(1);
68  GenericHandle second(2);
69  GenericHandle third(3);
70  return a.getSelection(first, second, third);
71 }
72 
73 template <typename TypeToCallMethodOn>
74 auto callGetSelection(TypeToCallMethodOn& a, decltype(HasFourArgs::test(&a)) * arg = nullptr) {
75  GenericHandle first(1);
76  GenericHandle second(2);
77  GenericHandle third(3);
78  GenericHandle fourth(4);
79  return a.getSelection(first, second, third, fourth);
80 }
81 
82 template <typename TypeToCallMethodOn>
83 auto callGetSelection(TypeToCallMethodOn& a, decltype(HasFiveArgs::test(&a)) * arg = nullptr) {
84  GenericHandle first(1);
85  GenericHandle second(2);
86  GenericHandle third(3);
87  GenericHandle fourth(4);
88  GenericHandle fifth(5);
89  return a.getSelection(first, second, third, fourth, fifth);
90 }
91 
92 template <typename TypeToCallMethodOn>
93 auto callGetProjection(TypeToCallMethodOn& a, decltype(HasTwoArgs::test(&a)) * arg = nullptr) {
94  GenericHandle first(1);
95  GenericHandle second(2);
96  return a.getProjection(first, second);
97 }
98 
99 template <typename TypeToCallMethodOn>
100 auto callGetProjection(TypeToCallMethodOn& a, decltype(HasThreeArgs::test(&a)) * arg = nullptr) {
101  GenericHandle first(1);
102  GenericHandle second(2);
103  GenericHandle third(3);
104  return a.getProjection(first, second, third);
105 }
106 
107 template <typename TypeToCallMethodOn>
108 auto callGetProjection(TypeToCallMethodOn& a, decltype(HasFourArgs::test(&a)) * arg = nullptr) {
109  GenericHandle first(1);
110  GenericHandle second(2);
111  GenericHandle third(3);
112  GenericHandle fourth(4);
113  return a.getProjection(first, second, third, fourth);
114 }
115 
116 template <typename TypeToCallMethodOn>
117 auto callGetProjection(TypeToCallMethodOn& a, decltype(HasFiveArgs::test(&a)) * arg = nullptr) {
118  GenericHandle first(1);
119  GenericHandle second(2);
120  GenericHandle third(3);
121  GenericHandle fourth(4);
122  GenericHandle fifth(5);
123  return a.getProjection(first, second, third, fourth, fifth);
124 }
125 }
126 
127 #endif
static auto test(U *x) -> decltype(x->getSelection(foofoo, foofoo, foofoo, foofoo))
Definition: JoinTests.h:46
static auto test(U *x) -> decltype(x->getSelection(foofoo, foofoo, foofoo, foofoo, foofoo))
Definition: JoinTests.h:53
static auto test(U *x) -> decltype(x->getSelection(foofoo, foofoo))
Definition: JoinTests.h:32
PolicyList< OtherPolicies...>::type first()
auto callGetProjection(TypeToCallMethodOn &a, decltype(HasTwoArgs::test(&a))*arg=nullptr)
Definition: JoinTests.h:93
auto callGetSelection(TypeToCallMethodOn &a, decltype(HasTwoArgs::test(&a))*arg=nullptr)
Definition: JoinTests.h:59
GenericHandle foofoo
static auto test(U *x) -> decltype(x->getSelection(foofoo, foofoo, foofoo))
Definition: JoinTests.h:39