GNU Radio 3.5.3.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2006 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 #ifndef INCLUDED_GR_PREFS_H 00023 #define INCLUDED_GR_PREFS_H 00024 00025 #include <gr_core_api.h> 00026 #include <string> 00027 00028 /*! 00029 * \brief Base class for representing user preferences a la windows INI files. 00030 * \ingroup misc 00031 * 00032 * The real implementation is in Python, and is accessable from C++ 00033 * via the magic of SWIG directors. 00034 */ 00035 00036 class GR_CORE_API gr_prefs 00037 { 00038 public: 00039 static gr_prefs *singleton(); 00040 static void set_singleton(gr_prefs *p); 00041 00042 virtual ~gr_prefs(); 00043 00044 /*! 00045 * \brief Does \p section exist? 00046 */ 00047 virtual bool has_section(const std::string section); 00048 00049 /*! 00050 * \brief Does \p option exist? 00051 */ 00052 virtual bool has_option(const std::string section, const std::string option); 00053 00054 /*! 00055 * \brief If option exists return associated value; else default_val. 00056 */ 00057 virtual const std::string get_string(const std::string section, 00058 const std::string option, 00059 const std::string default_val); 00060 00061 /*! 00062 * \brief If option exists and value can be converted to bool, return it; else default_val. 00063 */ 00064 virtual bool get_bool(const std::string section, 00065 const std::string option, 00066 bool default_val); 00067 00068 /*! 00069 * \brief If option exists and value can be converted to long, return it; else default_val. 00070 */ 00071 virtual long get_long(const std::string section, 00072 const std::string option, 00073 long default_val); 00074 00075 /*! 00076 * \brief If option exists and value can be converted to double, return it; else default_val. 00077 */ 00078 virtual double get_double(const std::string section, 00079 const std::string option, 00080 double default_val); 00081 }; 00082 00083 00084 #endif /* INCLUDED_GR_PREFS_H */