void
TimeSeriesProbeBus::onMeasurement(const wns::simulator::Time& _time,
                               const double& _value,
                               const IContext& _context)
{
    LogEntry entry;
    entry.value = _value;
    entry.time  = _time;

    for(std::vector<std::string>::const_iterator it = contextKeys.begin();
        it != contextKeys.end();
        ++it)
    {
        if(_context.knows(*it))
        {
            if(_context.isInt(*it))
            {
                entry.context.push_back(wns::Ttos(_context.getInt(*it)));
            }
            else if(_context.isString(*it))
            {
                entry.context.push_back(_context.getString(*it));
            }
        }
    }

    // Store value for later output
    logQueue.push_back(entry);
}
Ejemplo n.º 2
0
bool
ProbeBusStub::accepts(const wns::simulator::Time& /*timestamp*/,
                      const IContext& reg)
{
    if(providerName == "")
    {
        return true;
    }

    if(reg.getInt(providerName) == filter)
    {
        return true;
    }
    else
    {
        return false;
    }
}