Represents name of a bank/register/field.
More...
#include <hierarchical-object-name.h>
|
| static constexpr void | validate_name (std::string_view name) |
| | Validates the format of a name, ensuring it adheres to specific rules.
|
| |
Represents name of a bank/register/field.
The name should be aligned with the hierarchical object name format:
- The name must not be empty. An exception is thrown if the name is empty.
- The name must begin with an alphabetic character.
- The base name (without array notation) must consist only of alphanumeric characters and underscores ('_').
- The array notation is enclosed in square brackets ('[' and ']').
◆ HierarchicalObjectName() [1/4]
| constexpr simics::detail::HierarchicalObjectName::HierarchicalObjectName |
( |
| ) |
|
|
inlineconstexprnoexcept |
◆ HierarchicalObjectName() [2/4]
| constexpr simics::detail::HierarchicalObjectName::HierarchicalObjectName |
( |
const HierarchicalObjectName & |
other | ) |
|
|
constexprdefaultnoexcept |
◆ HierarchicalObjectName() [3/4]
| constexpr simics::detail::HierarchicalObjectName::HierarchicalObjectName |
( |
const_pointer |
s, |
|
|
size_type |
count |
|
) |
| |
|
inlineconstexpr |
◆ HierarchicalObjectName() [4/4]
| constexpr simics::detail::HierarchicalObjectName::HierarchicalObjectName |
( |
const_pointer |
s | ) |
|
|
inlineconstexpr |
◆ array_str()
| constexpr std::string_view simics::detail::HierarchicalObjectName::array_str |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
- The array information without base name
◆ arrayNamesToOffsets()
| std::map< std::string, size_t > simics::detail::HierarchicalObjectName::arrayNamesToOffsets |
( |
size_t |
width | ) |
const |
|
inline |
Generates a mapping of array names to their corresponding memory offsets.
This function calculates the offsets for array elements based on their names and dimensions, using the specified width for the innermost dimension's stride. It returns a map where each key is a string representing the name of an array element, and each value is the calculated offset for that element.
- Parameters
-
| width | The width used as the stride for the innermost dimension. |
- Returns
- A map where each key is a string representing an array element's name, and each value is the calculated offset for that element.
◆ arraySizesAndStrides()
| std::vector< std::pair< size_t, size_t > > simics::detail::HierarchicalObjectName::arraySizesAndStrides |
( |
| ) |
const |
|
inline |
Parses a string representation of array dimensions to extract sizes and strides.
This function processes a string obtained from array_str() to determine the sizes and strides of array dimensions, returning them as a vector of pairs. Each pair consists of a size and a stride for a dimension.
- Returns
- A vector of pairs, where each pair contains the size and stride of a dimension.
- Exceptions
-
| std::logic_error | if the input string is malformed or contains invalid dimensions. |
◆ base_name()
| constexpr std::string_view simics::detail::HierarchicalObjectName::base_name |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
- The base name without array information
◆ validate_name()
| static constexpr void simics::detail::HierarchicalObjectName::validate_name |
( |
std::string_view |
name | ) |
|
|
inlinestaticconstexpr |
Validates the format of a name, ensuring it adheres to specific rules.
This constexpr function checks the validity of a name by enforcing the following constraints:
- The name must not be empty. An exception is thrown if the name is empty.
- The name must begin with an alphabetic character. If the first character is not alphabetic, an exception is thrown with a descriptive error message.
- The base name must consist only of alphanumeric characters and underscores ('_'). Any other character will result in an exception being thrown, indicating the invalid character.
The documentation for this class was generated from the following file: