|
|
| 248 |
return os; |
248 |
return os; |
| 249 |
} |
249 |
} |
| 250 |
|
250 |
|
| 251 |
static uint8_t |
251 |
//static uint8_t |
| 252 |
AsInt (std::string v) |
252 |
//AsInt (std::string v) |
| 253 |
{ |
253 |
//{ |
| 254 |
NS_LOG_FUNCTION_NOARGS (); |
254 |
// NS_LOG_FUNCTION_NOARGS (); |
| 255 |
std::istringstream iss; |
255 |
// std::istringstream iss; |
| 256 |
iss.str (v); |
256 |
// iss.str (v); |
| 257 |
uint8_t retval; |
257 |
// uint8_t retval; |
| 258 |
iss >> std::hex >> retval >> std::dec; |
258 |
// iss >> std::hex >> retval >> std::dec; |
| 259 |
return retval; |
259 |
// return retval; |
| 260 |
} |
260 |
//} |
| 261 |
|
261 |
|
| 262 |
std::istream& operator>> (std::istream& is, Address & address) |
262 |
std::istream& operator>> (std::istream& is, Address & address) |
| 263 |
{ |
263 |
{ |
|
|
| 269 |
std::string type = v.substr (0, firstDash-0); |
269 |
std::string type = v.substr (0, firstDash-0); |
| 270 |
std::string len = v.substr (firstDash+1, secondDash-(firstDash+1)); |
270 |
std::string len = v.substr (firstDash+1, secondDash-(firstDash+1)); |
| 271 |
|
271 |
|
| 272 |
address.m_type = AsInt (type); |
272 |
address.m_type = std::strtoul (type.c_str(), 0, 16); |
| 273 |
address.m_len = AsInt (len); |
273 |
address.m_len = std::strtoul (len.c_str(), 0, 16); |
| 274 |
NS_ASSERT (address.m_len <= Address::MAX_SIZE); |
274 |
NS_ASSERT (address.m_len <= Address::MAX_SIZE); |
| 275 |
|
275 |
|
| 276 |
std::string::size_type col = secondDash + 1; |
276 |
std::string::size_type col = secondDash + 1; |
|
|
| 282 |
if (next == std::string::npos) |
282 |
if (next == std::string::npos) |
| 283 |
{ |
283 |
{ |
| 284 |
tmp = v.substr (col, v.size ()-col); |
284 |
tmp = v.substr (col, v.size ()-col); |
| 285 |
address.m_data[i] = AsInt (tmp); |
285 |
address.m_data[i] = std::strtoul (tmp.c_str(), 0, 16); |
| 286 |
break; |
286 |
break; |
| 287 |
} |
287 |
} |
| 288 |
else |
288 |
else |
| 289 |
{ |
289 |
{ |
| 290 |
tmp = v.substr (col, next-col); |
290 |
tmp = v.substr (col, next-col); |
| 291 |
address.m_data[i] = AsInt (tmp); |
291 |
address.m_data[i] = std::strtoul (tmp.c_str(), 0, 16); |
| 292 |
col = next + 1; |
292 |
col = next + 1; |
| 293 |
} |
293 |
} |
| 294 |
} |
294 |
} |