59 lines
919 B
C
59 lines
919 B
C
|
/*
|
||
|
* This file is a part of CMSLU -- Content Management System like Unix
|
||
|
* and is not publicly distributed
|
||
|
*
|
||
|
* Copyright (c) 2008, Tomasz Sowa
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef headerfilesessioncontainer
|
||
|
#define headerfilesessioncontainer
|
||
|
|
||
|
|
||
|
#include <list>
|
||
|
#include <map>
|
||
|
#include <ctime>
|
||
|
#include "session.h"
|
||
|
#include "log.h"
|
||
|
|
||
|
|
||
|
class SessionContainer
|
||
|
{
|
||
|
public:
|
||
|
typedef std::list<Session> Table;
|
||
|
typedef Table::iterator Iterator;
|
||
|
|
||
|
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();
|
||
|
|
||
|
Iterator Begin();
|
||
|
Iterator End();
|
||
|
|
||
|
Session & Back();
|
||
|
|
||
|
bool PushBack(const Session & session);
|
||
|
Iterator FindById(long);
|
||
|
|
||
|
void DelFirstByTimeInterval(time_t interval);
|
||
|
|
||
|
void UpdateLastTime(Iterator iter, time_t new_time);
|
||
|
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif
|