~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/function.h

  • Committer: Mark Atwood
  • Date: 2011-06-25 15:38:53 UTC
  • mfrom: (2318.6.78 refactor16)
  • Revision ID: me@mark.atwood.name-20110625153853-za5fjiwd3z0aykdd
mergeĀ lp:~olafvdspek/drizzle/refactor16

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <drizzled/visibility.h>
34
34
 
35
35
namespace drizzled {
36
 
 
37
 
namespace util
38
 
{
39
 
struct insensitive_hash;
40
 
struct insensitive_equal_to;
41
 
}
42
 
 
43
36
namespace plugin {
44
37
 
45
38
/**
46
39
 * Functions in the server: AKA UDF
47
40
 */
48
 
class DRIZZLED_API Function
49
 
  : public Plugin,
50
 
    public std::unary_function<memory::Root*, Item_func *>
 
41
class DRIZZLED_API Function : public Plugin
51
42
{
52
 
  Function();
53
 
  Function(const Function &);
54
 
  Function& operator=(const Function &);
55
43
public:
56
 
  Function(std::string in_name)
57
 
   : Plugin(in_name, "Function"),
58
 
     std::unary_function<memory::Root*, Item_func *>()
 
44
  Function(std::string in_name) : Plugin(in_name, "Function")
59
45
  { }
60
 
  virtual result_type operator()(argument_type root) const= 0;
61
 
  virtual ~Function() {}
 
46
  virtual Item_func* operator()(memory::Root*) const= 0;
62
47
 
63
48
  /**
64
49
   * Add a new Function factory to the list of factories we manage.
79
64
};
80
65
 
81
66
template<class T>
82
 
class Create_function
83
 
 : public Function
 
67
class Create_function : public Function
84
68
{
85
69
public:
86
 
  typedef T FunctionClass;
87
 
  Create_function(std::string in_name)
88
 
    : Function(in_name)
89
 
  { }
90
 
  virtual result_type operator()(argument_type root) const
 
70
  Create_function(const std::string& in_name) : Function(in_name)
 
71
  { 
 
72
  }
 
73
 
 
74
  virtual Item_func* operator()(memory::Root* root) const
91
75
  {
92
 
    return new (root) FunctionClass();
 
76
    return new (*root) T();
93
77
  }
94
78
};
95
79