42a43
> #include "base/annotate.hh"
180a182,196
> template <class T>
> void
> arrayParamOut(ostream &os, const std::string &name,
> const std::vector<T> &param)
> {
> int size = param.size();
> os << name << "=";
> if (size > 0)
> showParam(os, param[0]);
> for (int i = 1; i < size; ++i) {
> os << " ";
> showParam(os, param[i]);
> }
> os << "\n";
> }
181a198
>
253a271,279
> template <class T>
> void
> arrayParamIn(Checkpoint *cp, const std::string &section,
> const std::string &name, std::vector<T> &param)
> {
> std::string str;
> if (!cp->find(section, name, str)) {
> fatal("Can't unserialize '%s:%s'\n", section, name);
> }
254a281,314
> // code below stolen from VectorParam<T>::parse().
> // it would be nice to unify these somehow...
>
> vector<string> tokens;
>
> tokenize(tokens, str, ' ');
>
> // Need this if we were doing a vector
> // value.resize(tokens.size());
>
> param.resize(tokens.size());
>
> for (int i = 0; i < tokens.size(); i++) {
> // need to parse into local variable to handle vector<bool>,
> // for which operator[] returns a special reference class
> // that's not the same as 'bool&', (since it's a packed
> // vector)
> T scalar_value;
> if (!parseParam(tokens[i], scalar_value)) {
> string err("could not parse \"");
>
> err += str;
> err += "\"";
>
> fatal(err);
> }
>
> // assign parsed value to vector
> param[i] = scalar_value;
> }
> }
>
>
>
276c336,342
< const std::string &name, type *param, int size);
---
> const std::string &name, type *param, int size); \
> template void \
> arrayParamOut(ostream &os, const std::string &name, \
> const std::vector<type> &param); \
> template void \
> arrayParamIn(Checkpoint *cp, const std::string &section, \
> const std::string &name, std::vector<type> &param);
345a412
> Annotate::annotations.serialize(outstream);
361c428
<
---
> Annotate::annotations.unserialize(cp);