summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/match_details.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2013-07-29 11:45:51 -0400
committerEliot Horowitz <eliot@10gen.com>2013-07-29 14:40:31 -0400
commit9db572c59ee80375e0c4b6547a0a883bd175036b (patch)
tree702aa0608f1054b43ee6cd93e6d427d086e83fec /src/mongo/db/matcher/match_details.h
parent47edf5d5590798986ea721e06a3595cad381f196 (diff)
downloadmongo-9db572c59ee80375e0c4b6547a0a883bd175036b.tar.gz
some MatchDetails peformance improvements and move more impl to .cpp
Diffstat (limited to 'src/mongo/db/matcher/match_details.h')
-rw-r--r--src/mongo/db/matcher/match_details.h38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/mongo/db/matcher/match_details.h b/src/mongo/db/matcher/match_details.h
index 5acf7b4948b..6c40436d5c9 100644
--- a/src/mongo/db/matcher/match_details.h
+++ b/src/mongo/db/matcher/match_details.h
@@ -18,6 +18,8 @@
#pragma once
+#include <boost/scoped_ptr.hpp>
+
#include <string>
namespace mongo {
@@ -26,33 +28,35 @@ namespace mongo {
class MatchDetails {
public:
MatchDetails();
+
void resetOutput();
+
+ // for debugging only
std::string toString() const;
- /** Request that an elemMatchKey be recorded. */
- void requestElemMatchKey() { _elemMatchKeyRequested = true; }
+ // relating to whether or not we had to load the full record
- bool needRecord() const { return _elemMatchKeyRequested; }
+ void setLoadedRecord( bool loadedRecord ) { _loadedRecord = loadedRecord; }
bool hasLoadedRecord() const { return _loadedRecord; }
- bool hasElemMatchKey() const { return _elemMatchKeyFound; }
- std::string elemMatchKey() const {
- verify( hasElemMatchKey() );
- return _elemMatchKey;
- }
- void setLoadedRecord( bool loadedRecord ) { _loadedRecord = loadedRecord; }
- void setElemMatchKey( const std::string &elemMatchKey ) {
- if ( _elemMatchKeyRequested ) {
- _elemMatchKeyFound = true;
- _elemMatchKey = elemMatchKey;
- }
- }
+ // this name is wrong
+
+ bool needRecord() const { return _elemMatchKeyRequested; }
+
+ // if we need to store the offset into an array where we found the match
+
+ /** Request that an elemMatchKey be recorded. */
+ void requestElemMatchKey() { _elemMatchKeyRequested = true; }
+
+ bool hasElemMatchKey() const;
+ std::string elemMatchKey() const;
+
+ void setElemMatchKey( const std::string &elemMatchKey );
private:
bool _loadedRecord;
bool _elemMatchKeyRequested;
- bool _elemMatchKeyFound;
- std::string _elemMatchKey;
+ boost::scoped_ptr<std::string> _elemMatchKey;
};
}