libdap  Updated for version 3.20.9
libdap4 is an implementation of OPeNDAP's DAP protocol.
ServerFunctionsList.h
1 // ServerFunctionsList.h
2 
3 // This file is part of bes, A C++ back-end server implementation framework
4 // for the OPeNDAP Data Access Protocol.
5 
6 // -*- mode: c++; c-basic-offset:4 -*-
7 
8 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
9 // Access Protocol.
10 
11 // Copyright (c) 2013 OPeNDAP, Inc.
12 // Author: Nathan Potter <npotter@opendap.org>
13 //
14 // This library is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU Lesser General Public
16 // License as published by the Free Software Foundation; either
17 // version 2.1 of the License, or (at your option) any later version.
18 //
19 // This library is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 // Lesser General Public License for more details.
23 //
24 // You should have received a copy of the GNU Lesser General Public
25 // License along with this library; if not, write to the Free Software
26 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 //
28 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
29 
30 #ifndef I_ServerFunctionsList_h
31 #define I_ServerFunctionsList_h 1
32 
33 #include <map>
34 #include <string>
35 
36 #include <expr.h>
37 #include <D4Function.h>
38 
39 #include <ServerFunction.h>
40 
41 namespace libdap {
42 
43 class ServerFunctionsListUnitTest;
44 class ConstraintEvaluator;
45 
47 private:
48  static ServerFunctionsList * d_instance;
49  std::multimap<std::string, ServerFunction *> d_func_list;
50 
51  static void initialize_instance();
52  static void delete_instance();
53 
54  virtual ~ServerFunctionsList();
55 
56  friend class ServerFunctionsListUnitTest;
57 
58 protected:
60 
61 public:
62  // Added typedefs to reduce clutter jhrg 3/12/14
63  typedef std::multimap<std::string, ServerFunction *>::iterator SFLIter;
64  typedef std::multimap<std::string, ServerFunction *>::const_iterator SFLCIter;
65 
66  static ServerFunctionsList * TheList();
67 
68  virtual void add_function(ServerFunction *func);
69 
70  virtual bool find_function(const std::string &name, bool_func *f) const;
71  virtual bool find_function(const std::string &name, btp_func *f) const;
72  virtual bool find_function(const std::string &name, proj_func *f) const;
73  virtual bool find_function(const std::string &name, D4Function *f) const;
74 
75  SFLIter begin();
76  SFLIter end();
77  ServerFunction *getFunction(SFLIter it);
78 
79  virtual void getFunctionNames(std::vector<std::string> *names);
80 };
81 
82 }
83 
84 #endif // I_ServerFunctionsList_h
virtual bool find_function(const std::string &name, bool_func *f) const
Find a boolean function with a given name in the function list.
virtual void add_function(ServerFunction *func)
Adds the passed ServerFunction pointer to the list of ServerFunctions.
SFLIter begin()
Returns an iterator pointing to the first key pair in the ServerFunctionList.
SFLIter end()
Returns an iterator pointing to the last key pair in the ServerFunctionList.
ServerFunction * getFunction(SFLIter it)
Returns the ServerFunction pointed to by the passed iterator.
top level DAP object to house generic methods
Definition: AlarmHandler.h:36