serialize.cc (7864:494b5426e70d) | serialize.cc (7948:20da8e9ed59f) |
---|---|
1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 187 unchanged lines hidden (view full) --- 196 showParam(os, param[0]); 197 for (typename vector<T>::size_type i = 1; i < size; ++i) { 198 os << " "; 199 showParam(os, param[i]); 200 } 201 os << "\n"; 202} 203 | 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 187 unchanged lines hidden (view full) --- 196 showParam(os, param[0]); 197 for (typename vector<T>::size_type i = 1; i < size; ++i) { 198 os << " "; 199 showParam(os, param[i]); 200 } 201 os << "\n"; 202} 203 |
204template <class T> 205void 206arrayParamOut(ostream &os, const string &name, const list<T> ¶m) 207{ 208 typename list<T>::const_iterator it = param.begin(); |
|
204 | 209 |
210 os << name << "="; 211 if (param.size() > 0) 212 showParam(os, *it); 213 it++; 214 while (it != param.end()) { 215 os << " "; 216 showParam(os, *it); 217 it++; 218 } 219 os << "\n"; 220} 221 |
|
205template <class T> 206void 207paramIn(Checkpoint *cp, const string §ion, const string &name, T ¶m) 208{ 209 string str; 210 if (!cp->find(section, name, str) || !parseParam(str, param)) { 211 fatal("Can't unserialize '%s:%s'\n", section, name); 212 } --- 108 unchanged lines hidden (view full) --- 321 fatal(err); 322 } 323 324 // assign parsed value to vector 325 param[i] = scalar_value; 326 } 327} 328 | 222template <class T> 223void 224paramIn(Checkpoint *cp, const string §ion, const string &name, T ¶m) 225{ 226 string str; 227 if (!cp->find(section, name, str) || !parseParam(str, param)) { 228 fatal("Can't unserialize '%s:%s'\n", section, name); 229 } --- 108 unchanged lines hidden (view full) --- 338 fatal(err); 339 } 340 341 // assign parsed value to vector 342 param[i] = scalar_value; 343 } 344} 345 |
346template <class T> |
|
329void | 347void |
348arrayParamIn(Checkpoint *cp, const string §ion, 349 const string &name, list<T> ¶m) 350{ 351 string str; 352 if (!cp->find(section, name, str)) { 353 fatal("Can't unserialize '%s:%s'\n", section, name); 354 } 355 param.clear(); 356 357 vector<string> tokens; 358 tokenize(tokens, str, ' '); 359 360 for (vector<string>::size_type i = 0; i < tokens.size(); i++) { 361 T scalar_value = 0; 362 if (!parseParam(tokens[i], scalar_value)) { 363 string err("could not parse \""); 364 365 err += str; 366 err += "\""; 367 368 fatal(err); 369 } 370 371 // assign parsed value to vector 372 param.push_back(scalar_value); 373 } 374} 375 376 377void |
|
330objParamIn(Checkpoint *cp, const string §ion, 331 const string &name, SimObject * ¶m) 332{ 333 if (!cp->findObj(section, name, param)) { 334 fatal("Can't unserialize '%s:%s'\n", section, name); 335 } 336} 337 --- 13 unchanged lines hidden (view full) --- 351template void \ 352arrayParamIn(Checkpoint *cp, const string §ion, \ 353 const string &name, type *param, unsigned size); \ 354template void \ 355arrayParamOut(ostream &os, const string &name, \ 356 const vector<type> ¶m); \ 357template void \ 358arrayParamIn(Checkpoint *cp, const string §ion, \ | 378objParamIn(Checkpoint *cp, const string §ion, 379 const string &name, SimObject * ¶m) 380{ 381 if (!cp->findObj(section, name, param)) { 382 fatal("Can't unserialize '%s:%s'\n", section, name); 383 } 384} 385 --- 13 unchanged lines hidden (view full) --- 399template void \ 400arrayParamIn(Checkpoint *cp, const string §ion, \ 401 const string &name, type *param, unsigned size); \ 402template void \ 403arrayParamOut(ostream &os, const string &name, \ 404 const vector<type> ¶m); \ 405template void \ 406arrayParamIn(Checkpoint *cp, const string §ion, \ |
359 const string &name, vector | 407 const string &name, vector<type> ¶m); \ 408template void \ 409arrayParamOut(ostream &os, const string &name, \ 410 const list<type> ¶m); \ 411template void \ 412arrayParamIn(Checkpoint *cp, const string §ion, \ 413 const string &name, list<type> ¶m); |
360 361INSTANTIATE_PARAM_TEMPLATES(char) 362INSTANTIATE_PARAM_TEMPLATES(signed char) 363INSTANTIATE_PARAM_TEMPLATES(unsigned char) 364INSTANTIATE_PARAM_TEMPLATES(signed short) 365INSTANTIATE_PARAM_TEMPLATES(unsigned short) 366INSTANTIATE_PARAM_TEMPLATES(signed int) 367INSTANTIATE_PARAM_TEMPLATES(unsigned int) --- 222 unchanged lines hidden --- | 414 415INSTANTIATE_PARAM_TEMPLATES(char) 416INSTANTIATE_PARAM_TEMPLATES(signed char) 417INSTANTIATE_PARAM_TEMPLATES(unsigned char) 418INSTANTIATE_PARAM_TEMPLATES(signed short) 419INSTANTIATE_PARAM_TEMPLATES(unsigned short) 420INSTANTIATE_PARAM_TEMPLATES(signed int) 421INSTANTIATE_PARAM_TEMPLATES(unsigned int) --- 222 unchanged lines hidden --- |