mirror of
https://github.com/nqrduck/LimeDriver.git
synced 2024-11-22 01:52:24 +00:00
Enhanced config JSON serialization
Updated the configuration dump function to serialize argument-value pairs into more detailed JSON objects. This now includes the argument's name, data type, value, and dimensions instead of just the value as a string. This richer output format allows for enhanced configuration clarity and downstream data processing. Improved type information and dimension data support handling various data types and array structures without information loss or ambiguity.
This commit is contained in:
parent
83f3221162
commit
5f323fea96
1 changed files with 21 additions and 3 deletions
|
@ -278,9 +278,23 @@ void dumpConfig(Config2HDFattr_t *config, size_t size) {
|
|||
ii_oupargs++;
|
||||
}
|
||||
|
||||
// Turn argument-value pairs to JSON objects
|
||||
/*
|
||||
|
||||
string arg;
|
||||
H5std_string Name;
|
||||
H5::DataType dType;
|
||||
void *Value;
|
||||
hsize_t dim;
|
||||
|
||||
std::cout << "\"" << arg << "\": \"";
|
||||
*/
|
||||
|
||||
// Turn arguments to JSON objects
|
||||
|
||||
std::cout << "\"" << arg << "\": {";
|
||||
|
||||
std::cout << "\"name\": \"" << config[i].Name << "\", ";
|
||||
std::cout << "\"type\": \"" << typeid(config[i]).name() << "\", ";
|
||||
std::cout << "\"value\": \"";
|
||||
|
||||
// Need to cast void* data pointer to the correct type
|
||||
// TODO: Do we lose precision here?
|
||||
|
@ -294,7 +308,11 @@ void dumpConfig(Config2HDFattr_t *config, size_t size) {
|
|||
std::cout << static_cast<char *>(config[i].Value);
|
||||
}
|
||||
|
||||
std::cout << "\"";
|
||||
std::cout << "\", ";
|
||||
|
||||
std::cout << "\"dim\": " << config[i].dim;
|
||||
|
||||
std::cout << "}";
|
||||
|
||||
if (i < size - 1) {
|
||||
std::cout << ",";
|
||||
|
|
Loading…
Reference in a new issue