~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/function.h

Merge trunk and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_FUNCTION_CREATE_H
21
 
#define DRIZZLED_FUNCTION_CREATE_H
 
20
#ifndef DRIZZLED_PLUGIN_FUNCTION_H
 
21
#define DRIZZLED_PLUGIN_FUNCTION_H
22
22
 
23
23
 
24
24
#include <drizzled/item.h>
29
29
#include <vector>
30
30
#include <functional>
31
31
 
32
 
class Function_builder
 
32
 
 
33
namespace drizzled
 
34
{
 
35
namespace plugin
 
36
{
 
37
 
 
38
/**
 
39
 * Functions in the server: AKA UDF
 
40
 */
 
41
class Function
33
42
  : public std::unary_function<MEM_ROOT*, Item_func *>
34
43
{
35
44
  std::string name;
36
45
  std::vector<std::string> aliases;
37
46
public:
38
 
  Function_builder(std::string in_name) : name(in_name) {}
 
47
  Function(std::string in_name) : name(in_name) {}
39
48
  virtual result_type operator()(argument_type session) const= 0;
40
 
  virtual ~Function_builder() {}
 
49
  virtual ~Function() {}
41
50
 
42
51
  std::string getName() const
43
52
  {
56
65
};
57
66
 
58
67
template<class T>
59
 
class Create_function : public Function_builder
 
68
class Create_function : public Function
60
69
{
61
70
public:
62
71
  typedef T Function_class;
63
 
  Create_function(std::string in_name): Function_builder(in_name) {}
64
 
  Create_function(const char *in_name): Function_builder(in_name) {}
 
72
  Create_function(std::string in_name): Function(in_name) {}
 
73
  Create_function(const char *in_name): Function(in_name) {}
65
74
  virtual result_type operator()(argument_type root) const
66
75
  {
67
76
    return new (root) Function_class();
68
77
  }
69
78
};
70
79
 
71
 
 
72
 
 
73
 
#endif /* DRIZZLED_FUNCTION_CREATE_H */
 
80
} /* end namespace plugin */
 
81
} /* end namespace drizzled */
 
82
 
 
83
 
 
84
#endif /* DRIZZLED_PLUGIN_FUNCTION_H */