libdap  Updated for version 3.17.0
ServerFunctionsList.h
00001 // ServerFunctionsList.h
00002 
00003 // This file is part of bes, A C++ back-end server implementation framework
00004 // for the OPeNDAP Data Access Protocol.
00005 
00006 // -*- mode: c++; c-basic-offset:4 -*-
00007 
00008 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00009 // Access Protocol.
00010 
00011 // Copyright (c) 2013 OPeNDAP, Inc.
00012 // Author: Nathan Potter <npotter@opendap.org>
00013 //
00014 // This library is free software; you can redistribute it and/or
00015 // modify it under the terms of the GNU Lesser General Public
00016 // License as published by the Free Software Foundation; either
00017 // version 2.1 of the License, or (at your option) any later version.
00018 //
00019 // This library is distributed in the hope that it will be useful,
00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022 // Lesser General Public License for more details.
00023 //
00024 // You should have received a copy of the GNU Lesser General Public
00025 // License along with this library; if not, write to the Free Software
00026 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00027 //
00028 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00029 
00030 #ifndef I_ServerFunctionsList_h
00031 #define I_ServerFunctionsList_h 1
00032 
00033 #include <map>
00034 #include <string>
00035 
00036 #include <expr.h>
00037 #include <D4Function.h>
00038 
00039 #include <ServerFunction.h>
00040 
00041 namespace libdap {
00042 
00043 class ServerFunctionsListUnitTest;
00044 class ConstraintEvaluator;
00045 
00046 class ServerFunctionsList {
00047 private:
00048     static ServerFunctionsList * d_instance;
00049     std::multimap<std::string, ServerFunction *> d_func_list;
00050 
00051     static void initialize_instance();
00052     static void delete_instance();
00053 
00054     virtual ~ServerFunctionsList();
00055 
00056     friend class ServerFunctionsListUnitTest;
00057 
00058 protected:
00059     ServerFunctionsList() {}
00060 
00061 public:
00062     // Added typedefs to reduce clutter jhrg 3/12/14
00063     typedef std::multimap<std::string, ServerFunction *>::iterator SFLIter;
00064     typedef std::multimap<std::string, ServerFunction *>::const_iterator SFLCIter;
00065 
00066     static ServerFunctionsList * TheList();
00067 
00068     virtual void add_function(ServerFunction *func);
00069 
00070     virtual bool find_function(const std::string &name, bool_func *f) const;
00071     virtual bool find_function(const std::string &name, btp_func  *f) const;
00072     virtual bool find_function(const std::string &name, proj_func *f) const;
00073     virtual bool find_function(const std::string &name, D4Function *f) const;
00074 
00075     SFLIter begin();
00076     SFLIter end();
00077     ServerFunction *getFunction(SFLIter it);
00078 
00079     virtual void getFunctionNames(std::vector<std::string> *names);
00080 };
00081 
00082 }
00083 
00084 #endif // I_ServerFunctionsList_h