serialize.cc (11075:f959b7f89d4d) | serialize.cc (11076:463a4b0f0dda) |
---|---|
1/* 2 * Copyright (c) 2015 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 --- 198 unchanged lines hidden (view full) --- 207 showParam(os, *it); 208 it++; 209 } 210 os << "\n"; 211} 212 213template <class T> 214void | 1/* 2 * Copyright (c) 2015 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 --- 198 unchanged lines hidden (view full) --- 207 showParam(os, *it); 208 it++; 209 } 210 os << "\n"; 211} 212 213template <class T> 214void |
215arrayParamOut(CheckpointOut &os, const string &name, const set<T> ¶m) 216{ 217 typename set<T>::const_iterator it = param.begin(); 218 219 os << name << "="; 220 if (param.size() > 0) 221 showParam(os, *it); 222 it++; 223 while (it != param.end()) { 224 os << " "; 225 showParam(os, *it); 226 it++; 227 } 228 os << "\n"; 229} 230 231template <class T> 232void |
|
215paramIn(CheckpointIn &cp, const string &name, T ¶m) 216{ 217 const string §ion(Serializable::currentSection()); 218 string str; 219 if (!cp.find(section, name, str) || !parseParam(str, param)) { 220 fatal("Can't unserialize '%s:%s'\n", section, name); 221 } 222} --- 140 unchanged lines hidden (view full) --- 363 fatal(err); 364 } 365 366 // assign parsed value to vector 367 param.push_back(scalar_value); 368 } 369} 370 | 233paramIn(CheckpointIn &cp, const string &name, T ¶m) 234{ 235 const string §ion(Serializable::currentSection()); 236 string str; 237 if (!cp.find(section, name, str) || !parseParam(str, param)) { 238 fatal("Can't unserialize '%s:%s'\n", section, name); 239 } 240} --- 140 unchanged lines hidden (view full) --- 381 fatal(err); 382 } 383 384 // assign parsed value to vector 385 param.push_back(scalar_value); 386 } 387} 388 |
389template <class T> 390void 391arrayParamIn(CheckpointIn &cp, const string &name, set<T> ¶m) 392{ 393 const string §ion(Serializable::currentSection()); 394 string str; 395 if (!cp.find(section, name, str)) { 396 fatal("Can't unserialize '%s:%s'\n", section, name); 397 } 398 param.clear(); |
|
371 | 399 |
400 vector<string> tokens; 401 tokenize(tokens, str, ' '); 402 403 for (vector<string>::size_type i = 0; i < tokens.size(); i++) { 404 T scalar_value; 405 if (!parseParam(tokens[i], scalar_value)) { 406 string err("could not parse \""); 407 408 err += str; 409 err += "\""; 410 411 fatal(err); 412 } 413 414 // assign parsed value to vector 415 param.insert(scalar_value); 416 } 417} 418 419 |
|
372void 373objParamIn(CheckpointIn &cp, const string &name, SimObject * ¶m) 374{ 375 const string §ion(Serializable::currentSection()); 376 if (!cp.findObj(section, name, param)) { 377 fatal("Can't unserialize '%s:%s'\n", section, name); 378 } 379} --- 38 unchanged lines hidden (view full) --- 418INSTANTIATE_PARAM_TEMPLATES(signed long long) 419INSTANTIATE_PARAM_TEMPLATES(unsigned long long) 420INSTANTIATE_PARAM_TEMPLATES(bool) 421INSTANTIATE_PARAM_TEMPLATES(float) 422INSTANTIATE_PARAM_TEMPLATES(double) 423INSTANTIATE_PARAM_TEMPLATES(string) 424INSTANTIATE_PARAM_TEMPLATES(Pixel) 425 | 420void 421objParamIn(CheckpointIn &cp, const string &name, SimObject * ¶m) 422{ 423 const string §ion(Serializable::currentSection()); 424 if (!cp.findObj(section, name, param)) { 425 fatal("Can't unserialize '%s:%s'\n", section, name); 426 } 427} --- 38 unchanged lines hidden (view full) --- 466INSTANTIATE_PARAM_TEMPLATES(signed long long) 467INSTANTIATE_PARAM_TEMPLATES(unsigned long long) 468INSTANTIATE_PARAM_TEMPLATES(bool) 469INSTANTIATE_PARAM_TEMPLATES(float) 470INSTANTIATE_PARAM_TEMPLATES(double) 471INSTANTIATE_PARAM_TEMPLATES(string) 472INSTANTIATE_PARAM_TEMPLATES(Pixel) 473 |
474// set is only used with strings and furthermore doesn't agree with Pixel 475template void 476arrayParamOut(CheckpointOut &, const string &, const set<string> &); 477template void 478arrayParamIn(CheckpointIn &, const string &, set<string> &); |
|
426 427///////////////////////////// 428 429/// Container for serializing global variables (not associated with 430/// any serialized object). 431class Globals : public Serializable 432{ 433 public: --- 184 unchanged lines hidden --- | 479 480///////////////////////////// 481 482/// Container for serializing global variables (not associated with 483/// any serialized object). 484class Globals : public Serializable 485{ 486 public: --- 184 unchanged lines hidden --- |