~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/generator/session.h

  • Committer: Brian Aker
  • Date: 2010-10-29 01:13:40 UTC
  • mto: (1890.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1891.
  • Revision ID: brian@tangent.org-20101029011340-y9ixm180v9daypqr
Remove warnings for c++

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