summaryrefslogtreecommitdiffstats
path: root/include/framework/interface/Record.h
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2024-04-15 14:00:27 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2024-04-15 14:00:27 -0400
commitb25beb13773072c3b143842b45a7c32a1108f347 (patch)
tree97f490a4b8e527e6281df2cb1ee8f1fab84f1f8d /include/framework/interface/Record.h
parent2c69253f382cd0c6d41db57c45119c33c315bb9c (diff)
downloaddynamic-extension-b25beb13773072c3b143842b45a7c32a1108f347.tar.gz
Updated FSTrie to use const char * instead of std::string
Note: this requires the caller to manage the memory of the strings
Diffstat (limited to 'include/framework/interface/Record.h')
-rw-r--r--include/framework/interface/Record.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/framework/interface/Record.h b/include/framework/interface/Record.h
index d380f9b..19ccadd 100644
--- a/include/framework/interface/Record.h
+++ b/include/framework/interface/Record.h
@@ -132,6 +132,23 @@ struct Record {
}
};
+template<typename V>
+struct Record<const char*, V> {
+ const char* key;
+ V value;
+ size_t len;
+
+ inline bool operator<(const Record& other) const {
+ size_t n = std::min(len, other.len) + 1;
+ return strncmp(key, other.key, n) < 0;
+ }
+
+ inline bool operator==(const Record& other) const {
+ size_t n = std::min(len, other.len) + 1;
+ return strncmp(key, other.key, n) == 0;
+ }
+};
+
template <typename K, typename V, typename W>
struct WeightedRecord {
K key;