EvalType eval() { EvalType prod(1); iterator end_it(prime_factors.end()); for (iterator it(prime_factors.begin()); it != end_it; it++) { if (it->second) { if (it->second > 0) prod *= gsse::slow_power(it->first, it->second); else prod /= gsse::slow_power(it->first, -it->second); } } return prod; }
/** * gets the value associated with a key. * Returns (true, Value) if the entry is available. * Returns (false, undefined) otherwise. */ std::pair<bool, ValueType> get(const KeyType &key) const { // who owns the data? const size_t hashvalue = hasher(key); const size_t owningmachine = hashvalue % rpc.numprocs(); std::pair<bool, ValueType> retval; // if it is me, we can return it if (owningmachine == rpc.dc().procid()) { lock.lock(); typename storage_type::const_iterator iter = storage.find(hashvalue); retval.first = iter != storage.end(); if (retval.first) retval.second = iter->second; lock.unlock(); } else { retval = rpc.remote_request(owningmachine, &dht<KeyType,ValueType>::get, key); } return retval; }
const_iterator end() const { return const_iterator( storage.end(), storage.end() ); }
const_iterator begin() const { return const_iterator( storage.begin(), storage.end() ); }
iterator end() { return iterator( storage.end(), storage.end() ); }
iterator begin() { return iterator( storage.begin(), storage.end() ); }
static pointer get_pointer(index_type i, storage_type& stg) { pointer p=stg.end(); p.set_address(i); return p; }
duration elapsed() const { duration elapsed_ = duration::zero(); for (const_iterator it = cont_.begin(); it !=cont_.end(); ++it) elapsed_ += *it; return elapsed_; }