~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/table.h

  • Committer: Mark Atwood
  • Date: 2011-08-12 04:08:33 UTC
  • mfrom: (2385.2.17 refactor5)
  • Revision ID: me@mark.atwood.name-20110812040833-u6j85nc6ahuc0dtz
mergeĀ lp:~olafvdspek/drizzle/refactor5

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
  This will replace Table_ident.
31
31
  */
32
32
 
33
 
#ifndef DRIZZLED_IDENTIFIER_TABLE_H
34
 
#define DRIZZLED_IDENTIFIER_TABLE_H
 
33
#pragma once
35
34
 
36
35
#include <drizzled/enum.h>
37
 
#include "drizzled/definitions.h"
38
 
#include "drizzled/message/table.pb.h"
 
36
#include <drizzled/definitions.h>
 
37
#include <drizzled/message/table.pb.h>
39
38
 
40
39
#include <string.h>
41
40
 
48
47
 
49
48
#include <boost/functional/hash.hpp>
50
49
 
51
 
#include "drizzled/visibility.h"
 
50
#include <drizzled/visibility.h>
 
51
#include <drizzled/identifier/schema.h>
52
52
 
53
53
namespace drizzled {
54
 
class Table;
55
 
 
56
54
namespace identifier {
57
55
 
58
56
class DRIZZLED_API Table : public Schema
59
57
{
60
58
public:
61
59
  typedef message::Table::TableType Type;
62
 
  typedef std::vector <Table> vector;
63
 
  typedef const Table& const_reference;
64
 
  typedef Table& reference;
65
60
 
66
61
  class Key
67
62
  {
201
196
    return type;
202
197
  }
203
198
 
204
 
  virtual void getSQLPath(std::string &sql_path) const;
 
199
  virtual std::string getSQLPath() const;
205
200
 
206
201
  virtual const std::string &getPath() const;
207
202
  const std::string &getKeyPath() const;
218
213
 
219
214
  void copyToTableMessage(message::Table &message) const;
220
215
 
221
 
  friend bool operator<(Table::const_reference left, Table::const_reference right)
 
216
  friend bool operator<(const Table& left, const Table& right)
222
217
  {
223
218
    if (left.getKey() < right.getKey())
224
219
    {
228
223
    return false;
229
224
  }
230
225
 
231
 
  friend bool operator==(Table::const_reference left, Table::const_reference right)
 
226
  friend bool operator==(const Table& left, const Table& right)
232
227
  {
233
228
    if (left.getHashValue() == right.getHashValue())
234
229
    {
240
235
  }
241
236
 
242
237
  static uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);
243
 
  static size_t build_table_filename(std::string &path, const std::string &db, const std::string &table_name, bool is_tmp);
244
 
  static size_t build_tmptable_filename(std::string &buffer);
245
 
  static size_t build_tmptable_filename(std::vector<char> &buffer);
 
238
  static std::string build_table_filename(const std::string &db, const std::string &table_name, bool is_tmp);
 
239
  static std::string build_tmptable_filename();
246
240
 
247
241
public:
248
242
  bool isValid() const;
258
252
  }
259
253
};
260
254
 
261
 
std::ostream& operator<<(std::ostream& output, Table::const_reference identifier);
 
255
std::ostream& operator<<(std::ostream& output, const Table& identifier);
262
256
std::size_t hash_value(Table const& b);
263
257
std::size_t hash_value(Table::Key const& b);
264
258
 
265
259
} /* namespace identifier */
266
260
} /* namespace drizzled */
267
 
 
268
 
#endif /* DRIZZLED_IDENTIFIER_TABLE_H */