3 #include "stg/user_property.h"
7 void TariffUsersTable::UpdateSensors(Sensors & sensors) const
9 std::map<std::string, size_t> data;
11 int handle = users.OpenSearch();
16 while (!users.SearchNext(handle, &user))
18 std::string tariffName(user->GetProperty().tariffName.ConstData());
19 std::map<std::string, size_t>::iterator it;
20 it = data.lower_bound(tariffName);
21 if (it == data.end() ||
22 it->first != tariffName)
24 data.insert(it, std::make_pair(tariffName, 1));
32 users.CloseSearch(handle);
35 OID prefixOid(prefix);
37 std::map<std::string, size_t>::const_iterator it(data.begin());
38 while (it != data.end())
40 sensors[prefixOid.copyWithSuffix(2, idx)] = new ConstSensor<std::string>(it->first);
41 sensors[prefixOid.copyWithSuffix(3, idx)] = new ConstSensor<int>(it->second);