diff options
Diffstat (limited to 'src/mongo/db/field_ref_set.h')
-rw-r--r-- | src/mongo/db/field_ref_set.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mongo/db/field_ref_set.h b/src/mongo/db/field_ref_set.h index c80e3714e69..71a48502739 100644 --- a/src/mongo/db/field_ref_set.h +++ b/src/mongo/db/field_ref_set.h @@ -31,6 +31,8 @@ #include <set> #include "mongo/base/disallow_copying.h" +#include "mongo/base/owned_pointer_vector.h" +#include "mongo/base/status.h" #include "mongo/db/field_ref.h" namespace mongo { @@ -70,7 +72,7 @@ namespace mongo { /** * Returns true if the field 'toInsert' can be added in the set without - * conflicts. Otwerwise returns false and fill in '*conflict' with the field 'toInsert' + * conflicts. Otherwise returns false and fill in '*conflict' with the field 'toInsert' * clashed with. * * There is no ownership transfer of 'toInsert'. The caller is responsible for @@ -80,6 +82,16 @@ namespace mongo { bool insert(const FieldRef* toInsert, const FieldRef** conflict); /** + * Fills the set with the supplied FieldRef*s + */ + void fillFrom(const std::vector<FieldRef*>& fields); + + /** + * Replace any existing conflicting FieldRef with the shortest (closest to root) one + */ + void keepShortest(const FieldRef* toInsert); + + /** * Find all inserted fields which conflict with the FieldRef 'toCheck' by the semantics * of 'insert', and add those fields to the 'conflicts' set. */ @@ -89,6 +101,11 @@ namespace mongo { _fieldSet.clear(); } + /** + * A debug/log-able string + */ + const std::string toString() const; + private: // A set of field_ref pointers, none of which is owned here. FieldSet _fieldSet; |