Example #1
0
bool 
EventSender<EvType>::removeFrom(Registry& container, TListener* lisnr)
{
    // Find iterator for listener to be removed
    typename Registry::iterator removeIter
        = std::find(container.begin(), container.end(), lisnr);
    if ( removeIter != container.end() ) 
    {
        container.erase(removeIter);
       theseLogs.logNdebug(1,"%s removed from list",lisnrID(lisnr).c_str());
        return true;
    }
    
    // listener not found anywhere
    theseLogs.logN(1,"%s  NOT found in list",lisnrID(lisnr).c_str());
    return false;
}
Example #2
0
void Registry::merge(const Registry &other)
{
    for (const_iterator i = other.begin(); i != other.end(); i++)
    {
        boost::ptr_map<std::string, Statistic>::iterator pos = statistics.find(i->getName());
        if (pos == statistics.end())
        {
            Statistic *clone = i->clone();
            std::string name = clone->getName();
            statistics.insert(name, clone);
        }
        else
        {
            pos->second->merge(*i);
        }
    }
}