24
24
#include <boost/bind.hpp>
26
#include "drizzled/catalog.h"
26
27
#include "drizzled/plugin/catalog.h"
27
28
#include "drizzled/identifier/catalog.h"
30
#include <boost/unordered_map.hpp>
31
#include <boost/thread/mutex.hpp>
29
33
namespace drizzled {
31
35
namespace generator {
60
catalog::Instance::shared_ptr find(const identifier::Catalog &identifier);
61
void erase(const identifier::Catalog &identifier);
62
bool insert(const identifier::Catalog &identifier, catalog::Instance::shared_ptr share);
64
Instance::shared_ptr find(const identifier::Catalog &identifier, catalog::error_t &error);
65
bool exist(const identifier::Catalog &identifier);
66
bool erase(const identifier::Catalog &identifier, catalog::error_t &error);
67
bool insert(const identifier::Catalog &identifier, Instance::shared_ptr instance, catalog::error_t &error);
68
bool lock(const identifier::Catalog &identifier, catalog::error_t &error);
69
bool unlock(const identifier::Catalog &identifier, catalog::error_t &error);
65
72
friend class drizzled::generator::catalog::Cache;
66
73
friend class drizzled::plugin::Catalog;
68
void CopyFrom(catalog::Instance::vector &vector)
70
boost::mutex::scoped_lock scopedLock(_mutex);
72
vector.reserve(catalog::Cache::singleton().size());
74
std::transform(cache.begin(),
76
std::back_inserter(vector),
77
boost::bind(&unordered_map::value_type::second, _1) );
78
assert(vector.size() == cache.size());
75
void copy(catalog::Instance::vector &vector);
82
78
typedef boost::unordered_map< identifier::Catalog, catalog::Instance::shared_ptr> unordered_map;