| | |
| | | return m_reports; |
| | | } |
| | | |
| | | unsigned int CHsmsPassive::getMaxReportId() const |
| | | { |
| | | unsigned int maxId = 0; |
| | | for (auto item : m_reports) { |
| | | if (item && item->getReportId() > maxId) { |
| | | maxId = item->getReportId(); |
| | | } |
| | | } |
| | | return maxId; |
| | | } |
| | | |
| | | SERVO::CReport* CHsmsPassive::getReport(int rptid) |
| | | { |
| | | for (auto item : m_reports) { |
| | |
| | | return writeReportsToFile(m_strReportFilepath); |
| | | } |
| | | |
| | | int CHsmsPassive::addReport(int rptid, const std::vector<unsigned int>& vids) |
| | | { |
| | | if (getReport(rptid) != nullptr) { |
| | | return -1; |
| | | } |
| | | SERVO::CReport* pReport = new SERVO::CReport(rptid, vids); |
| | | for (auto vid : vids) { |
| | | SERVO::CVariable* pVariable = getVariable((int)vid); |
| | | if (pVariable != nullptr) { |
| | | pReport->addVariable(pVariable); |
| | | } |
| | | } |
| | | m_reports.push_back(pReport); |
| | | return writeReportsToFile(m_strReportFilepath); |
| | | } |
| | | |
| | | int CHsmsPassive::updateReport(int rptid, const std::vector<unsigned int>& vids) |
| | | { |
| | | for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) { |
| | | if ((*iter)->getReportId() == rptid) { |
| | | delete (*iter); |
| | | SERVO::CReport* pReport = new SERVO::CReport(rptid, vids); |
| | | for (auto vid : vids) { |
| | | SERVO::CVariable* pVariable = getVariable((int)vid); |
| | | if (pVariable != nullptr) { |
| | | pReport->addVariable(pVariable); |
| | | } |
| | | } |
| | | *iter = pReport; |
| | | return writeReportsToFile(m_strReportFilepath); |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllReport() |
| | | { |
| | | for (auto item : m_reports) { |