Utilities for file I/O.
More...
#include <cstdint>
#include <vector>
#include <string>
Go to the source code of this file.
|
namespace | sparta |
| Macros for handling exponential backoff.
|
|
|
std::string | sparta::utils::computeOutputFilename (const std::string &name, const std::string &location, uint32_t idx, const std::string &sim_name) |
| Computes a filename based on the input name replacing it with one of several variables.
|
|
std::string | sparta::utils::findArchitectureConfigFile (const std::vector< std::string > &search_dirs, const std::string &name) |
| Look up the location of an architecture config file fiven a searchpp dir and a name refering to a config file OR directory within that dir.
|
|
Utilities for file I/O.
Definition in file File.hpp.
◆ computeOutputFilename()
std::string sparta::utils::computeOutputFilename |
( |
const std::string & |
name, |
|
|
const std::string & |
location, |
|
|
uint32_t |
idx, |
|
|
const std::string & |
sim_name |
|
) |
| |
Computes a filename based on the input name replacing it with one of several variables.
- Todo:
- Create a file manager
- Note
- Supported variables in report names include:
- %l Location in device tree of report instantiation
- %i Index of report instantiation
- %p Host process ID
- %t Timestamp/Date
- %s Simulator name
◆ findArchitectureConfigFile()
std::string sparta::utils::findArchitectureConfigFile |
( |
const std::vector< std::string > & |
search_dirs, |
|
|
const std::string & |
name |
|
) |
| |
Look up the location of an architecture config file fiven a searchpp dir and a name refering to a config file OR directory within that dir.
- Exceptions
-
SpartaException | if input cannot resolve to yaml file. |
- Parameters
-
[in] | search_dir | Search directory |
[in] | name | Name of config file (with or without prefix) or architecture dir name within arch search dir. Subclasses can add more advanced resolution of arch names to config files |
- Returns
- Absolute path to architecture configuration file (x.yaml)
◆ ARCH_OPTIONS_RESOLUTION_RULES
constexpr char sparta::utils::ARCH_OPTIONS_RESOLUTION_RULES[] |
|
staticconstexpr |
Initial value:=
"<arch> may be specified as a '.yaml'/'.yml' file in <arch-search-dir>. The yaml suffix is "
"not required and will be appended automatically if matchines files exists. If a directory "
"with a name matching <arch> exists in <arch-search-dir>, then the search continues into "
"that directory for a file named <arch>.yaml (or .yml). If no such file is found or there "
"was no directory name matching <arch> then, architecture config resolution fails."
Definition at line 55 of file File.hpp.
◆ CERR_FILENAME
constexpr char sparta::utils::CERR_FILENAME[] = "2" |
|
staticconstexpr |
◆ COUT_FILENAME
constexpr char sparta::utils::COUT_FILENAME[] = "1" |
|
staticconstexpr |