fix JSON reading
This commit is contained in:
@ -41,6 +41,7 @@
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
#include <rapidjson/ostreamwrapper.h>
|
||||
#include <rapidjson/error/en.h>
|
||||
#include <fstream>
|
||||
|
||||
using namespace rapidjson;
|
||||
@ -67,13 +68,13 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if&
|
||||
Document d;
|
||||
ParseResult ok = d.ParseStream(isw);
|
||||
if(ok) {
|
||||
Value& val = d[core_name];
|
||||
Value& val = d[core_name.c_str()];
|
||||
if(val.IsArray()){
|
||||
delays.reserve(val.Size());
|
||||
for(auto it:val.GetArray()){
|
||||
auto name = it["name"];
|
||||
auto size = it["size"];
|
||||
auto delay = it["delay"];
|
||||
for (auto it = val.Begin(); it != val.End(); ++it) {
|
||||
auto& name = (*it)["name"];
|
||||
auto& size = (*it)["size"];
|
||||
auto& delay = (*it)["delay"];
|
||||
if(delay.IsArray()) {
|
||||
delays.push_back(instr_desc{size.Get<unsigned>(), delay[0].Get<unsigned>(), delay[1].Get<unsigned>()});
|
||||
} else if(delay.Is<unsigned>()) {
|
||||
@ -86,7 +87,7 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if&
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LOG(ERR)<<"plugin cycle_estimate: could not parse in JSON file"<<endl;
|
||||
LOG(ERR)<<"plugin cycle_estimate: could not parse in JSON file at "<< ok.Offset()<<": "<<GetParseError_En(ok.Code())<<endl;
|
||||
return false;
|
||||
}
|
||||
} catch (runtime_error &e) {
|
||||
|
Reference in New Issue
Block a user