~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to src/mongo/db/pipeline/expression.h

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    class BSONObjBuilder;
30
30
    class Builder;
31
31
    class Document;
 
32
    class MutableDocument;
32
33
    class DocumentSource;
33
34
    class ExpressionContext;
34
35
    class Value;
62
63
           @param deps output parameter
63
64
           @param path path to self if all ancestors are ExpressionObjects.
64
65
                       Top-level ExpressionObject gets pointer to empty vector.
65
 
                       If any other Expression is an ancestor {a:1} object
66
 
                       aren't allowed, so they get NULL
67
 
 
68
 
 
 
66
                       If any other Expression is an ancestor, or in other cases
 
67
                       where {a:1} inclusion objects aren't allowed, they get
 
68
                       NULL.
69
69
         */
70
70
        virtual void addDependencies(set<string>& deps, vector<string>* path=NULL) const = 0;
71
71
 
77
77
 
78
78
          @returns the computed value
79
79
        */
80
 
        virtual intrusive_ptr<const Value> evaluate(
81
 
            const intrusive_ptr<Document> &pDocument) const = 0;
 
80
        virtual Value evaluate(const Document& pDocument) const = 0;
82
81
 
83
82
        /*
84
83
          Add the Expression (and any descendant Expressions) into a BSON
95
94
            $project which distinguish between field inclusion and virtual
96
95
            field specification;  See ExpressionConstant.
97
96
         */
98
 
        virtual void addToBsonObj(
99
 
            BSONObjBuilder *pBuilder, string fieldName,
100
 
            bool requireExpression) const = 0;
 
97
        virtual void addToBsonObj(BSONObjBuilder *pBuilder,
 
98
                                  StringData fieldName,
 
99
                                  bool requireExpression) const = 0;
101
100
 
102
101
        /*
103
102
          Add the Expression (and any descendant Expressions) into a BSON
224
223
    public:
225
224
        // virtuals from Expression
226
225
        virtual intrusive_ptr<Expression> optimize();
227
 
        virtual void addToBsonObj(
228
 
            BSONObjBuilder *pBuilder, string fieldName,
229
 
            bool requireExpression) const;
 
226
        virtual void addToBsonObj(BSONObjBuilder *pBuilder,
 
227
                                  StringData fieldName,
 
228
                                  bool requireExpression) const;
230
229
        virtual void addToBsonArray(BSONArrayBuilder *pBuilder) const;
231
230
        virtual void addDependencies(set<string>& deps, vector<string>* path=NULL) const;
232
231
 
314
313
    public:
315
314
        // virtuals from Expression
316
315
        virtual ~ExpressionAdd();
317
 
        virtual intrusive_ptr<const Value> evaluate(const intrusive_ptr<Document> &pDocument) const;
 
316
        virtual Value evaluate(const Document& pDocument) const;
318
317
        virtual const char *getOpName() const;
319
318
 
320
319
        // virtuals from ExpressionNary
335
334
        // virtuals from Expression
336
335
        virtual ~ExpressionAnd();
337
336
        virtual intrusive_ptr<Expression> optimize();
338
 
        virtual intrusive_ptr<const Value> evaluate(
339
 
            const intrusive_ptr<Document> &pDocument) const;
 
337
        virtual Value evaluate(const Document& pDocument) const;
340
338
        virtual const char *getOpName() const;
341
339
        virtual void toMatcherBson(BSONObjBuilder *pBuilder) const;
342
340
 
366
364
        virtual ~ExpressionCoerceToBool();
367
365
        virtual intrusive_ptr<Expression> optimize();
368
366
        virtual void addDependencies(set<string>& deps, vector<string>* path=NULL) const;
369
 
        virtual intrusive_ptr<const Value> evaluate(
370
 
            const intrusive_ptr<Document> &pDocument) const;
371
 
        virtual void addToBsonObj(
372
 
            BSONObjBuilder *pBuilder, string fieldName,
373
 
            bool requireExpression) const;
 
367
        virtual Value evaluate(const Document& pDocument) const;
 
368
        virtual void addToBsonObj(BSONObjBuilder *pBuilder,
 
369
                                  StringData fieldName,
 
370
                                  bool requireExpression) const;
374
371
        virtual void addToBsonArray(BSONArrayBuilder *pBuilder) const;
375
372
 
376
373
        static intrusive_ptr<ExpressionCoerceToBool> create(
389
386
        // virtuals from ExpressionNary
390
387
        virtual ~ExpressionCompare();
391
388
        virtual intrusive_ptr<Expression> optimize();
392
 
        virtual intrusive_ptr<const Value> evaluate(
393
 
            const intrusive_ptr<Document> &pDocument) const;
 
389
        virtual Value evaluate(const Document& pDocument) const;
394
390
        virtual const char *getOpName() const;
395
391
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
396
392
 
399
395
          Provide for conformance with the uniform function pointer signature
400
396
          required for parsing.
401
397
 
402
 
          These create a particular comparision operand, without any
 
398
          These create a particular comparison operand, without any
403
399
          operands.  Those must be added via ExpressionNary::addOperand().
404
400
        */
