C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
common-types.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2022 Intel Corporation
5
6 This software and the related documents are Intel copyrighted materials, and
7 your use of them is governed by the express license under which they were
8 provided to you ("License"). Unless the License provides otherwise, you may
9 not use, modify, copy, publish, distribute, disclose or transmit this software
10 or the related documents without Intel's prior written permission.
11
12 This software and the related documents are provided as is, with no express or
13 implied warranties, other than those that are expressly stated in the License.
14*/
15
16#ifndef SIMICS_TYPE_COMMON_TYPES_H
17#define SIMICS_TYPE_COMMON_TYPES_H
18
19#include <string_view>
20
22
23namespace simics {
24namespace detail {
25
28 public:
29 constexpr ConstSizeT(size_t value = 0) // NOLINT(runtime/explicit)
30 : value_(value) {}
31 constexpr operator size_t () const {return value_;}
32
33 private:
34 size_t value_;
35};
36
37} // namespace detail
38
41
43using Description = std::string_view;
44
47
50
53
57
60} // namespace simics
61
62// Define the hash specialization for ConstSizeT
63namespace std {
64template <>
65struct hash<simics::detail::ConstSizeT> {
66 size_t operator()(const simics::detail::ConstSizeT &obj) const {
67 return hash<size_t>{}(static_cast<size_t>(obj));
68 }
69};
70} // namespace std
71
72#endif
Literal type that extends size_t type.
Definition: common-types.h:27
constexpr ConstSizeT(size_t value=0)
Definition: common-types.h:29
Definition: hierarchical-object-name.h:37
Definition: attr-value.h:23
std::string_view Description
Type used to describe a resource.
Definition: common-types.h:43
Definition: common-types.h:63
size_t operator()(const simics::detail::ConstSizeT &obj) const
Definition: common-types.h:66