Bitstream Interpretation Library (BIL)  0.1
DeviceRegistryBS.cpp
Go to the documentation of this file.
1 
9 
10 using namespace bil;
11 
12 
13 void bil::writeBinary(const DeviceRegistry& data, std::ostream& outputStream)
14 {
15  writeBinary(data.m_idMap, outputStream);
16 }
17 
18 
19 void bil::readBinary(DeviceRegistry& data, std::istream& inputStream)
20 {
21  readBinary(data.m_idMap, inputStream);
22 
23  // clear name map
24  DeviceRegistry::NameMap_t& nameMap = data.m_nameMap;
25  nameMap.clear();
26 
27  // refill name map
28  DeviceRegistry::IDMap_t& idMap = data.m_idMap;
29  DeviceRegistry::IDMap_t::const_iterator it = idMap.begin();
30  DeviceRegistry::IDMap_t::const_iterator itEnd = idMap.end();
31  for (; it != itEnd; ++it)
32  nameMap.insert(std::make_pair(it->second, it->first));
33 }