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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
|
/**
* Copyright (C) 2019-present MongoDB, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the Server Side Public License in all respects for
* all of the code used other than as permitted herein. If you modify file(s)
* with this exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
#pragma once
#include "mongo/platform/basic.h"
#include "mongo/db/pipeline/expression_walker.h"
namespace ExpressionTests {
class Testable;
} // namespace ExpressionTests
namespace mongo {
class ExpressionConstant;
class ExpressionAbs;
class ExpressionAdd;
class ExpressionAllElementsTrue;
class ExpressionAnd;
class ExpressionAnyElementTrue;
class ExpressionArray;
class ExpressionArrayElemAt;
class ExpressionFirst;
class ExpressionLast;
class ExpressionObjectToArray;
class ExpressionArrayToObject;
class ExpressionBsonSize;
class ExpressionCeil;
class ExpressionCoerceToBool;
class ExpressionCompare;
class ExpressionConcat;
class ExpressionConcatArrays;
class ExpressionCond;
class ExpressionDateFromString;
class ExpressionDateFromParts;
class ExpressionDateToParts;
class ExpressionDateToString;
class ExpressionDayOfMonth;
class ExpressionDayOfWeek;
class ExpressionDayOfYear;
class ExpressionDivide;
class ExpressionBetween;
class ExpressionExp;
class ExpressionFieldPath;
class ExpressionFilter;
class ExpressionFloor;
class ExpressionToHashedIndexKey;
class ExpressionHour;
class ExpressionIfNull;
class ExpressionIn;
class ExpressionIndexOfArray;
class ExpressionIndexOfBytes;
class ExpressionIndexOfCP;
class ExpressionIsNumber;
class ExpressionLet;
class ExpressionLn;
class ExpressionLog;
class ExpressionLog10;
class ExpressionMap;
class ExpressionMeta;
class ExpressionMillisecond;
class ExpressionMinute;
class ExpressionMod;
class ExpressionMonth;
class ExpressionMultiply;
class ExpressionNot;
class ExpressionObject;
class ExpressionOr;
class ExpressionPow;
class ExpressionRange;
class ExpressionReduce;
class ExpressionReplaceOne;
class ExpressionReplaceAll;
class ExpressionSetDifference;
class ExpressionSetEquals;
class ExpressionSetIntersection;
class ExpressionSetIsSubset;
class ExpressionSetUnion;
class ExpressionSize;
class ExpressionReverseArray;
class ExpressionSortArray;
class ExpressionSlice;
class ExpressionIsArray;
class ExpressionInternalFindAllValuesAtPath;
class ExpressionRandom;
class ExpressionRound;
class ExpressionSecond;
class ExpressionSplit;
class ExpressionSqrt;
class ExpressionStrcasecmp;
class ExpressionSubstrBytes;
class ExpressionSubstrCP;
class ExpressionStrLenBytes;
class ExpressionBinarySize;
class ExpressionStrLenCP;
class ExpressionSubtract;
class ExpressionSwitch;
class ExpressionTestApiVersion;
class ExpressionToLower;
class ExpressionToUpper;
class ExpressionTrim;
class ExpressionTrunc;
class ExpressionType;
class ExpressionZip;
class ExpressionConvert;
class ExpressionRegexFind;
class ExpressionRegexFindAll;
class ExpressionRegexMatch;
class ExpressionWeek;
class ExpressionIsoWeekYear;
class ExpressionIsoDayOfWeek;
class ExpressionIsoWeek;
class ExpressionYear;
class ExpressionCosine;
class ExpressionSine;
class ExpressionTangent;
class ExpressionArcCosine;
class ExpressionArcSine;
class ExpressionArcTangent;
class ExpressionArcTangent2;
class ExpressionHyperbolicArcTangent;
class ExpressionHyperbolicArcCosine;
class ExpressionHyperbolicArcSine;
class ExpressionHyperbolicTangent;
class ExpressionHyperbolicCosine;
class ExpressionHyperbolicSine;
class ExpressionInternalFindSlice;
class ExpressionInternalFindPositional;
class ExpressionInternalFindElemMatch;
class ExpressionInternalFLEBetween;
class ExpressionInternalFLEEqual;
class ExpressionInternalJsEmit;
class ExpressionFunction;
class ExpressionDegreesToRadians;
class ExpressionRadiansToDegrees;
class ExpressionDateDiff;
class ExpressionDateAdd;
class ExpressionDateSubtract;
class ExpressionDateTrunc;
class ExpressionGetField;
class ExpressionSetField;
class AccumulatorAvg;
class AccumulatorFirstN;
class AccumulatorLastN;
class AccumulatorMax;
class AccumulatorMin;
class AccumulatorMaxN;
class AccumulatorMinN;
class AccumulatorStdDevPop;
class AccumulatorStdDevSamp;
class AccumulatorSum;
class AccumulatorMergeObjects;
class ExpressionTsSecond;
class ExpressionTsIncrement;
template <typename AccumulatorState>
class ExpressionFromAccumulator;
template <typename AccumulatorN>
class ExpressionFromAccumulatorN;
/**
* This is a base class to allow for traversal of an aggregation expression tree. It implements the
* visitor pattern, in which every derived class from Expression implements an accept() method,
* which simply calls the appropriate visit() method on the derived ExpressionVisitor class. The
* derived class can do whatever it needs to do for each specific node type in the corresponding
* visit() method.
*
* Derived classes are responsible for making the recursive calls to visit() if they wish
* to visit all the nodes in the expression tree. ExpressionVisitor's purpose is not actually to
* ensure that every node in the tree is visited, but rather to handle dynamic dispatch without
* having to add virtual methods to the Expression interface itself.
*
* If the visitor doesn't intend to modify the tree, then the template argument 'IsConst' should be
* set to 'true'. In this case all 'visit()' methods will take a const pointer to a visiting node.
*/
template <bool IsConst>
class ExpressionVisitor {
public:
virtual ~ExpressionVisitor() = default;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionConstant>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionAbs>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionAdd>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionAllElementsTrue>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionAnd>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionAnyElementTrue>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionTestApiVersion>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionArray>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionArrayElemAt>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionFirst>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionLast>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionObjectToArray>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionArrayToObject>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionBsonSize>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionCeil>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionCoerceToBool>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionCompare>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionConcat>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionConcatArrays>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionCond>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateFromString>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateFromParts>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateDiff>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateToParts>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateToString>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateTrunc>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDivide>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionBetween>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionExp>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionFieldPath>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionFilter>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionFloor>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIfNull>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIn>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIndexOfArray>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIndexOfBytes>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIndexOfCP>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIsNumber>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionLet>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionLn>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionLog>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionLog10>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionInternalFLEBetween>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionInternalFLEEqual>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionMap>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionMeta>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionMod>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionMultiply>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionNot>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionObject>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionOr>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionPow>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionRange>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionReduce>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionReplaceOne>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionReplaceAll>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSetDifference>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSetEquals>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSetIntersection>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSetIsSubset>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSetUnion>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSize>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionReverseArray>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSortArray>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSlice>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIsArray>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionInternalFindAllValuesAtPath>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionRandom>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionRound>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSplit>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSqrt>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionStrcasecmp>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSubstrBytes>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSubstrCP>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionStrLenBytes>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionBinarySize>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionStrLenCP>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSubtract>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSwitch>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionToLower>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionToUpper>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionTrim>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionTrunc>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionType>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionZip>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionConvert>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionRegexFind>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionRegexFindAll>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionRegexMatch>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionCosine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionTangent>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionArcCosine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionArcSine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionArcTangent>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionArcTangent2>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionHyperbolicArcTangent>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionHyperbolicArcCosine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionHyperbolicArcSine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionHyperbolicTangent>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionHyperbolicCosine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionHyperbolicSine>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDegreesToRadians>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionRadiansToDegrees>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDayOfMonth>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDayOfWeek>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDayOfYear>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionHour>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionMillisecond>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionMinute>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionMonth>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSecond>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionWeek>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIsoWeekYear>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIsoDayOfWeek>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionIsoWeek>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionYear>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionFromAccumulator<AccumulatorAvg>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst,
ExpressionFromAccumulatorN<AccumulatorFirstN>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst,
ExpressionFromAccumulatorN<AccumulatorLastN>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionFromAccumulator<AccumulatorMax>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionFromAccumulator<AccumulatorMin>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionFromAccumulatorN<AccumulatorMaxN>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionFromAccumulatorN<AccumulatorMinN>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst,
ExpressionFromAccumulator<AccumulatorStdDevPop>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst,
ExpressionFromAccumulator<AccumulatorStdDevSamp>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionFromAccumulator<AccumulatorSum>>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst,
ExpressionFromAccumulator<AccumulatorMergeObjects>>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionTests::Testable>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionInternalJsEmit>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionFunction>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionInternalFindSlice>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionInternalFindPositional>) = 0;
virtual void visit(
expression_walker::MaybeConstPtr<IsConst, ExpressionInternalFindElemMatch>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionToHashedIndexKey>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateAdd>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionDateSubtract>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionGetField>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionSetField>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionTsSecond>) = 0;
virtual void visit(expression_walker::MaybeConstPtr<IsConst, ExpressionTsIncrement>) = 0;
};
using ExpressionMutableVisitor = ExpressionVisitor<false>;
using ExpressionConstVisitor = ExpressionVisitor<true>;
/**
* This class provides null implementations for all visit methods so that a derived class can
* override visit method(s) only for interested 'Expression' types. For example, if one wants
* to visit only 'ExpressionFieldPath', one can override only void visit(const
* ExpressionFieldPath*).
*
* struct FieldPathVisitor : public SelectiveConstExpressionVisitorBase {
* // To avoid overloaded-virtual warnings.
* using SelectiveConstExpressionVisitorBase::visit;
*
* void visit(const ExpressionFieldPath* expr) final {
* // logic for what to do with an ExpressionFieldPath.
* }
* };
*/
struct SelectiveConstExpressionVisitorBase : public ExpressionConstVisitor {
void visit(const ExpressionConstant*) override {}
void visit(const ExpressionAbs*) override {}
void visit(const ExpressionAdd*) override {}
void visit(const ExpressionAllElementsTrue*) override {}
void visit(const ExpressionAnd*) override {}
void visit(const ExpressionAnyElementTrue*) override {}
void visit(const ExpressionArray*) override {}
void visit(const ExpressionArrayElemAt*) override {}
void visit(const ExpressionFirst*) override {}
void visit(const ExpressionLast*) override {}
void visit(const ExpressionObjectToArray*) override {}
void visit(const ExpressionArrayToObject*) override {}
void visit(const ExpressionBsonSize*) override {}
void visit(const ExpressionCeil*) override {}
void visit(const ExpressionCoerceToBool*) override {}
void visit(const ExpressionCompare*) override {}
void visit(const ExpressionConcat*) override {}
void visit(const ExpressionConcatArrays*) override {}
void visit(const ExpressionCond*) override {}
void visit(const ExpressionDateDiff*) override {}
void visit(const ExpressionDateFromString*) override {}
void visit(const ExpressionDateFromParts*) override {}
void visit(const ExpressionDateToParts*) override {}
void visit(const ExpressionDateToString*) override {}
void visit(const ExpressionDateTrunc*) override {}
void visit(const ExpressionDivide*) override {}
void visit(const ExpressionBetween*) override {}
void visit(const ExpressionExp*) override {}
void visit(const ExpressionFieldPath*) override {}
void visit(const ExpressionFilter*) override {}
void visit(const ExpressionFloor*) override {}
void visit(const ExpressionIfNull*) override {}
void visit(const ExpressionIn*) override {}
void visit(const ExpressionIndexOfArray*) override {}
void visit(const ExpressionIndexOfBytes*) override {}
void visit(const ExpressionIndexOfCP*) override {}
void visit(const ExpressionIsNumber*) override {}
void visit(const ExpressionLet*) override {}
void visit(const ExpressionLn*) override {}
void visit(const ExpressionLog*) override {}
void visit(const ExpressionLog10*) override {}
void visit(const ExpressionInternalFLEBetween*) override {}
void visit(const ExpressionInternalFLEEqual*) override {}
void visit(const ExpressionMap*) override {}
void visit(const ExpressionMeta*) override {}
void visit(const ExpressionMod*) override {}
void visit(const ExpressionMultiply*) override {}
void visit(const ExpressionNot*) override {}
void visit(const ExpressionObject*) override {}
void visit(const ExpressionOr*) override {}
void visit(const ExpressionPow*) override {}
void visit(const ExpressionRange*) override {}
void visit(const ExpressionReduce*) override {}
void visit(const ExpressionReplaceOne*) override {}
void visit(const ExpressionReplaceAll*) override {}
void visit(const ExpressionSetDifference*) override {}
void visit(const ExpressionSetEquals*) override {}
void visit(const ExpressionSetIntersection*) override {}
void visit(const ExpressionSetIsSubset*) override {}
void visit(const ExpressionSetUnion*) override {}
void visit(const ExpressionSize*) override {}
void visit(const ExpressionReverseArray*) override {}
void visit(const ExpressionSortArray*) override {}
void visit(const ExpressionSlice*) override {}
void visit(const ExpressionIsArray*) override {}
void visit(const ExpressionInternalFindAllValuesAtPath*) override {}
void visit(const ExpressionRound*) override {}
void visit(const ExpressionSplit*) override {}
void visit(const ExpressionSqrt*) override {}
void visit(const ExpressionStrcasecmp*) override {}
void visit(const ExpressionSubstrBytes*) override {}
void visit(const ExpressionSubstrCP*) override {}
void visit(const ExpressionStrLenBytes*) override {}
void visit(const ExpressionBinarySize*) override {}
void visit(const ExpressionStrLenCP*) override {}
void visit(const ExpressionSubtract*) override {}
void visit(const ExpressionSwitch*) override {}
void visit(const ExpressionTestApiVersion*) override {}
void visit(const ExpressionToLower*) override {}
void visit(const ExpressionToUpper*) override {}
void visit(const ExpressionTrim*) override {}
void visit(const ExpressionTrunc*) override {}
void visit(const ExpressionType*) override {}
void visit(const ExpressionZip*) override {}
void visit(const ExpressionConvert*) override {}
void visit(const ExpressionRegexFind*) override {}
void visit(const ExpressionRegexFindAll*) override {}
void visit(const ExpressionRegexMatch*) override {}
void visit(const ExpressionCosine*) override {}
void visit(const ExpressionSine*) override {}
void visit(const ExpressionTangent*) override {}
void visit(const ExpressionArcCosine*) override {}
void visit(const ExpressionArcSine*) override {}
void visit(const ExpressionArcTangent*) override {}
void visit(const ExpressionArcTangent2*) override {}
void visit(const ExpressionHyperbolicArcTangent*) override {}
void visit(const ExpressionHyperbolicArcCosine*) override {}
void visit(const ExpressionHyperbolicArcSine*) override {}
void visit(const ExpressionHyperbolicTangent*) override {}
void visit(const ExpressionHyperbolicCosine*) override {}
void visit(const ExpressionHyperbolicSine*) override {}
void visit(const ExpressionDegreesToRadians*) override {}
void visit(const ExpressionRadiansToDegrees*) override {}
void visit(const ExpressionDayOfMonth*) override {}
void visit(const ExpressionDayOfWeek*) override {}
void visit(const ExpressionDayOfYear*) override {}
void visit(const ExpressionHour*) override {}
void visit(const ExpressionMillisecond*) override {}
void visit(const ExpressionMinute*) override {}
void visit(const ExpressionMonth*) override {}
void visit(const ExpressionSecond*) override {}
void visit(const ExpressionWeek*) override {}
void visit(const ExpressionIsoWeekYear*) override {}
void visit(const ExpressionIsoDayOfWeek*) override {}
void visit(const ExpressionIsoWeek*) override {}
void visit(const ExpressionYear*) override {}
void visit(const ExpressionFromAccumulator<AccumulatorAvg>*) override {}
void visit(const ExpressionFromAccumulator<AccumulatorMax>*) override {}
void visit(const ExpressionFromAccumulator<AccumulatorMin>*) override {}
void visit(const ExpressionFromAccumulatorN<AccumulatorFirstN>*) override {}
void visit(const ExpressionFromAccumulatorN<AccumulatorLastN>*) override {}
void visit(const ExpressionFromAccumulatorN<AccumulatorMaxN>*) override {}
void visit(const ExpressionFromAccumulatorN<AccumulatorMinN>*) override {}
void visit(const ExpressionFromAccumulator<AccumulatorStdDevPop>*) override {}
void visit(const ExpressionFromAccumulator<AccumulatorStdDevSamp>*) override {}
void visit(const ExpressionFromAccumulator<AccumulatorSum>*) override {}
void visit(const ExpressionFromAccumulator<AccumulatorMergeObjects>*) override {}
void visit(const ExpressionTests::Testable*) override {}
void visit(const ExpressionInternalJsEmit*) override {}
void visit(const ExpressionInternalFindSlice*) override {}
void visit(const ExpressionInternalFindPositional*) override {}
void visit(const ExpressionInternalFindElemMatch*) override {}
void visit(const ExpressionFunction*) override {}
void visit(const ExpressionRandom*) override {}
void visit(const ExpressionToHashedIndexKey*) override {}
void visit(const ExpressionDateAdd*) override {}
void visit(const ExpressionDateSubtract*) override {}
void visit(const ExpressionGetField*) override {}
void visit(const ExpressionSetField*) override {}
void visit(const ExpressionTsSecond*) override {}
void visit(const ExpressionTsIncrement*) override {}
};
} // namespace mongo
|