rasdaman complete source
parseparams.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
33 #ifndef _PARSE_PARAMS_HH_
34 #define _PARSE_PARAMS_HH_
35 
36 #include <iosfwd>
37 
38 //@ManMemo: Module {\bf raslib}
39 
40 /*@Doc:
41  Class for parsing a string consisting of key=value pairs separated by ",".
42 */
43 
44 class r_Parse_Params
45 {
46 public:
47 
49  enum parse_param_type
50  {
51  param_type_int,
52  param_type_double,
53  param_type_string
54  };
65  struct parse_params_s;
66 
68  r_Parse_Params( void );
70  r_Parse_Params( unsigned int num );
72  ~r_Parse_Params( void );
74  int add( const char *key, void *store, parse_param_type type );
85  int process( const char *str ) const;
93 protected:
94  //@Man: The parameter descriptor
96  typedef struct parse_params_s
97  {
98  const char *key;
99  void *store;
100  parse_param_type type;
101  } parse_params_t;
103 
104  parse_params_t *params;
105  unsigned int maxnum;
106  unsigned int number;
107 
108  static const unsigned int granularity;
109 };
110 
111 //@ManMemo: Module: {\bf raslib}
115 extern std::ostream& operator<<( std::ostream& s, const r_Parse_Params::parse_param_type& d );
116 
117 
118 #endif
template std::ostream & operator<<(const vector< KeyObject > &, std::ostream &)