~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/query_id.h

  • Committer: Olaf van der Spek
  • Date: 2011-08-14 15:59:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2407.
  • Revision ID: olafvdspek@gmail.com-20110814155954-zf2yu0ji8bwghnl9
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#pragma once
21
21
 
22
22
#include <drizzled/atomics.h>
 
23
#include <drizzled/common_fwd.h>
23
24
 
24
25
namespace drizzled {
25
26
 
26
 
typedef uint64_t query_id_t;
27
 
 
28
27
class Query_id
29
28
{
30
29
public:
31
30
  static Query_id& get_query_id() 
32
31
  {
33
 
    static Query_id the_id;
34
32
    return the_id;
35
33
  }
36
34
 
37
35
  /* return current query_id value */
38
 
  query_id_t value() const;
 
36
  query_id_t value() const
 
37
  {
 
38
    return the_query_id;
 
39
  }
39
40
 
40
41
  /* increment query_id and return it.  */
41
 
  query_id_t next();
 
42
  query_id_t next()
 
43
  {
 
44
    return the_query_id.increment();
 
45
  }
42
46
 
43
47
private:
 
48
  Query_id()
 
49
  {
 
50
    the_query_id= 1;
 
51
  }
 
52
 
 
53
  static Query_id the_id;
44
54
  atomic<uint64_t> the_query_id;
45
 
 
46
 
  Query_id();
47
 
  Query_id(Query_id const&);
48
 
  Query_id& operator=(Query_id const&);
49
55
};
50
56
 
51
57
} /* namespace drizzled */
52