00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <drizzled/table/instance/base.h>
00025
00026 namespace drizzled {
00027 namespace table {
00028 namespace instance {
00029
00030 void release(TableShare *share);
00031 void release(TableShare::shared_ptr &share);
00032 void release(const identifier::Table &identifier);
00033
00034
00035 class Shared : public drizzled::TableShare
00036 {
00037 friend void release(TableShare *share);
00038 friend void release(TableShare::shared_ptr &share);
00039
00040 public:
00041 typedef boost::shared_ptr<Shared> shared_ptr;
00042 typedef std::vector <shared_ptr> vector;
00043
00044 Shared(const identifier::Table::Type type_arg,
00045 const identifier::Table &identifier,
00046 char *path_arg= NULL, uint32_t path_length_arg= 0);
00047
00048 Shared(const identifier::Table &identifier, message::schema::shared_ptr schema_message);
00049
00050 Shared(const identifier::Table &identifier);
00051
00052 ~Shared();
00053
00054
00055 void lock()
00056 {
00057 mutex.lock();
00058 }
00059
00060 void unlock()
00061 {
00062 mutex.unlock();
00063 }
00064
00065 static shared_ptr make_shared(Session *session,
00066 const identifier::Table &identifier,
00067 int &in_error);
00068
00069 static shared_ptr foundTableShare(shared_ptr share);
00070
00071 plugin::EventObserverList *getTableObservers()
00072 {
00073 return event_observers;
00074 }
00075
00076 void setTableObservers(plugin::EventObserverList *observers)
00077 {
00078 event_observers= observers;
00079 }
00080
00081 virtual bool is_replicated() const;
00082
00083 private:
00084 boost::mutex mutex;
00085 drizzled::message::schema::shared_ptr _schema;
00086
00087
00088
00089
00090
00091 plugin::EventObserverList *event_observers;
00092
00093 };
00094
00095 }
00096 }
00097 }
00098