void UpdateIndicies(Device const& device) { vector<DWORD>& channelIndicies = m_channelsIndicies[device.DeviceID()]; vector<string>const& channelStrings = m_channels[device.DeviceID()]; channelIndicies.clear(); // Create a list of strings from the device vector<string> sourceNames = device.GetChannelNames(); vectorStringIter sourceBegin = sourceNames.begin(); vectorStringIter sourceEnd = sourceNames.end(); // do a search for each name for(vectorStringIter iter = channelStrings.begin(); iter < channelStrings.end(); ++iter) { vectorStringIter item = find(sourceBegin, sourceEnd, *iter); if (item == sourceEnd) { UCSBUtility::LogError("Data Aggregator config failure: " "%s field does not exist in device %s", iter->c_str(), device.DisplayName().c_str()); } else { channelIndicies.push_back(item - sourceBegin); } } }
vector<DWORD> GetFields(Device const& device) { if (m_channels.find(device.DeviceID()) == m_channels.end()) { return vector<DWORD>(); } vector<DWORD>& channels = m_channelsIndicies[device.DeviceID()]; if (channels.size() == 0 && m_channels[device.DeviceID()].size() != 0) { UpdateIndicies(device); } return channels; }