~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session_list.h

  • Committer: tdavies
  • Date: 2010-10-13 01:29:12 UTC
  • mto: (1842.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1843.
  • Revision ID: tdavies@molly-20101013012912-vl72hg1y99qgqz5m
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list 

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_SESSION_CACHE_H
21
 
#define DRIZZLED_SESSION_CACHE_H
 
20
#ifndef DRIZZLED_SESSION_LIST_H
 
21
#define DRIZZLED_SESSION_LIST_H
22
22
 
23
 
#include "drizzled/session.h"
24
 
#include <list>
 
23
#include <vector>
25
24
 
26
25
namespace drizzled
27
26
{
28
27
 
29
28
class Session;
30
 
 
31
 
namespace session
32
 
{
33
 
 
34
 
class Cache 
35
 
{
36
 
public:
37
 
  typedef std::list<Session::shared_ptr> list;
38
 
 
39
 
  static inline Cache &singleton()
40
 
  {
41
 
    static Cache open_cache;
42
 
 
43
 
    return open_cache;
44
 
  }
45
 
 
46
 
  list &getCache()
47
 
  {
48
 
    return cache;
49
 
  }
50
 
 
51
 
  boost::mutex &mutex()
52
 
  {
53
 
    return _mutex;
54
 
  }
55
 
 
56
 
  void erase(Session::Ptr);
57
 
  void erase(Session::shared_ptr&);
58
 
  size_t count();
59
 
  void insert(Session::shared_ptr &arg);
60
 
 
61
 
  Session::shared_ptr find(const session_id_t &id);
62
 
 
63
 
private:
64
 
  list cache;
65
 
  boost::mutex _mutex;
66
 
};
67
 
 
68
 
} /* namespace session */
69
 
} /* namespace drizzled */
70
 
 
71
 
#endif /* DRIZZLED_SESSION_CACHE_H */
 
29
typedef std::vector<Session *> SessionList;
 
30
SessionList &getSessionList();
 
31
 
 
32
}
 
33
 
 
34
#endif /* DRIZZLED_SESSION_LIST_H */