config.cpp

00001 /***************************************************************************
00002  *  config.cpp - config helper - generated by genconfig 0.3
00003  *
00004  *  Config class generated: Mon Jun 18 14:57:15 2007
00005  *  Used template: ../../../../../src/modules/tools/genconfig/config.template.cpp
00006  *  Template created: Thu Apr 29 14:27:25 2004
00007  *  Copyright  2004  Tim Niemueller
00008  *  niemueller@i5.informatik.rwth-aachen.de
00009  ****************************************************************************/
00010
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version.
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL file in the doc directory.
00022  */
00023 
00024 /// @cond RCSOFTX_CONFIG
00025 
00026 #include "apps/fountain/config.h"
00027
00028 #include <iostream>
00029 #include <utils/utils.h>
00030
00031 using namespace std;
00032 
00033 /** @class RCSoftXFountainConfig "apps/fountain/config.h"
00034  * Configration object.
00035  * Auto-generated configuration object.
00036  */
00037 
00038 /** Constructor.
00039  * @param configFile config reader
00040  */
00041 RCSoftXFountainConfig::RCSoftXFountainConfig(CConfigReader *configFile)
00042 {
00043
00044   string errmsg;
00045
00046   m_pXMLConfigFile = configFile;
00047   m_sPrefix = "";
00048
00049   if (m_pXMLConfigFile != NULL) {
00050     m_sPrefix = "<RCSoftConfigFile><Lowlevel><FireVision><Fountain>";
00051
00052     if (!m_pXMLConfigFile->GetNodeValue(m_sPrefix+"<FountainPort>", FountainPort, errmsg)) {
00053         cout << endl << "** XML ERROR while trying to fetch "+m_sPrefix+"<FountainPort>" << endl << flush;
00054         cout << __FUNCTION__ << ": " << __FILE__ << "[" << __LINE__ << "]" << endl << flush;
00055         cout << "Error message from ConfigReader was: " << errmsg << endl;
00056         exit(1);
00057     }
00058     cout << m_sPrefix << "<FountainPort>: " << toString(FountainPort) << endl << flush;
00059
00060     if (!m_pXMLConfigFile->GetNodeValue(m_sPrefix+"<ImageDelay>", ImageDelay, errmsg)) {
00061         cout << endl << "** XML ERROR while trying to fetch "+m_sPrefix+"<ImageDelay>" << endl << flush;
00062         cout << __FUNCTION__ << ": " << __FILE__ << "[" << __LINE__ << "]" << endl << flush;
00063         cout << "Error message from ConfigReader was: " << errmsg << endl;
00064         exit(1);
00065     }
00066     cout << m_sPrefix << "<ImageDelay>: " << toString(ImageDelay) << endl << flush;
00067
00068   } else {
00069     cout << "*** XML ERROR: No XMLConfigReader given to Config Object. Did NOT read config!" << endl << flush;
00070     exit(2);
00071   }
00072
00073 }
00074 
00075 /** Destructor. */
00076 RCSoftXFountainConfig::~RCSoftXFountainConfig()
00077 {
00078 }
00079 
00080 /// @endcond
00081