Add Config Class for Benchmark Configuration Management

This commit introduces a new `Config` class, designed to manage and store configuration settings related to the benchmark run. The class contains two key fields:

1. `agentBenchmarkConfigPath`: The path to the agent's benchmark configuration file.
2. `host`: The address of the host where the benchmark is running.

The class includes methods for serialization and deserialization, allowing easy conversion between `Config` objects and JSON maps.

Documentation comments have also been added for better code readability and understanding.
This commit is contained in:
hunteraraujo
2023-09-20 13:00:22 -07:00
parent c72a35e92e
commit 39f8ae515b

View File

@@ -0,0 +1,41 @@
/// `Config` holds configuration settings related to the benchmark run.
///
/// It contains the path to the benchmark configuration for the agent and
/// the host address where the benchmark is running.
class Config {
/// The path to the configuration file for the agent's benchmark.
/// This is typically a JSON file specifying various settings and parameters
/// for the benchmark run.
final String agentBenchmarkConfigPath;
/// The host address where the benchmark is running.
/// This could be a local or remote server address.
final String host;
/// Constructs a new `Config` instance.
///
/// [agentBenchmarkConfigPath]: The path to the agent's benchmark configuration file.
/// [host]: The host address where the benchmark is running.
Config({
required this.agentBenchmarkConfigPath,
required this.host,
});
/// Creates a `Config` instance from a map.
///
/// [json]: A map containing key-value pairs corresponding to `Config` fields.
///
/// Returns a new `Config` populated with values from the map.
factory Config.fromJson(Map<String, dynamic> json) => Config(
agentBenchmarkConfigPath: json['agent_benchmark_config_path'],
host: json['host'],
);
/// Converts the `Config` instance to a map.
///
/// Returns a map containing key-value pairs corresponding to `Config` fields.
Map<String, dynamic> toJson() => {
'agent_benchmark_config_path': agentBenchmarkConfigPath,
'host': host,
};
}