17 #ifndef JUBATUS_CORE_FV_CONVERTER_COUNTER_HPP_
18 #define JUBATUS_CORE_FV_CONVERTER_COUNTER_HPP_
23 #include "jubatus/util/data/unordered_map.h"
24 #include "../common/unordered_map.hpp"
28 namespace fv_converter {
33 typedef jubatus::util::data::unordered_map<T, double>
map_t;
34 typedef typename jubatus::util::data::unordered_map<T, double>
36 typedef typename jubatus::util::data::unordered_map<T, double>
40 return data_.count(key) != 0;
44 const_iterator it =
data_.find(key);
45 if (it ==
data_.end()) {
53 if (
data_.count(key) == 0) {
67 const_iterator
end()
const {
76 jubatus::util::data::unordered_map<T, double>().
swap(
data_);
80 for (const_iterator it = counts.
begin(); it != counts.
end(); ++it) {
81 (*this)[it->first] += it->second;
87 friend std::ostream& operator<<(std::ostream& os, const counter<T>& c) {
90 jubatus::util::data::unordered_map<T, double>::const_iterator it
94 os << it->first <<
":" << it->second <<
", ";
101 jubatus::util::data::unordered_map<T, double>
data_;
108 #endif // JUBATUS_CORE_FV_CONVERTER_COUNTER_HPP_
jubatus::util::data::unordered_map< T, double > data_
jubatus::util::data::unordered_map< std::string, double >::const_iterator const_iterator
const_iterator begin() const
void swap(weighted_point &p1, weighted_point &p2)
double operator[](const T &key) const
void add(const counter< T > &counts)
double & operator[](const T &key)
const_iterator end() const
jubatus::util::data::unordered_map< T, double > map_t
bool contains(const T &key) const
jubatus::util::data::unordered_map< std::string, double >::iterator iterator