| 415 | // ======================================================================= |
| 416 | |
| 417 | void FrontendData::parsePIDString(const std::string &reqPids, |
| 418 | const std::string &userPids, const bool add) { |
| 419 | if (reqPids.find("all") != std::string::npos || |
| 420 | reqPids.find("none") != std::string::npos) { |
| 421 | // all/none pids requested then 'remove' all used PIDS first |
| 422 | _filter.clear(); |
| 423 | if (reqPids.find("all") != std::string::npos) { |
| 424 | _filter.setAllPID(add); |
| 425 | } |
| 426 | } else { |
| 427 | const std::string pids = reqPids + userPids; |
| 428 | std::string::size_type begin = 0; |
| 429 | for (;; ) { |
| 430 | const std::string::size_type end = pids.find_first_of(",", begin); |
| 431 | if (end != std::string::npos) { |
| 432 | const std::string pid = pids.substr(begin, end - begin); |
| 433 | if (std::isdigit(pid[0]) != 0) { |
| 434 | _filter.setPID(std::stoi(pid), add); |
| 435 | } |
| 436 | begin = end + 1; |
| 437 | } else { |
| 438 | // Get the last one |
| 439 | if (begin < pids.size()) { |
| 440 | const std::string pid = pids.substr(begin, end - begin); |
| 441 | if (std::isdigit(pid[0]) != 0) { |
| 442 | _filter.setPID(std::stoi(pid), add); |
| 443 | } |
| 444 | } |
| 445 | break; |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | uint32_t FrontendData::getFrequency() const { |
| 452 | base::MutexLock lock(_mutex); |