Program Listing for File dictionary.h
↰ Return to documentation for file (include\metadata\dictionary.h
)
/******************************************************************************
(c) Intel Corporation.
This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.
This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.
******************************************************************************/
#pragma once
#include <cstdint>
#include <map>
#include <string>
#include <variant>
namespace gpa {
namespace serialization {
namespace metadata {
class DictionaryVisitor
{
public:
virtual void OnStringEntry(char const* key, char const* value) = 0;
virtual void OnIntegerEntry(char const* key, int64_t value) = 0;
virtual void OnBoolEntry(char const* key, bool value) = 0;
};
class Dictionary
{
public:
bool operator==(Dictionary const& other) const;
bool operator!=(Dictionary const& other) const;
void Set(char const* name, char const* value);
void Set(char const* name, std::string const& value);
void Set(char const* name, int64_t value);
void Set(char const* name, bool value);
void VisitAll(DictionaryVisitor* visitor) const;
private:
typedef std::string KeyType;
typedef std::variant<int64_t, std::string, bool> ValueType;
std::map<KeyType, ValueType> mPairs;
};
} // namespace metadata
} // namespace serialization
} // namespace gpa