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, CheckpointOut &cp) const |
112{ |
113 paramOut(cp, 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(cp, csprintf("%s.addr_%d", base, i), p->first); 119 paramOut(cp, csprintf("%s.symbol_%d", base, i), p->second); |
120 ++i; 121 } 122} 123 124void |
125SymbolTable::unserialize(const string &base, CheckpointIn &cp) |
126{ 127 clear(); 128 int size; |
129 paramIn(cp, base + ".size", size); |
130 for (int i = 0; i < size; ++i) { 131 Addr addr; 132 std::string symbol; 133 |
134 paramIn(cp, csprintf("%s.addr_%d", base, i), addr); 135 paramIn(cp, csprintf("%s.symbol_%d", base, i), symbol); |
136 insert(addr, symbol); 137 } 138} |