Пример #1
0
  virtual void allProductsReady() {
    std::vector<QoSCorrections> qosCorrectionsVector =
        Consumer<QoSCorrections>::getConsumables();
    QoSCorrections corrections;

    uint64_t receivedCententionNum = 0;
    for (QoSCorrections product : qosCorrectionsVector) {
      receivedCententionNum += product.size();
      for (slave::QoSCorrection correction : product) {
        if (checkForDuplicates(correction, corrections)) {
          // Filter out duplicated value.
          continue;
        }
        corrections.push_back(correction);
      }
    }

    SERENITY_LOG(INFO) << "Received " << corrections.size() << " corrections";
    produce(corrections);
    return;
  }
Пример #2
0
    virtual Try<Nothing> syncConsume(
        const std::vector<QoSCorrections> products) {
        QoSCorrections corrections;

        uint64_t receivedCententionNum = 0;
        for (QoSCorrections product : products) {
            receivedCententionNum += product.size();
            for (slave::QoSCorrection correction : product) {
                if (checkForDuplicates(correction, corrections)) {
                    // Filter out duplicated value.
                    continue;
                }

                corrections.push_back(correction);
            }
        }

        SERENITY_LOG(INFO) << "Received " << receivedCententionNum << " corrections"
                           << " and merged to " << corrections.size() << " corrections.";

        produce(corrections);

        return Nothing();
    }