405
401
        static intrusive_ptr<ExpressionNary> createCmp();
418
414
    };
419
415
 
420
416
 
421
 
    class ExpressionCond :
422
 
        public ExpressionNary {
 
417
    class ExpressionConcat : public ExpressionNary {
 
418
    public:
 
419
        // virtuals from ExpressionNary
 
420
        virtual ~ExpressionConcat();
 
421
        virtual Value evaluate(const Document& input) const;
 
422
        virtual const char *getOpName() const;
 
423
 
 
424
        static intrusive_ptr<ExpressionNary> create();
 
425
    };
 
426
 
 
427
 
 
428
    class ExpressionCond : public ExpressionNary {
423
429
    public:
424
430
        // virtuals from ExpressionNary
425
431
        virtual ~ExpressionCond();
426
 
        virtual intrusive_ptr<const Value> evaluate(
427
 
            const intrusive_ptr<Document> &pDocument) const;
 
432
        virtual Value evaluate(const Document& pDocument) const;
428
433
        virtual const char *getOpName() const;
429
434
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
430
435
 
442
447
        virtual ~ExpressionConstant();
443
448
        virtual intrusive_ptr<Expression> optimize();
444
449
        virtual void addDependencies(set<string>& deps, vector<string>* path=NULL) const;
445
 
        virtual intrusive_ptr<const Value> evaluate(
446
 
            const intrusive_ptr<Document> &pDocument) const;
 
450
        virtual Value evaluate(const Document& pDocument) const;
447
451
        virtual const char *getOpName() const;
448
 
        virtual void addToBsonObj(
449
 
            BSONObjBuilder *pBuilder, string fieldName,
450
 
            bool requireExpression) const;
 
452
        virtual void addToBsonObj(BSONObjBuilder *pBuilder,
 
453
                                  StringData fieldName,
 
454
                                  bool requireExpression) const;
451
455
        virtual void addToBsonArray(BSONArrayBuilder *pBuilder) const;
452
456
 
453
457
        static intrusive_ptr<ExpressionConstant> createFromBsonElement(
454
458
            BSONElement *pBsonElement);
455
 
        static intrusive_ptr<ExpressionConstant> create(
456
 
            const intrusive_ptr<const Value> &pValue);
 
459
        static intrusive_ptr<ExpressionConstant> create(const Value& pValue);
457
460
 
458
461
        /*
459
462
          Get the constant value represented by this Expression.
460
463
 
461
464
          @returns the value
462
465
         */
463
 
        intrusive_ptr<const Value> getValue() const;
 
466
        Value getValue() const;
464
467
 
465
468
    private:
466
469
        ExpressionConstant(BSONElement *pBsonElement);
467
 
        ExpressionConstant(const intrusive_ptr<const Value> &pValue);
 
470
        ExpressionConstant(const Value& pValue);
468
471
 
469
 
        intrusive_ptr<const Value> pValue;
 
472
        Value pValue;
470
473
    };
471
474
 
472
475
 
475
478
    public:
476
479
        // virtuals from ExpressionNary
477
480
        virtual ~ExpressionDayOfMonth();
478
 
        virtual intrusive_ptr<const Value> evaluate(
479
 
            const intrusive_ptr<Document> &pDocument) const;
 
481
        virtual Value evaluate(const Document& pDocument) const;
480
482
        virtual const char *getOpName() const;
481
483
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
482
484
 
492
494
    public:
493
495
        // virtuals from ExpressionNary
494
496
        virtual ~ExpressionDayOfWeek();
495
 
        virtual intrusive_ptr<const Value> evaluate(
496
 
            const intrusive_ptr<Document> &pDocument) const;
 
497
        virtual Value evaluate(const Document& pDocument) const;
497
498
        virtual const char *getOpName() const;
498
499
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
499
500
 
509
510
    public:
510
511
        // virtuals from ExpressionNary
511
512
        virtual ~ExpressionDayOfYear();
512
 
        virtual intrusive_ptr<const Value> evaluate(
513
 
            const intrusive_ptr<Document> &pDocument) const;
 
513
        virtual Value evaluate(const Document& pDocument) const;
514
514
        virtual const char *getOpName() const;
515
515
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
516
516
 
526
526
    public:
527
527
        // virtuals from ExpressionNary
528
528
        virtual ~ExpressionDivide();
529
 
        virtual intrusive_ptr<const Value> evaluate(
530
 
            const intrusive_ptr<Document> &pDocument) const;
 
529
        virtual Value evaluate(const Document& pDocument) const;
531
530
        virtual const char *getOpName() const;
532
531
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
533
532
 
545
544
        virtual ~ExpressionFieldPath();
546
545
        virtual intrusive_ptr<Expression> optimize();
547
546
        virtual void addDependencies(set<string>& deps, vector<string>* path=NULL) const;
548
 
        virtual intrusive_ptr<const Value> evaluate(
549
 
            const intrusive_ptr<Document> &pDocument) const;
550
 
        virtual void addToBsonObj(
551
 
            BSONObjBuilder *pBuilder, string fieldName,
552
 
            bool requireExpression) const;
 
547
        virtual Value evaluate(const Document& pDocument) const;
 
548
        virtual void addToBsonObj(BSONObjBuilder *pBuilder,
 
549
                                  StringData fieldName,
 
550
                                  bool requireExpression) const;
553
551
        virtual void addToBsonArray(BSONArrayBuilder *pBuilder) const;
554
552
 
555
553
        /*
596
594
          a be an array of objects in order to navigate more deeply.
597
595
 
598
596
          @param index current path field index to extract
599
 
          @param pathLength maximum number of fields on field path
600
 
          @param pDocument current document traversed to (not the top-level one)
 
597
          @param input current document traversed to (not the top-level one)
601
598
          @returns the field found; could be an array
602
599
         */
603
 
        intrusive_ptr<const Value> evaluatePath(
604
 
            size_t index, const size_t pathLength, 
605
 
            intrusive_ptr<Document> pDocument) const;
 
600
        Value evaluatePath(size_t index, const Document& input) const;
 
601
 
 
602
        // Helper for evaluatePath to handle Array case
 
603
        Value evaluatePathArray(size_t index, const Value& input) const;
606
604
 
607
605
        FieldPath fieldPath;
608
606
    };
