| | |
| | | return m_collectionEvents; |
| | | } |
| | | |
| | | unsigned int CHsmsPassive::getMaxCollectionEventId() const |
| | | { |
| | | unsigned int maxId = 0; |
| | | for (auto item : m_collectionEvents) { |
| | | if (item && item->getEventId() > maxId) { |
| | | maxId = item->getEventId(); |
| | | } |
| | | } |
| | | return maxId; |
| | | } |
| | | |
| | | int CHsmsPassive::deleteCollectionEvent(unsigned short CEID) |
| | | { |
| | | for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) { |
| | |
| | | return -1; |
| | | } |
| | | |
| | | int CHsmsPassive::addCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids) |
| | | { |
| | | if (getEvent((unsigned short)CEID) != nullptr) { |
| | | return -1; |
| | | } |
| | | auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids)); |
| | | for (auto rptid : rptids) { |
| | | SERVO::CReport* pReport = getReport((int)rptid); |
| | | if (pReport != nullptr) { |
| | | pEvent->addReport(pReport); |
| | | } |
| | | } |
| | | m_collectionEvents.push_back(pEvent); |
| | | return writeCollectionEventsToFile(m_strCollectionEventFilepath); |
| | | } |
| | | |
| | | int CHsmsPassive::updateCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids) |
| | | { |
| | | for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) { |
| | | if ((*iter)->getEventId() == CEID) { |
| | | delete (*iter); |
| | | auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids)); |
| | | for (auto rptid : rptids) { |
| | | SERVO::CReport* pReport = getReport((int)rptid); |
| | | if (pReport != nullptr) { |
| | | pEvent->addReport(pReport); |
| | | } |
| | | } |
| | | *iter = pEvent; |
| | | return writeCollectionEventsToFile(m_strCollectionEventFilepath); |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllCollectionEvent() |
| | | { |
| | | for (auto item : m_collectionEvents) { |