/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2008-2010, Tomasz Sowa * All rights reserved. * */ #ifndef headerfilecmslucoresessioncontainer #define headerfilecmslucoresessioncontainer #include #include #include #include "session.h" #include "lastcontainer.h" #include "request.h" class SessionContainer { public: // when deleting Sessions you should set request.session into the session object // this allows to delete plugins session data // because a session object has plugin_data object // and in its destructor the plugin.Call(WINIX_SESSION_REMOVE) is called typedef std::list Table; typedef Table::iterator Iterator; typedef Table::size_type TableSize; typedef std::map IndexId; typedef std::multimap IndexTime; void SetLastContainer(LastContainer * plast_container); private: LastContainer * last_container; Table table; IndexId index_id; IndexTime index_time; Request * request; void DelFromIdIndex(Iterator iter); // in FreeBSD implementation (GCC) list::size() has linear complexity // so we use our own table_size with O(1) size_t table_size; public: SessionContainer(); void SetRequest(Request * prequest); void Clear(); TableSize Size(); Iterator Begin(); Iterator End(); Session & Back(); bool PushBack(const Session & session); Iterator FindById(long); void DelFirstByTimeInterval(time_t interval, bool skip_remember_flag = true); void UpdateLastTime(Iterator iter, time_t new_time); }; #endif