DVBConfigParser.hh

Go to the documentation of this file.
00001 // $Id: DVBConfigParser.hh 1612 2010-05-01 09:28:24Z g0dil $
00002 //
00003 // Copyright (C) 2007
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Anton Gillert <atx23@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #ifndef HH_SENF_Socket_Protocols_DVB_DVBConfigParser_
00027 #define HH_SENF_Socket_Protocols_DVB_DVBConfigParser_ 1
00028 
00029 #include <string>
00030 #include <vector>
00031 #include <map>
00032 #include <iostream>
00033 #include <sstream>
00034 #include <fstream>
00035 #include <boost/tokenizer.hpp>
00036 #include <linux/dvb/frontend.h>
00037 
00038 namespace senf {
00039 
00040     class DVBConfigParser
00041     {
00042         struct DVBParams {
00043                 std::map<std::string, fe_spectral_inversion_t> inversion;
00044                 std::map<std::string, fe_bandwidth_t> bandwidth;
00045                 std::map<std::string, fe_code_rate_t> code_rate;
00046                 std::map<std::string, fe_guard_interval_t> guard_interval;
00047                 std::map<std::string, fe_hierarchy_t> hierarchy;
00048                 std::map<std::string, fe_modulation_t> modulation;
00049                 std::map<std::string, fe_transmit_mode_t> transmit_mode;
00050                 DVBParams();
00051         };
00052         static const DVBParams params;
00053         typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
00054 
00055     public:
00056         DVBConfigParser(fe_type_t type_, const std::string & configFilePath = "");
00057         ~DVBConfigParser();
00058 
00059         std::string getConfigLine(std::string channel);
00060 
00061         dvb_frontend_parameters getFrontendParam(std::string configLine);
00062 
00063     private:
00064         fe_type_t type;
00065         std::string configFilePath;
00066         std::ifstream configFile;
00067         void initConfigFile(std::string _configFilePath);
00068 
00069         dvb_frontend_parameters getFrontendParamDVB_T( const tokenizer & tokens);
00070         dvb_frontend_parameters getFrontendParamDVB_C( const tokenizer & tokens);
00071         dvb_frontend_parameters getFrontendParamDVB_S( const tokenizer & tokens);
00072 
00073     };
00074 }
00075 
00076 #endif