8 #include <unordered_map>
10 #include "common/datatypes/Value.h"
15 std::unordered_map<std::string, Value> kvs;
19 Map(
Map&&) noexcept =
default;
20 explicit Map(std::unordered_map<std::string, Value> values) {
21 kvs = std::move(values);
24 Map& operator=(
const Map& rhs) {
31 Map& operator=(
Map&& rhs) noexcept {
35 kvs = std::move(rhs.kvs);
49 std::string toString()
const;
51 bool operator==(
const Map& rhs)
const {
52 return kvs == rhs.kvs;
55 bool contains(
const Value& value)
const {
59 return kvs.count(value.getStr()) != 0;
62 const Value& at(
const std::string& key)
const {
63 auto iter = kvs.find(key);
64 if (iter == kvs.end()) {
65 return Value::kNullUnknownProp;
75 inline std::ostream& operator<<(std::ostream& os,
const Map& m) {
76 return os << m.toString();
83 struct hash<nebula::Map> {
84 std::size_t operator()(
const nebula::Map& m)
const noexcept;