615
613
        virtual ~ExpressionFieldRange();
616
614
        virtual intrusive_ptr<Expression> optimize();
617
615
        virtual void addDependencies(set<string>& deps, vector<string>* path=NULL) const;
618
 
        virtual intrusive_ptr<const Value> evaluate(
619
 
            const intrusive_ptr<Document> &pDocument) const;
620
 
        virtual void addToBsonObj(
621
 
            BSONObjBuilder *pBuilder, string fieldName,
622
 
            bool requireExpression) const;
 
616
        virtual Value evaluate(const Document& pDocument) const;
 
617
        virtual void addToBsonObj(BSONObjBuilder *pBuilder,
 
618
                                  StringData fieldName,
 
619
                                  bool requireExpression) const;
623
620
        virtual void addToBsonArray(BSONArrayBuilder *pBuilder) const;
624
621
        virtual void toMatcherBson(BSONObjBuilder *pBuilder) const;
625
622
 
645
642
         */
646
643
        static intrusive_ptr<ExpressionFieldRange> create(
647
644
            const intrusive_ptr<ExpressionFieldPath> &pFieldPath,
648
 
            CmpOp cmpOp, const intrusive_ptr<const Value> &pValue);
 
645
            CmpOp cmpOp, const Value& pValue);
649
646
 
650
647
        /*
651
648
          Add an intersecting range.
660
657
          @param cmpOp the comparison operator
661
658
          @param pValue the value to compare against
662
659
         */
663
 
        void intersect(CmpOp cmpOp, const intrusive_ptr<const Value> &pValue);
 
660
        void intersect(CmpOp cmpOp, const Value& pValue);
664
661
 
665
662
    private:
666
663
        ExpressionFieldRange(const intrusive_ptr<ExpressionFieldPath> &pFieldPath,
667
664
                             CmpOp cmpOp,
668
 
                             const intrusive_ptr<const Value> &pValue);
 
665
                             const Value& pValue);
