Drizzled Public API Documentation

function_map.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 <map>
00019 #include <string>
00020 #include <libgearman/gearman.h>
00021 #include <pthread.h>
00022 
00023 class GearmanFunctionMap
00024 {
00025   std::map<std::string, gearman_client_st> functionMap;
00026   pthread_mutex_t lock;
00027 
00028 public:
00029   GearmanFunctionMap();
00030   ~GearmanFunctionMap();
00031   bool add(std::string function, std::string servers);
00032   bool get(std::string function, gearman_client_st *client);
00033 };
00034 
00035 /* This returns a reference to the global function map class. */
00036 GearmanFunctionMap& GetFunctionMap(void);
00037