winix/core/sessioncontainer.h

64 lines
1015 B
C++
Executable File

/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfilecmslucoresessioncontainer
#define headerfilecmslucoresessioncontainer
#include <list>
#include <map>
#include <ctime>
#include "session.h"
class SessionContainer
{
public:
typedef std::list<Session> Table;
typedef Table::iterator Iterator;
typedef Table::size_type TableSize;
typedef std::map<long, Iterator> IndexId;
typedef std::multimap<time_t, Iterator> IndexTime;
private:
Table table;
IndexId index_id;
IndexTime index_time;
void DelFromIdIndex(Iterator iter);
public:
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