serialize.hh (13567:08896772e474) | serialize.hh (13757:79c0e02258d1) |
---|---|
1/* 2 * Copyright (c) 2015, 2018 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 460 unchanged lines hidden (view full) --- 469 showParam(os, param[0]); 470 for (unsigned i = 1; i < size; ++i) { 471 os << " "; 472 showParam(os, param[i]); 473 } 474 os << "\n"; 475} 476 | 1/* 2 * Copyright (c) 2015, 2018 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 460 unchanged lines hidden (view full) --- 469 showParam(os, param[0]); 470 for (unsigned i = 1; i < size; ++i) { 471 os << " "; 472 showParam(os, param[i]); 473 } 474 os << "\n"; 475} 476 |
477 | 477/** 478 * Extract values stored in the checkpoint, and assign them to the provided 479 * array container. 480 * 481 * @param cp The checkpoint to be parsed. 482 * @param name Name of the container. 483 * @param param The array container. 484 * @param size The expected number of entries to be extracted. 485 */ |
478template <class T> 479void 480arrayParamIn(CheckpointIn &cp, const std::string &name, 481 T *param, unsigned size) 482{ 483 const std::string §ion(Serializable::currentSection()); 484 std::string str; 485 if (!cp.find(section, name, str)) { --- 5 unchanged lines hidden (view full) --- 491 492 std::vector<std::string> tokens; 493 494 tokenize(tokens, str, ' '); 495 496 // Need this if we were doing a vector 497 // value.resize(tokens.size()); 498 | 486template <class T> 487void 488arrayParamIn(CheckpointIn &cp, const std::string &name, 489 T *param, unsigned size) 490{ 491 const std::string §ion(Serializable::currentSection()); 492 std::string str; 493 if (!cp.find(section, name, str)) { --- 5 unchanged lines hidden (view full) --- 499 500 std::vector<std::string> tokens; 501 502 tokenize(tokens, str, ' '); 503 504 // Need this if we were doing a vector 505 // value.resize(tokens.size()); 506 |
499 if (tokens.size() != size) { 500 fatal("Array size mismatch on %s:%s'\n", section, name); 501 } | 507 fatal_if(tokens.size() != size, 508 "Array size mismatch on %s:%s (Got %u, expected %u)'\n", 509 section, name, tokens.size(), size); |
502 503 for (std::vector<std::string>::size_type i = 0; i < tokens.size(); i++) { 504 // need to parse into local variable to handle vector<bool>, 505 // for which operator[] returns a special reference class 506 // that's not the same as 'bool&', (since it's a packed 507 // vector) 508 T scalar_value; 509 if (!parseParam(tokens[i], scalar_value)) { --- 173 unchanged lines hidden --- | 510 511 for (std::vector<std::string>::size_type i = 0; i < tokens.size(); i++) { 512 // need to parse into local variable to handle vector<bool>, 513 // for which operator[] returns a special reference class 514 // that's not the same as 'bool&', (since it's a packed 515 // vector) 516 T scalar_value; 517 if (!parseParam(tokens[i], scalar_value)) { --- 173 unchanged lines hidden --- |