00001 // Copyright (C) 2001 Petter Urkedal (petter.urkedal@matfys.lth.se) 00002 // 00003 // This file 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; either version 2 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // This file is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 // 00017 // As a special exception, you may use this file as part of a free 00018 // software library without restriction. Specifically, if other files 00019 // instantiate templates or use macros or inline functions from this 00020 // file, or you compile this file and link it with other files to 00021 // produce an executable, this file does not by itself cause the 00022 // resulting executable to be covered by the GNU General Public 00023 // License. This exception does not however invalidate any other 00024 // reasons why the executable file might be covered by the GNU General 00025 // Public License. 00026 // 00027 // $Id: ens_db.h,v 1.1 2002/05/30 18:01:40 petter_urkedal Exp $ 00028 00029 // !! THIS IS AS INTERNAL HEADER !! 00030 00031 #ifndef MORE_PHYS_ENS_DB_H 00032 #define MORE_PHYS_ENS_DB_H 00033 00034 #include <more/phys/nuclear.h> 00035 00036 namespace more { 00037 namespace phys { 00038 namespace ens { 00039 00040 /** A handle to an ENSDF provider. A default instance of this class 00041 is provided by the static member function default_db(), so in most 00042 cases it is sufficient to call 00043 file_repository::default_db()->fetch_file(nucl). */ 00044 struct ensdb 00045 { 00046 ensdb(); 00047 00048 std::string 00049 fetch_file(more::phys::nucleus const& nuc, bool force = false); 00050 00051 void set_cache(std::string s) { 00052 local_dir = s; 00053 } 00054 00055 void set_source(std::string form_url_, std::string download_url_) { 00056 form_url = form_url_; 00057 download_url = download_url_; 00058 } 00059 00060 void disable_fetcher() { m_try_fetcher = false; } 00061 void enable_compression(bool c) { m_do_compress = c; } 00062 00063 private: 00064 std::string local_dir; 00065 std::string form_url; 00066 std::string download_url; 00067 bool m_try_fetcher; 00068 bool m_do_compress; 00069 00070 public: 00071 static ensdb* default_db() { 00072 if (!s_default) s_default = new ensdb; 00073 return s_default; 00074 } 00075 private: 00076 static ensdb* s_default; 00077 }; 00078 }}} 00079 00080 #endif