~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/instance/shared.h

  • Committer: lbieber
  • Date: 2010-10-06 16:34:16 UTC
  • mfrom: (1816.1.3 build)
  • Revision ID: lbieber@orisndriz08-20101006163416-ea0sl59qgpglk21y
Merge Monty - Change the requirement from either libinnodb to libhaildb. Also, tied it to version 2.2
Merge Andrew - fix bug 650935: remove --compress from all clients
Merge Andrew - fix bug 653471: Add -A to drizzle client
Merge Travis - 621861 = To change C structs to C++ classes in Drizzle

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2011 Brian Aker
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with this program; if not, write to the Free Software
18
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 */
20
 
 
21
 
 
22
 
#ifndef DRIZZLED_TABLE_INSTANCE_SHARED_H
23
 
#define DRIZZLED_TABLE_INSTANCE_SHARED_H
24
 
 
25
 
#include <drizzled/table/instance/base.h>
26
 
 
27
 
namespace drizzled
28
 
{
29
 
 
30
 
class TableShare;
31
 
class Session;
32
 
 
33
 
namespace identifier { class Table; }
34
 
 
35
 
namespace table
36
 
{
37
 
 
38
 
namespace instance
39
 
{
40
 
 
41
 
void release(TableShare *share);
42
 
void release(TableShare::shared_ptr &share);
43
 
void release(const identifier::Table &identifier);
44
 
 
45
 
 
46
 
class Shared : public drizzled::TableShare
47
 
{
48
 
  friend void release(TableShare *share);
49
 
  friend void release(TableShare::shared_ptr &share);
50
 
 
51
 
public:
52
 
  typedef boost::shared_ptr<Shared> shared_ptr;
53
 
  typedef std::vector <shared_ptr> vector;
54
 
 
55
 
  Shared(const identifier::Table::Type type_arg,
56
 
         const identifier::Table &identifier,
57
 
         char *path_arg= NULL, uint32_t path_length_arg= 0); // Shares for cache
58
 
 
59
 
  Shared(const identifier::Table &identifier); // Used by placeholder
60
 
 
61
 
  ~Shared();
62
 
 
63
 
 
64
 
  void lock()
65
 
  {
66
 
    mutex.lock();
67
 
  }
68
 
 
69
 
  void unlock()
70
 
  {
71
 
    mutex.unlock();
72
 
  }
73
 
 
74
 
  static shared_ptr make_shared(Session *session, 
75
 
                                const identifier::Table &identifier,
76
 
                                int &in_error);
77
 
 
78
 
  static shared_ptr foundTableShare(shared_ptr share);
79
 
 
80
 
  plugin::EventObserverList *getTableObservers() 
81
 
  { 
82
 
    return event_observers;
83
 
  }
84
 
 
85
 
  void setTableObservers(plugin::EventObserverList *observers) 
86
 
  { 
87
 
    event_observers= observers;
88
 
  }
89
 
 
90
 
private:
91
 
  boost::mutex mutex;                /* For locking the share  */
92
 
 
93
 
  /* 
94
 
    event_observers is a class containing all the event plugins that have 
95
 
    registered an interest in this table.
96
 
  */
97
 
  plugin::EventObserverList *event_observers;
98
 
 
99
 
};
100
 
 
101
 
} /* namespace instance */
102
 
} /* namespace table */
103
 
} /* namespace drizzled */
104
 
 
105
 
#endif /* DRIZZLED_TABLE_INSTANCE_SHARED_H */