~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/table.h

  • Committer: Monty Taylor
  • Date: 2010-10-26 17:38:18 UTC
  • mto: (1880.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1881.
  • Revision ID: mordred@inaugust.com-20101026173818-1yol32mb18o66mmu
Turned some plugins off of load_by_default so we can package them easier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
{
59
59
public:
60
60
  typedef message::Table::TableType Type;
61
 
  typedef std::vector <TableIdentifier> vector;
62
 
  typedef const TableIdentifier& const_reference;
63
 
  typedef TableIdentifier& reference;
64
 
 
65
 
  class Key
66
 
  {
67
 
    std::vector<char> key_buffer;
68
 
    size_t hash_value;
69
 
 
70
 
  public:
71
 
 
72
 
    Key() :
73
 
      hash_value(0)
74
 
    {
75
 
    }
76
 
 
77
 
    const char *vector() const
78
 
    {
79
 
      return &key_buffer[0];
80
 
    }
81
 
 
82
 
    std::vector<char> &vectorPtr()
83
 
    {
84
 
      return key_buffer;
85
 
    }
86
 
 
87
 
    void set(size_t resize_arg, const std::string &a, const std::string &b);
88
 
 
89
 
    friend bool operator==(const Key &left, const Key &right)
90
 
    {
91
 
      if (left.hash_value == right.hash_value and left.key_buffer.size() == right.key_buffer.size())
92
 
      {
93
 
        if (memcmp(&left.key_buffer[0], &right.key_buffer[0], left.key_buffer.size()) == 0)
94
 
          return true;
95
 
      }
96
 
 
97
 
      return false;
98
 
    }
99
 
 
100
 
    friend bool operator<(const Key &left, const Key &right)
101
 
    {
102
 
      return left.key_buffer < right.key_buffer;
103
 
    }
104
 
 
105
 
    size_t size() const
106
 
    {
107
 
      return key_buffer.size();
108
 
    }
109
 
 
110
 
    size_t getHashValue() const
111
 
    {
112
 
      return hash_value;
113
 
    }
114
 
  };
115
 
 
 
61
  typedef std::vector<char> Key;
116
62
private:
117
63
 
118
64
  Type type;
119
65
  std::string path;
120
66
  std::string table_name;
 
67
  std::string sql_path;
121
68
  Key key;
122
69
  size_t hash_value;
123
70
 
197
144
    return type;
198
145
  }
199
146
 
200
 
  virtual void getSQLPath(std::string &sql_path) const;
 
147
  const std::string &getSQLPath();
201
148
 
202
 
  virtual const std::string &getPath() const;
 
149
  const std::string &getPath() const;
203
150
 
204
151
  void setPath(const std::string &new_path)
205
152
  {
213
160
 
214
161
  void copyToTableMessage(message::Table &message) const;
215
162
 
216
 
  friend bool operator<(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
 
163
  friend bool operator<(const TableIdentifier &left, const TableIdentifier &right)
217
164
  {
218
165
    if (left.getKey() < right.getKey())
219
166
    {
223
170
    return false;
224
171
  }
225
172
 
226
 
  friend std::ostream& operator<<(std::ostream& output, TableIdentifier::const_reference identifier)
 
173
  friend std::ostream& operator<<(std::ostream& output, const TableIdentifier &identifier)
227
174
  {
228
175
    const char *type_str;
229
176
 
258
205
    return output;  // for multiple << operators.
259
206
  }
260
207
 
261
 
  friend bool operator==(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
 
208
  friend bool operator==(TableIdentifier &left, TableIdentifier &right)
262
209
  {
263
210
    if (left.getHashValue() == right.getHashValue())
264
211
    {
275
222
  static size_t build_tmptable_filename(std::vector<char> &buffer);
276
223
 
277
224
public:
278
 
  bool isValid() const;
279
225
 
280
226
  size_t getHashValue() const
281
227
  {
289
235
};
290
236
 
291
237
std::size_t hash_value(TableIdentifier const& b);
292
 
std::size_t hash_value(TableIdentifier::Key const& b);
 
238
 
 
239
typedef std::vector <TableIdentifier> TableIdentifiers;
293
240
 
294
241
} /* namespace drizzled */
295
242