aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/derived-path-map.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/derived-path-map.hh')
-rw-r--r--src/libstore/derived-path-map.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libstore/derived-path-map.hh b/src/libstore/derived-path-map.hh
index 9ce58206e..4a2c90733 100644
--- a/src/libstore/derived-path-map.hh
+++ b/src/libstore/derived-path-map.hh
@@ -48,6 +48,8 @@ struct DerivedPathMap {
* The map of the root node.
*/
Map childMap;
+
+ DECLARE_CMP(ChildNode);
};
/**
@@ -60,6 +62,8 @@ struct DerivedPathMap {
*/
Map map;
+ DECLARE_CMP(DerivedPathMap);
+
/**
* Find the node for `k`, creating it if needed.
*
@@ -68,6 +72,27 @@ struct DerivedPathMap {
* by changing this node.
*/
ChildNode & ensureSlot(const SingleDerivedPath & k);
+
+ /**
+ * Like `ensureSlot` but does not create the slot if it doesn't exist.
+ *
+ * Read the entire description of `ensureSlot` to understand an
+ * important caveat here that "have slot" does *not* imply "key is
+ * set in map". To ensure a key is set one would need to get the
+ * child node (with `findSlot` or `ensureSlot`) *and* check the
+ * `ChildNode::value`.
+ */
+ ChildNode * findSlot(const SingleDerivedPath & k);
};
+
+DECLARE_CMP_EXT(
+ template<>,
+ DerivedPathMap<std::set<std::string>>::,
+ DerivedPathMap<std::set<std::string>>);
+DECLARE_CMP_EXT(
+ template<>,
+ DerivedPathMap<std::set<std::string>>::ChildNode::,
+ DerivedPathMap<std::set<std::string>>::ChildNode);
+
}