Drizzled Public API Documentation

gman_do.h

00001 /* Copyright (C) 2009 Sun Microsystems, Inc.
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 #pragma once
00017 
00018 #include <drizzled/item/func.h>
00019 #include <drizzled/function/str/strfunc.h>
00020 
00021 #include <libgearman/gearman.h>
00022 
00023 class Item_func_gman_do :public drizzled::Item_str_func
00024 {
00025 protected:
00026   typedef enum
00027   {
00028     GMAN_DO_OPTIONS_NONE=       0,
00029     GMAN_DO_OPTIONS_HIGH=       (1 << 0),
00030     GMAN_DO_OPTIONS_LOW=        (1 << 1),
00031     GMAN_DO_OPTIONS_BACKGROUND= (1 << 2),
00032     GMAN_DO_OPTIONS_CLIENT=     (1 << 3)
00033   } gman_do_options_t;
00034 
00035 private:
00036   gman_do_options_t options;
00037   gearman_client_st client;
00038   drizzled::String buffer;
00039 
00040 public:
00041   Item_func_gman_do():
00042     Item_str_func(),
00043     options(GMAN_DO_OPTIONS_NONE) {}
00044   Item_func_gman_do(gman_do_options_t options_arg):
00045     Item_str_func(),
00046     options(options_arg) {}
00047   ~Item_func_gman_do();
00048   void fix_length_and_dec() { max_length=10; }
00049   virtual const char *func_name() const{ return "gman_do"; }
00050   drizzled::String *val_str(drizzled::String *);
00051   void *realloc(size_t size);
00052 };
00053 
00054 class Item_func_gman_do_high :public Item_func_gman_do
00055 {
00056 public:
00057   Item_func_gman_do_high():
00058     Item_func_gman_do(GMAN_DO_OPTIONS_HIGH) {}
00059   const char *func_name() const{ return "gman_do_high"; }
00060 };
00061 
00062 class Item_func_gman_do_low :public Item_func_gman_do
00063 {
00064 public:
00065   Item_func_gman_do_low():
00066     Item_func_gman_do(GMAN_DO_OPTIONS_LOW) {}
00067   const char *func_name() const{ return "gman_do_low"; }
00068 };
00069 
00070 class Item_func_gman_do_background :public Item_func_gman_do
00071 {
00072 public:
00073   Item_func_gman_do_background():
00074     Item_func_gman_do(GMAN_DO_OPTIONS_BACKGROUND) {}
00075   const char *func_name() const{ return "gman_do_background"; }
00076 };
00077 
00078 class Item_func_gman_do_high_background :public Item_func_gman_do
00079 {
00080 public:
00081   Item_func_gman_do_high_background():
00082     Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_HIGH |
00083                                           GMAN_DO_OPTIONS_BACKGROUND)) {}
00084   const char *func_name() const{ return "gman_do_high_background"; }
00085 };
00086 
00087 class Item_func_gman_do_low_background :public Item_func_gman_do
00088 {
00089 public:
00090   Item_func_gman_do_low_background():
00091     Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_LOW |
00092                                          GMAN_DO_OPTIONS_BACKGROUND)) {}
00093   const char *func_name() const{ return "gman_do_low_background"; }
00094 };
00095