1 // Copyright (C) 2018 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
6 #include "metadata.hpp"
8 #include "util/assert.hpp"
18 util::any& Metadata::operator[](const MetadataId& id)
20 ASSERT(nullptr != id);
24 bool Metadata::contains(const MetadataId& id) const
26 ASSERT(nullptr != id);
27 return m_data.end() != m_data.find(id);
30 void Metadata::erase(const MetadataId& id)
35 Metadata::MetadataRange Metadata::all()
37 return util::toRange(m_data);
40 Metadata::MetadataCRange Metadata::all() const
42 return util::toRange(m_data);
45 void Metadata::copyFrom(const Metadata& data)
50 std::size_t Metadata::IdHash::operator()(const MetadataId& id) const
52 return std::hash<decltype(MetadataId::m_id)>()(id.m_id);
55 MetadataId::MetadataId(void* id):
58 ASSERT(nullptr != m_id);
61 bool MetadataId::operator==(const MetadataId& other) const
63 return m_id == other.m_id;
66 bool MetadataId::operator!=(const MetadataId& other) const
68 return m_id != other.m_id;
71 bool MetadataId::isNull() const
73 return nullptr == m_id;
76 bool operator==(std::nullptr_t, const MetadataId& other)
78 return other.isNull();
81 bool operator==(const MetadataId& other, std::nullptr_t)
83 return other.isNull();
86 bool operator!=(std::nullptr_t, const MetadataId& other)
88 return !other.isNull();
91 bool operator!=(const MetadataId& other, std::nullptr_t)
93 return !other.isNull();