669
666
 
670
667
        intrusive_ptr<ExpressionFieldPath> pFieldPath;
671
668
 
672
669
        class Range {
673
670
        public:
674
 
            Range(CmpOp cmpOp, const intrusive_ptr<const Value> &pValue);
 
671
            Range(CmpOp cmpOp, const Value& pValue);
675
672
            Range(const Range &rRange);
676
673
 
677
674
            Range *intersect(const Range *pRange) const;
678
 
            bool contains(const intrusive_ptr<const Value> &pValue) const;
 
675
            bool contains(const Value& pValue) const;
679
676
 
680
 
            Range(const intrusive_ptr<const Value> &pBottom, bool bottomOpen,
681
 
                  const intrusive_ptr<const Value> &pTop, bool topOpen);
 
677
            Range(const Value& pBottom, bool bottomOpen,
 
678
                  const Value& pTop, bool topOpen);
682
679
 
683
680
            bool bottomOpen;
684
681
            bool topOpen;
685
 
            intrusive_ptr<const Value> pBottom;
686
 
            intrusive_ptr<const Value> pTop;
 
682
            Value pBottom;
 
683
            Value pTop;
687
684
        };
688
685
 
689
686
        scoped_ptr<Range> pRange;
706
703
    public:
707
704
        // virtuals from ExpressionNary
708
705
        virtual ~ExpressionHour();
709
 
        virtual intrusive_ptr<const Value> evaluate(
710
 
            const intrusive_ptr<Document> &pDocument) const;
 
706
        virtual Value evaluate(const Document& pDocument) const;
711
707
        virtual const char *getOpName() const;
712
708
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
713
709
 
723
719
    public:
724
720
        // virtuals from ExpressionNary
725
721
        virtual ~ExpressionIfNull();
726
 
        virtual intrusive_ptr<const Value> evaluate(
727
 
            const intrusive_ptr<Document> &pDocument) const;
 
722
        virtual Value evaluate(const Document& pDocument) const;
728
723
        virtual const char *getOpName() const;
729
724
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
730
725
 
735
730
    };
736
731
 
737
732
 
 
733
    class ExpressionMillisecond :
 
734
        public ExpressionNary {
 
735
    public:
 
736
        // virtuals from ExpressionNary
 
737
        virtual ~ExpressionMillisecond();
 
738
        virtual Value evaluate(const Document& document) const;
 
739
        virtual const char* getOpName() const;
 
740
        virtual void addOperand(const intrusive_ptr<Expression>& pExpression);
 
741
 
 
742
        static intrusive_ptr<ExpressionNary> create();
 
743
 
 
744
    private:
 
745
        ExpressionMillisecond();
 
746
    };
 
747
 
 
748
 
738
749
    class ExpressionMinute :
