~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to drizzled/type/uuid.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
#pragma once
66
66
 
67
67
#include <cstdio>
68
 
#include <iostream>
69
 
 
70
 
namespace drizzled
71
 
{
72
 
namespace type
73
 
{
74
 
 
75
 
class Uuid {
 
68
#include <iosfwd>
 
69
 
 
70
namespace drizzled {
 
71
namespace type {
 
72
 
 
73
class Uuid 
 
74
{
76
75
        uint32_t        time_low;
77
76
        uint16_t        time_mid;
78
77
        uint16_t        time_hi_and_version;
188
187
    return false;
189
188
  }
190
189
 
191
 
  void unparse(char *out)
 
190
  void unparse(char *out) const
192
191
  {
193
192
    snprintf(out, DISPLAY_BUFFER_LENGTH, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
194
193
            time_low,
204
203
            node[5]);
205
204
  }
206
205
 
207
 
  void time(struct timeval ret_val)
 
206
  void time(timeval& ret_val) const
208
207
  {
209
208
    uint32_t high;
210
209
    uint64_t clock_reg;
216
215
    ret_val.tv_sec = clock_reg / 10000000;
217
216
    ret_val.tv_usec = (clock_reg % 10000000) / 10;
218
217
  }
219
 
 
220
 
  bool isTimeType()
 
218
  bool isTimeType() const
221
219
  {
222
 
    return ((time_hi_and_version >> 12) & 0xF) == 1 ? true : false; 
 
220
    return ((time_hi_and_version >> 12) & 0xF) == 1; 
223
221
  }
224
222
 
225
223
  static const size_t LENGTH= 16;