#include "IPTable.h" IPTable::IPTable() { storage.clear(); } IPTable::IPTable(const IPTable& obj) { for (auto& ele : obj.storage) storage.insert(ele); } void IPTable::Appened(DateTime expr_time, IPList list) { storage.insert(std::pair(expr_time, list)); } void IPTable::Update() { DateTime time = DateTime::Now(); for (auto it = storage.begin(); it != storage.end(); it++) if ((*it).first.GetTimeStamp() <= time.GetTimeStamp()) storage.erase(it); return; } bool IPTable::IPExist(std::string ip) { for (auto& ele : storage) if (ele.second.Exist(ip)) return true; return false; }