739
750
        public ExpressionNary {
740
751
    public:
741
752
        // virtuals from ExpressionNary
742
753
        virtual ~ExpressionMinute();
743
 
        virtual intrusive_ptr<const Value> evaluate(
744
 
            const intrusive_ptr<Document> &pDocument) const;
 
754
        virtual Value evaluate(const Document& pDocument) const;
745
755
        virtual const char *getOpName() const;
746
756
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
747
757
 
757
767
    public:
758
768
        // virtuals from ExpressionNary
759
769
        virtual ~ExpressionMod();
760
 
        virtual intrusive_ptr<const Value> evaluate(
761
 
            const intrusive_ptr<Document> &pDocument) const;
 
770
        virtual Value evaluate(const Document& pDocument) const;
762
771
        virtual const char *getOpName() const;
763
772
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
764
773
 
774
783
    public:
775
784
        // virtuals from Expression
776
785
        virtual ~ExpressionMultiply();
777
 
        virtual intrusive_ptr<const Value> evaluate(
778
 
            const intrusive_ptr<Document> &pDocument) const;
 
786
        virtual Value evaluate(const Document& pDocument) const;
779
787
        virtual const char *getOpName() const;
780
788
 
781
789
        // virtuals from ExpressionNary
798
806
    public:
799
807
        // virtuals from ExpressionNary
800
808
        virtual ~ExpressionMonth();
801
 
        virtual intrusive_ptr<const Value> evaluate(
802
 
            const intrusive_ptr<Document> &pDocument) const;
 
809
        virtual Value evaluate(const Document& pDocument) const;
803
810
        virtual const char *getOpName() const;
804
811
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
805
812
 
815
822
    public:
816
823
        // virtuals from ExpressionNary
817
824
        virtual ~ExpressionNot();
818
 
        virtual intrusive_ptr<const Value> evaluate(
819
 
            const intrusive_ptr<Document> &pDocument) const;
 
825
        virtual Value evaluate(const Document& pDocument) const;
820
826
        virtual const char *getOpName() const;
821
827
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
822
828
 
835
841
        virtual intrusive_ptr<Expression> optimize();
836
842
        virtual bool isSimple();
837
843
        virtual void addDependencies(set<string>& deps, vector<string>* path=NULL) const;
838
 
        virtual intrusive_ptr<const Value> evaluate(
839
 
            const intrusive_ptr<Document> &pDocument) const;
840
 
        virtual void addToBsonObj(
841
 
            BSONObjBuilder *pBuilder, string fieldName,
842
 
            bool requireExpression) const;
 
844
        /** Only evaluates non inclusion expressions.  For inclusions, use addToDocument(). */
 
845
        virtual Value evaluate(const Document& pDocument) const;
 
846
        virtual void addToBsonObj(BSONObjBuilder *pBuilder,
 
847
                                  StringData fieldName,
 
848
                                  bool requireExpression) const;
843
849
        virtual void addToBsonArray(BSONArrayBuilder *pBuilder) const;
844
850
 
845
851
        /*
849
855
          @param pDocument the input Document
850
856
          @returns the result document
851
857
         */
852
 
        intrusive_ptr<Document> evaluateDocument(
853
 
            const intrusive_ptr<Document> &pDocument) const;
 
858
        Document evaluateDocument(const Document& pDocument) const;
854
859
 
855
860
        /*
856
861
          evaluate(), but add the evaluated fields to a given document
860
865
          @param pDocument the input Document for this level
861
866
          @param rootDoc the root of the whole input document
862
867
         */
863
 
        void addToDocument(const intrusive_ptr<Document>& pResult,
864
 
                           const intrusive_ptr<Document>& pDocument,
865
 
                           const intrusive_ptr<Document>& rootDoc
 
868
        void addToDocument(MutableDocument& pResult,
 
869
                           const Document& pDocument,
 
870
                           const Document& rootDoc
866
871
                          ) const;
867
872
 
868
873
        // estimated number of fields that will be output
945
950
        vector<string> _order;
946
951
 
947
952
        bool _excludeId;
948
 
 
949
 
        /*
950
 
          Utility object for collecting emitPaths() results in a BSON
951
 
          object.
952
 
         */
953
 
        class BuilderPathSink :
954
 
            public PathSink {
955
 
        public:
956
 
            // virtuals from PathSink
957
 
            virtual void path(const string &path, bool include);
958
 
 
959
 
            /*
960
 
              Create a PathSink that writes paths to a BSONObjBuilder,
961
 
              to create an object in the form of { path:is_included,...}
962
 
 
963
 
              This object uses a builder pointer that won't guarantee the
964
 
              lifetime of the builder, so make sure it outlasts the use of
965
 
              this for an emitPaths() call.
966
 
 
967
 
              @param pBuilder to the builder to write paths to
968
 
             */
969
 
            BuilderPathSink(BSONObjBuilder *pBuilder);
970
 
 
971
 
        private:
972
 
            BSONObjBuilder *pBuilder;
973
 
        };
974
 
 
975
 
        /* utility class used by emitPaths() */
976
 
        class PathPusher :
977
 
            boost::noncopyable {
978
 
        public:
979
 
            PathPusher(vector<string> *pvPath, const string &s);
980
 
            ~PathPusher();
981
 
 
982
 
        private:
983
 
            vector<string> *pvPath;
984
 
        };
985
953
    };
986
954
 
987
955
 
991
959
        // virtuals from Expression
992
960
        virtual ~ExpressionOr();
993
961
        virtual intrusive_ptr<Expression> optimize();
994
 
        virtual intrusive_ptr<const Value> evaluate(
995
 
            const intrusive_ptr<Document> &pDocument) const;
 
962
        virtual Value evaluate(const Document& pDocument) const;
996
963
        virtual const char *getOpName() const;
997
964
        virtual void toMatcherBson(BSONObjBuilder *pBuilder) const;
998
965
 
1020
987
    public:
1021
988
        // virtuals from ExpressionNary
1022
989
        virtual ~ExpressionSecond();
1023
 
        virtual intrusive_ptr<const Value> evaluate(
1024
 
            const intrusive_ptr<Document> &pDocument) const;
 
990
        virtual Value evaluate(const Document& pDocument) const;
1025
991
        virtual const char *getOpName() const;
1026
992
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1027
993
 
1037
1003
    public:
1038
1004
        // virtuals from ExpressionNary
1039
1005
        virtual ~ExpressionStrcasecmp();
1040
 
        virtual intrusive_ptr<const Value> evaluate(
1041
 
            const intrusive_ptr<Document> &pDocument) const;
 
1006
        virtual Value evaluate(const Document& pDocument) const;
1042
1007
        virtual const char *getOpName() const;
1043
1008
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1044
1009
 
1054
1019
    public:
1055
1020
        // virtuals from ExpressionNary
1056
1021
        virtual ~ExpressionSubstr();
1057
 
        virtual intrusive_ptr<const Value> evaluate(
1058
 
            const intrusive_ptr<Document> &pDocument) const;
 
1022
        virtual Value evaluate(const Document& pDocument) const;
1059
1023
        virtual const char *getOpName() const;
1060
1024
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1061
1025
 
1071
1035
    public:
1072
1036
        // virtuals from ExpressionNary
1073
1037
        virtual ~ExpressionSubtract();
1074
 
        virtual intrusive_ptr<const Value> evaluate(
1075
 
            const intrusive_ptr<Document> &pDocument) const;
 
1038
        virtual Value evaluate(const Document& pDocument) const;
1076
1039
        virtual const char *getOpName() const;
1077
1040
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1078
1041
 
1088
1051
    public:
1089
1052
        // virtuals from ExpressionNary
1090
1053
        virtual ~ExpressionToLower();
1091
 
        virtual intrusive_ptr<const Value> evaluate(
1092
 
            const intrusive_ptr<Document> &pDocument) const;
 
1054
        virtual Value evaluate(const Document& pDocument) const;
1093
1055
        virtual const char *getOpName() const;
1094
1056
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1095
1057
 
1105
1067
    public:
1106
1068
        // virtuals from ExpressionNary
1107
1069
        virtual ~ExpressionToUpper();
1108
 
        virtual intrusive_ptr<const Value> evaluate(
1109
 
            const intrusive_ptr<Document> &pDocument) const;
 
1070
        virtual Value evaluate(const Document& pDocument) const;
1110
1071
        virtual const char *getOpName() const;
1111
1072
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1112
1073
 
1122
1083
    public:
1123
1084
        // virtuals from ExpressionNary
1124
1085
        virtual ~ExpressionWeek();
1125
 
        virtual intrusive_ptr<const Value> evaluate(
1126
 
            const intrusive_ptr<Document> &pDocument) const;
 
1086
        virtual Value evaluate(const Document& pDocument) const;
1127
1087
        virtual const char *getOpName() const;
1128
1088
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1129
1089
 
1139
1099
    public:
1140
1100
        // virtuals from ExpressionNary
1141
1101
        virtual ~ExpressionYear();
1142
 
        virtual intrusive_ptr<const Value> evaluate(
1143
 
            const intrusive_ptr<Document> &pDocument) const;
 
1102
        virtual Value evaluate(const Document& pDocument) const;
1144
1103
        virtual const char *getOpName() const;
1145
1104
        virtual void addOperand(const intrusive_ptr<Expression> &pExpression);
1146
1105
 
1164
1123
        return 0;
1165
1124
    }
1166
1125
 
1167
 
    inline intrusive_ptr<const Value> ExpressionConstant::getValue() const {
 
1126
    inline Value ExpressionConstant::getValue() const {
1168
1127
        return pValue;
1169
1128
    }
1170
1129
 
1180
1139
    inline size_t ExpressionObject::getFieldCount() const {
1181
1140
        return _expressions.size();
1182
1141
    }
1183
 
 
1184
 
    inline ExpressionObject::BuilderPathSink::BuilderPathSink(
1185
 
        BSONObjBuilder *pB):
1186
 
        pBuilder(pB) {
1187
 
    }
1188
 
 
1189
 
    inline ExpressionObject::PathPusher::PathPusher(
1190
 
        vector<string> *pTheVPath, const string &s):
1191
 
        pvPath(pTheVPath) {
1192
 
        pvPath->push_back(s);
1193
 
    }
1194
 
 
1195
 
    inline ExpressionObject::PathPusher::~PathPusher() {
1196
 
        pvPath->pop_back();
1197
 
    }
1198
 
 
1199
1142
}