18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include <boost/foreach.hpp>
23
#include <drizzled/plugin/table_function.h>
24
#include <drizzled/table_function_container.h>
25
#include <drizzled/util/find_ptr.h>
22
#include "drizzled/plugin/table_function.h"
23
#include "drizzled/table_function_container.h"
27
27
using namespace std;
31
32
plugin::TableFunction *TableFunctionContainer::getFunction(const std::string &path)
33
ToolMap::mapped_type* ptr= find_ptr(table_map, path);
34
return ptr ? *ptr : NULL;
34
ToolMap::iterator iter= table_map.find(path);
36
if (iter == table_map.end())
40
return (*iter).second;
37
void TableFunctionContainer::getNames(const string &predicate, std::set<std::string> &set_of_names)
43
void TableFunctionContainer::getNames(const string &predicate,
44
std::set<std::string> &set_of_names)
39
BOOST_FOREACH(ToolMap::reference i, table_map)
46
for (ToolMap::iterator it= table_map.begin();
47
it != table_map.end();
41
if (i.second->visible() && (predicate.empty() || boost::iequals(predicate, i.second->getSchemaHome())))
42
set_of_names.insert(i.second->getTableLabel());
50
plugin::TableFunction *tool= (*it).second;
54
if (predicate.length())
56
if (boost::iequals(predicate, tool->getSchemaHome()))
58
set_of_names.insert(tool->getTableLabel());
63
set_of_names.insert(tool->getTableLabel());
46
69
void TableFunctionContainer::addFunction(plugin::TableFunction *tool)
48
std::pair<ToolMap::iterator, bool> ret= table_map.insert(std::make_pair(tool->getPath(), tool));
71
std::pair<ToolMap::iterator, bool> ret=
72
table_map.insert(std::make_pair(tool->getPath(), tool));
73
assert(ret.second == true);
52
76
} /* namespace drizzled */