1 /* $Id: session.hpp,v 1.9 2005-10-25 11:48:30 adam Exp $
2 Copyright (c) 2005, Index Data.
10 //#include <stdexcept>
12 #include <boost/thread/mutex.hpp>
18 //typedef unsigned long type;
21 /// create new session with new unique id
23 boost::mutex::scoped_lock scoped_lock(m_mutex);
29 /// copy session including old id
30 Session(const Session &s) : m_id(s.m_id), m_close(s.m_close) {};
32 Session& operator=(const Session &s) {
41 bool operator<(const Session &s) const {
42 return m_id < s.m_id ? true : false;
45 unsigned long id() const {
49 bool is_closed() const {
53 /// mark session closed, can not be unset
58 bool operator == (Session &ses) const {
59 return ses.m_id == m_id;
63 unsigned long int m_id;
66 /// static mutex to lock static m_id
67 static boost::mutex m_mutex;
69 /// static m_id to make sure that there is only one id counter
70 static unsigned long int m_global_id;
80 * indent-tabs-mode: nil
81 * c-file-style: "stroustrup"
83 * vim: shiftwidth=4 tabstop=8 expandtab