added: SessionContainer special container used by SessionManager

sessions are indexed by id and time (last used time)
changed: old sessions are deleted
       parameter: session_max_iddle in the config file
added: function 'who'


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@483 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-01-31 06:53:36 +00:00
parent a48766871d
commit 7d73d048c8
29 changed files with 540 additions and 61 deletions

58
core/sessioncontainer.h Executable file
View File

@@ -0,0 +1,58 @@
/*
* 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