~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/generator/session.h

  • Committer: Brian Aker
  • Date: 2010-10-28 17:12:01 UTC
  • mfrom: (1887.1.3 merge)
  • Revision ID: brian@tangent.org-20101028171201-baj6l1bnntn1s4ad
Merge in POTFILES changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_GENERATOR_SESSION_H
22
22
#define DRIZZLED_GENERATOR_SESSION_H
23
23
 
24
 
#include <boost/thread/mutex.hpp>
25
 
#include "drizzled/session/cache.h"
26
 
#include "drizzled/identifier/user.h"
 
24
#include "drizzled/pthread_globals.h"
 
25
#include "drizzled/session_list.h"
27
26
 
28
27
namespace drizzled {
29
28
namespace generator {
30
29
 
31
30
class Session
32
31
{
33
 
  session::Cache::list local_list;
34
 
  session::Cache::list::const_iterator iter;
35
 
  identifier::User::const_reference user;
 
32
  SessionList local_list;
 
33
  SessionList::const_iterator iter;
36
34
 
37
35
public:
38
36
 
39
 
  Session(identifier::User::const_reference arg) :
40
 
    user(arg)
 
37
  Session()
41
38
  {
42
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
43
 
    local_list= session::Cache::singleton().getCache();
 
39
    LOCK_thread_count.lock();
 
40
    local_list= getSessionList();
44
41
    iter= local_list.begin();
45
42
  }
46
43
 
47
44
  ~Session()
48
45
  {
 
46
    LOCK_thread_count.unlock();
49
47
  }
50
48
 
51
 
  operator drizzled::Session::pointer()
 
49
  operator drizzled::SessionPtr()
52
50
  {
53
51
    while (iter != local_list.end())
54
52
    {
55
 
      drizzled::Session::pointer ret= (*iter).get();
56
 
      iter++;
57
 
 
58
 
      if (not ret->isViewable(user))
 
53
      if (not (*iter)->isViewable())
59
54
      {
 
55
        iter++;
60
56
        continue;
61
57
      }
62
58
 
 
59
      drizzled::SessionPtr ret= *iter;
 
60
      iter++;
63
61
      return ret;
64
62
    }
65
63
 
66
 
    return drizzled::Session::pointer();
 
64
    return NULL;
67
65
  }
68
66
};
69
67