design.h split up into filter.hpp package.hpp router.hpp session.hpp
[metaproxy-moved-to-github.git] / src / session.hpp
1
2 #ifndef SESSION_HPP
3 #define SESSION_HPP
4
5 #include <stdexcept>
6
7
8 #include <boost/thread/mutex.hpp>
9
10 namespace yp2 {
11
12   class Session 
13     {
14     public:
15       Session() : m_id(0){};
16       /// returns next id, global state of id protected by boost::mutex
17       long unsigned int id() {
18           boost::mutex::scoped_lock scoped_lock(m_mutex);
19           ++m_id;
20         return m_id;
21       };
22     private:
23       /// disabled because class is singleton
24       Session(const Session &);
25
26       /// disabled because class is singleton
27       Session& operator=(const Session &);
28
29       boost::mutex m_mutex;
30       unsigned long int m_id;
31       
32     };
33
34
35   
36 }
37
38 #endif
39 /*
40  * Local variables:
41  * c-basic-offset: 4
42  * indent-tabs-mode: nil
43  * End:
44  * vim: shiftwidth=4 tabstop=8 expandtab
45  */