Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

datamap.h

Go to the documentation of this file.
00001 // Data map implementation -*- C++ -*-
00002 
00003 // Copyright (C) 2001-2003 Hermann Schichl
00004 //
00005 // This file is part of the COCONUT API.  This library
00006 // is free software; you can redistribute it and/or modify it under the
00007 // terms of the Library GNU General Public License as published by the
00008 // Free Software Foundation; either version 2, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // Library GNU General Public License for more details.
00015 
00016 // As a special exception, you may use this file as part of a free software
00017 // library without restriction.  Specifically, if other files instantiate
00018 // templates or use macros or inline functions from this file, or you compile
00019 // this file and link it with other files to produce an executable, this
00020 // file does not by itself cause the resulting executable to be covered by
00021 // the Library GNU General Public License.  This exception does not however
00022 // invalidate any other reasons why the executable file might be covered by
00023 // the Library GNU General Public License.
00024 
00027 #ifndef _DATAMAP_H
00028 #define _DATAMAP_H
00029 
00030 #include <coconut_config.h>
00031 #include <coconut_types.h>
00032 #include <addinfo.h>
00033 #include <map>
00034 
00035 class datamap : std::map<std::string, additional_info_u>
00036 {
00037 private:
00038   typedef std::map<std::string, additional_info_u> _Base;
00039   additional_info_u __empty;
00040 
00041 private:
00042   std::string encode(const std::string& __s, int i) const;
00043   bool update_index(const std::string& __s, int i, bool __insert);
00044   bool check_index(const std::string& __s, int i) const;
00045   
00046 public:
00047   datamap() : _Base(), __empty() {}
00048   datamap(const std::string& __n, const additional_info_u& __v)
00049     : _Base(), __empty()
00050     { insert(std::make_pair(__n,__v)); }
00051   datamap(const char* __n, const additional_info_u& __v)
00052     : _Base(), __empty()
00053     { insert(std::make_pair(std::string(__n),__v)); }
00054   datamap(const datamap& __c) : _Base(__c), __empty() {}
00055   virtual ~datamap() {}
00056 
00057 public:
00058   bool sinsert(const std::string& __s, const additional_info_u& __h,
00059                bool replace);
00060   bool sinsert(const char* __cp, const additional_info_u& __h, bool replace);
00061 
00062   bool sinsert(const std::string& __s, int i, const additional_info_u& __h,
00063                bool replace);
00064   bool sinsert(const char* __cp, int i, const additional_info_u& __h,
00065                bool replace);
00066 
00067   const additional_info_u& sfind(const std::string& __s) const;
00068   const additional_info_u& sfind(const char* __cp) const;
00069 
00070   const additional_info_u& sfind(const std::string& __s, int i) const;
00071   const additional_info_u& sfind(const char* __cp, int i) const;
00072 
00073   void remove(const std::string& __s);
00074   void remove(const char* __cp);
00075 
00076   void remove(const std::string& __s, int i);
00077   void remove(const char* __cp, int i);
00078 
00079   bool defd(const std::string& __s) const;
00080   bool defd(const char* __cp) const;
00081 
00082   bool defd(const std::string& __s, int i) const;
00083   bool defd(const char* __cp, int i) const;
00084 
00085   bool which(const std::string& __s, std::vector<int>& __idx) const;
00086   bool which(const char* __cp, std::vector<int>& __idx) const;
00087 
00088   bool retrieve(const std::string& __s, bool& __b) const;
00089   bool retrieve(const std::string& __s, bool& __b, bool __def) const;
00090   bool retrieve(const std::string& __s, int& __d) const;
00091   bool retrieve(const std::string& __s, int& __d, int __def) const;
00092   bool retrieve(const std::string& __s, unsigned int& __d) const;
00093   bool retrieve(const std::string& __s, unsigned int& __d,
00094       unsigned int __def) const;
00095   bool retrieve(const std::string& __s, double& __d) const;
00096   bool retrieve(const std::string& __s, double& __d, double __def) const;
00097   bool retrieve(const std::string& __s, interval& __b) const;
00098   bool retrieve(const std::string& __s, interval& __b,
00099       const interval& __def) const;
00100   bool retrieve(const std::string& __s, std::string& __is) const;
00101   bool retrieve(const std::string& __s, std::string& __is,
00102       const std::string& __def) const;
00103   bool retrieve(const std::string& __s, const std::vector<bool>*& __b) const;
00104   bool retrieve(const std::string& __s, const std::vector<bool>*& __b,
00105       const std::vector<bool>* __def) const;
00106   bool retrieve(const std::string& __s, const std::vector<int>*& __b) const;
00107   bool retrieve(const std::string& __s, const std::vector<int>*& __b,
00108       const std::vector<int>* __def) const;
00109   bool retrieve(const std::string& __s,
00110       const std::vector<unsigned int>*& __b) const;
00111   bool retrieve(const std::string& __s, const std::vector<unsigned int>*& __b,
00112       const std::vector<unsigned int>* __def) const;
00113   bool retrieve(const std::string& __s, const std::vector<double>*& __b) const;
00114   bool retrieve(const std::string& __s, const std::vector<double>*& __b,
00115       const std::vector<double>* __def) const;
00116   bool retrieve(const std::string& __s, const std::vector<interval>*& __b) const;
00117   bool retrieve(const std::string& __s, const std::vector<interval>*& __b,
00118       const std::vector<interval>* __def) const;
00119   bool retrieve(const std::string& __s, const matrix<double>*& __b) const;
00120   bool retrieve(const std::string& __s, const matrix<double>*& __b,
00121       const matrix<double>* __def) const;
00122   bool retrieve(const std::string& __s, const matrix<int>*& __b) const;
00123   bool retrieve(const std::string& __s, const matrix<int>*& __b,
00124       const matrix<int>* __def) const;
00125   bool retrieve(const std::string& __s, const matrix<interval>*& __b) const;
00126   bool retrieve(const std::string& __s, const matrix<interval>*& __b,
00127       const matrix<interval>* __def) const;
00128 
00129   bool retrieve(const char* __s, bool& __b) const;
00130   bool retrieve(const char* __s, bool& __b, bool __def) const;
00131   bool retrieve(const char* __s, int& __d) const;
00132   bool retrieve(const char* __s, int& __d, int __def) const;
00133   bool retrieve(const char* __s, unsigned int& __d) const;
00134   bool retrieve(const char* __s, unsigned int& __d, unsigned int __def) const;
00135   bool retrieve(const char* __s, double& __d) const;
00136   bool retrieve(const char* __s, double& __d, double __def) const;
00137   bool retrieve(const char* __s, interval& __b) const;
00138   bool retrieve(const char* __s, interval& __b,
00139       const interval& __def) const;
00140   bool retrieve(const char* __s, std::string& __is) const;
00141   bool retrieve(const char* __s, std::string& __b,
00142       const std::string& __def) const;
00143   bool retrieve(const char* __s, const std::vector<bool>*& __b) const;
00144   bool retrieve(const char* __s, const std::vector<bool>*& __b,
00145       const std::vector<bool>* __def) const;
00146   bool retrieve(const char* __s, const std::vector<unsigned int>*& __b) const;
00147   bool retrieve(const char* __s, const std::vector<unsigned int>*& __b,
00148       const std::vector<unsigned int>* __def) const;
00149   bool retrieve(const char* __s, const std::vector<int>*& __b) const;
00150   bool retrieve(const char* __s, const std::vector<int>*& __b,
00151       const std::vector<int>* __def) const;
00152   bool retrieve(const char* __s, const std::vector<double>*& __b) const;
00153   bool retrieve(const char* __s, const std::vector<double>*& __b,
00154       const std::vector<double>* __def) const;
00155   bool retrieve(const char* __s, const std::vector<interval>*& __b) const;
00156   bool retrieve(const char* __s, const std::vector<interval>*& __b,
00157       const std::vector<interval>* __def) const;
00158   bool retrieve(const char* __s, const matrix<double>*& __b) const;
00159   bool retrieve(const char* __s, const matrix<double>*& __b,
00160       const matrix<double>* __def) const;
00161   bool retrieve(const char* __s, const matrix<int>*& __b) const;
00162   bool retrieve(const char* __s, const matrix<int>*& __b,
00163       const matrix<int>* __def) const;
00164   bool retrieve(const char* __s, const matrix<interval>*& __b) const;
00165   bool retrieve(const char* __s, const matrix<interval>*& __b,
00166       const matrix<interval>* __def) const;
00167 
00168   bool retrieve_i(const std::string& __s, int i, bool& __b) const;
00169   bool retrieve_i(const std::string& __s, int i, bool& __b, bool __def) const;
00170   bool retrieve_i(const std::string& __s, int i, int& __d) const;
00171   bool retrieve_i(const std::string& __s, int i, int& __d, int __def) const;
00172   bool retrieve_i(const std::string& __s, int i, unsigned int& __d) const;
00173   bool retrieve_i(const std::string& __s, int i, unsigned int& __d,
00174       unsigned int __def) const;
00175   bool retrieve_i(const std::string& __s, int i, double& __d) const;
00176   bool retrieve_i(const std::string& __s, int i, double& __d, double __def) const;
00177   bool retrieve_i(const std::string& __s, int i, interval& __b) const;
00178   bool retrieve_i(const std::string& __s, int i, interval& __b,
00179       const interval& __def) const;
00180   bool retrieve_i(const std::string& __s, int i, std::string& __is) const;
00181   bool retrieve_i(const std::string& __s, int i, std::string& __is,
00182       const std::string& __def) const;
00183   bool retrieve_i(const std::string& __s, int i,
00184       const std::vector<bool>*& __b) const;
00185   bool retrieve_i(const std::string& __s, int i, const std::vector<bool>*& __b,
00186       const std::vector<bool>* __def) const;
00187   bool retrieve_i(const std::string& __s, int i,
00188       const std::vector<int>*& __b) const;
00189   bool retrieve_i(const std::string& __s, int i, const std::vector<int>*& __b,
00190       const std::vector<int>* __def) const;
00191   bool retrieve_i(const std::string& __s, int i,
00192       const std::vector<unsigned int>*& __b) const;
00193   bool retrieve_i(const std::string& __s, int i,
00194       const std::vector<unsigned int>*& __b,
00195       const std::vector<unsigned int>* __def) const;
00196   bool retrieve_i(const std::string& __s, int i,
00197       const std::vector<double>*& __b) const;
00198   bool retrieve_i(const std::string& __s, int i, const std::vector<double>*& __b,
00199       const std::vector<double>* __def) const;
00200   bool retrieve_i(const std::string& __s, int i,
00201       const std::vector<interval>*& __b) const;
00202   bool retrieve_i(const std::string& __s, int i,
00203       const std::vector<interval>*& __b,
00204       const std::vector<interval>* __def) const;
00205   bool retrieve_i(const std::string& __s, int i,
00206       const matrix<double>*& __b) const;
00207   bool retrieve_i(const std::string& __s, int i, const matrix<double>*& __b,
00208       const matrix<double>* __def) const;
00209   bool retrieve_i(const std::string& __s, int i, const matrix<int>*& __b) const;
00210   bool retrieve_i(const std::string& __s, int i, const matrix<int>*& __b,
00211       const matrix<int>* __def) const;
00212   bool retrieve_i(const std::string& __s, int i,
00213       const matrix<interval>*& __b) const;
00214   bool retrieve_i(const std::string& __s, int i, const matrix<interval>*& __b,
00215       const matrix<interval>* __def) const;
00216 
00217   bool retrieve_i(const char* __s, int i, bool& __b) const;
00218   bool retrieve_i(const char* __s, int i, bool& __b, bool __def) const;
00219   bool retrieve_i(const char* __s, int i, int& __d) const;
00220   bool retrieve_i(const char* __s, int i, int& __d, int __def) const;
00221   bool retrieve_i(const char* __s, int i, unsigned int& __d) const;
00222   bool retrieve_i(const char* __s, int i, unsigned int& __d,
00223       unsigned int __def) const;
00224   bool retrieve_i(const char* __s, int i, double& __d) const;
00225   bool retrieve_i(const char* __s, int i, double& __d, double __def) const;
00226   bool retrieve_i(const char* __s, int i, interval& __b) const;
00227   bool retrieve_i(const char* __s, int i, interval& __b,
00228       const interval& __def) const;
00229   bool retrieve_i(const char* __s, int i, std::string& __is) const;
00230   bool retrieve_i(const char* __s, int i, std::string& __b,
00231       const std::string& __def) const;
00232   bool retrieve_i(const char* __s, int i, const std::vector<bool>*& __b) const;
00233   bool retrieve_i(const char* __s, int i, const std::vector<bool>*& __b,
00234       const std::vector<bool>* __def) const;
00235   bool retrieve_i(const char* __s, int i, const std::vector<int>*& __b) const;
00236   bool retrieve_i(const char* __s, int i, const std::vector<int>*& __b,
00237       const std::vector<int>* __def) const;
00238   bool retrieve_i(const char* __s, int i,
00239       const std::vector<unsigned int>*& __b) const;
00240   bool retrieve_i(const char* __s, int i, const std::vector<unsigned int>*& __b,
00241       const std::vector<unsigned int>* __def) const;
00242   bool retrieve_i(const char* __s, int i, const std::vector<double>*& __b) const;
00243   bool retrieve_i(const char* __s, int i, const std::vector<double>*& __b,
00244       const std::vector<double>* __def) const;
00245   bool retrieve_i(const char* __s, int i,
00246       const std::vector<interval>*& __b) const;
00247   bool retrieve_i(const char* __s, int i, const std::vector<interval>*& __b,
00248       const std::vector<interval>* __def) const;
00249   bool retrieve_i(const char* __s, int i, const matrix<double>*& __b) const;
00250   bool retrieve_i(const char* __s, int i, const matrix<double>*& __b,
00251       const matrix<double>* __def) const;
00252   bool retrieve_i(const char* __s, int i, const matrix<int>*& __b) const;
00253   bool retrieve_i(const char* __s, int i, const matrix<int>*& __b,
00254       const matrix<int>* __def) const;
00255   bool retrieve_i(const char* __s, int i, const matrix<interval>*& __b) const;
00256   bool retrieve_i(const char* __s, int i, const matrix<interval>*& __b,
00257       const matrix<interval>* __def) const;
00258 };
00259 
00260 #include <datamap-inline.h>
00261 
00262 #endif /* _DATAMAP_H */

Generated on Tue Nov 4 01:57:57 2003 for COCONUT API by doxygen1.2.18