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;
--- 94 unchanged lines hidden (view full) ---
103 }
104
105 file.close();
106
107 return true;
108}
109
110void
111SymbolTable::serialize(const string &base, ostream &os)
112{
113 paramOut(os, base + ".size", addrTable.size());
114
115 int i = 0;
116 ATable::const_iterator p, end = addrTable.end();
117 for (p = addrTable.begin(); p != end; ++p) {
118 paramOut(os, csprintf("%s.addr_%d", base, i), p->first);
119 paramOut(os, csprintf("%s.symbol_%d", base, i), p->second);
120 ++i;
121 }
122}
123
124void
125SymbolTable::unserialize(const string &base, Checkpoint *cp,
126 const string §ion)
127{
128 clear();
129 int size;
130 paramIn(cp, section, base + ".size", size);
131 for (int i = 0; i < size; ++i) {
132 Addr addr;
133 std::string symbol;
134
135 paramIn(cp, section, csprintf("%s.addr_%d", base, i), addr);
136 paramIn(cp, section, csprintf("%s.symbol_%d", base, i), symbol);
137 insert(addr, symbol);
138 }
139}
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;
--- 94 unchanged lines hidden (view full) ---
103 }
104
105 file.close();
106
107 return true;
108}
109
110void
111SymbolTable::serialize(const string &base, ostream &os)
112{
113 paramOut(os, base + ".size", addrTable.size());
114
115 int i = 0;
116 ATable::const_iterator p, end = addrTable.end();
117 for (p = addrTable.begin(); p != end; ++p) {
118 paramOut(os, csprintf("%s.addr_%d", base, i), p->first);
119 paramOut(os, csprintf("%s.symbol_%d", base, i), p->second);
120 ++i;
121 }
122}
123
124void
125SymbolTable::unserialize(const string &base, Checkpoint *cp,
126 const string §ion)
127{
128 clear();
129 int size;
130 paramIn(cp, section, base + ".size", size);
131 for (int i = 0; i < size; ++i) {
132 Addr addr;
133 std::string symbol;
134
135 paramIn(cp, section, csprintf("%s.addr_%d", base, i), addr);
136 paramIn(cp, section, csprintf("%s.symbol_%d", base, i), symbol);
137 insert(addr, symbol);
138 }
139}