LogService
libdadi: utility tools for distributed applications
ReadConfig.hh
00001 /****************************************************************************/
00002 /* Header of the ReadConfig class                                           */
00003 /*                                                                          */
00004 /*  Author(s):                                                              */
00005 /*    - Georg Hoesch (hoesch@in.tum.de)                                     */
00006 /*    - Cyrille Pontvieux (cyrille.pontvieux@edu.univ-fcomte.fr)            */
00007 /*                                                                          */
00008 /*  This file is part of DIET .                                             */
00009 /*                                                                          */
00010 /*  Copyright (C) 2000-2003 ENS Lyon, LIFC, INSA, INRIA and SysFera (2000)  */
00011 /*                                                                          */
00012 /*  - Frederic.Desprez@ens-lyon.fr (Project Manager)                        */
00013 /*  - Eddy.Caron@ens-lyon.fr (Technical Manager)                            */
00014 /*  - Tech@sysfera.com (Maintainer and Technical Support)                   */
00015 /*                                                                          */
00016 /*  This software is a computer program whose purpose is to provide an      */
00017 /*  distributed logging services.                                           */
00018 /*                                                                          */
00019 /*                                                                          */
00020 /*  This software is governed by the CeCILL license under French law and    */
00021 /*  abiding by the rules of distribution of free software.  You can  use,   */
00022 /*  modify and/ or redistribute the software under the terms of the CeCILL  */
00023 /*  license as circulated by CEA, CNRS and INRIA at the following URL       */
00024 /*  "http://www.cecill.info".                                               */
00025 /*                                                                          */
00026 /*  As a counterpart to the access to the source code and  rights to copy,  */
00027 /*  modify and redistribute granted by the license, users are provided      */
00028 /*  only with a limited warranty  and the software's author,  the holder    */
00029 /*  of the economic rights,  and the successive licensors  have only        */
00030 /*  limited liability.                                                      */
00031 /*                                                                          */
00032 /*  In this respect, the user's attention is drawn to the risks             */
00033 /*  associated with loading,  using,  modifying and/or developing or        */
00034 /*  reproducing the software by the user in light of its specific status    */
00035 /*  of free software, that may mean  that it is complicated to              */
00036 /*  manipulate, and  that  also therefore means  that it is reserved for    */
00037 /*  developers and experienced professionals having in-depth computer       */
00038 /*  knowledge. Users are therefore encouraged to load and test the          */
00039 /*  software's suitability as regards their requirements in conditions      */
00040 /*  enabling the security of their systems and/or data to be ensured and,   */
00041 /*  more generally, to use and operate it in the same conditions as         */
00042 /*  regards security.                                                       */
00043 /*                                                                          */
00044 /*  The fact that you are presently reading this means that you have had    */
00045 /*  knowledge of the CeCILL license and that you accept its terms.          */
00046 /*                                                                          */
00047 /****************************************************************************/
00048 /* $Id$
00049  * $Log$
00050  * Revision 1.1  2004/01/09 11:07:12  ghoesch
00051  * Restructured the whole LogService source tree.
00052  * Added autotools make process. Cleaned up code.
00053  * Removed some testers. Ready to release.
00054  *
00055  ***************************************************************************/
00056 
00057 #ifndef _READCONFIG_HH_
00058 #define _READCONFIG_HH_
00059 
00060 #include <cstdio>
00061 #include "LogTypes.hh"
00062 
00063 const short LS_PARSE_ALREADYPARSED = 1;
00064 const short LS_PARSE_FILEERROR = 2;
00065 const short LS_PARSE_SECTIONNOTFOUND = 3;
00066 
00067 class ReadConfig {
00068 public:
00069   ReadConfig(const char* configFilename, bool* success);
00070 
00071   ~ReadConfig();
00072 
00077   short
00078   parse();
00079 
00084   unsigned int
00085   getTracelevel();
00086 
00091   unsigned int
00092   getPort();
00093 
00098   char*
00099   getDynamicStartSuffix();
00100 
00105   char*
00106   getDynamicStopSuffix();
00107 
00114   tag_list_t*
00115   getDynamicTags();
00116 
00121   tag_list_t*
00122   getStaticTags();
00123 
00130   tag_list_t*
00131   getUniqueTags();
00132 
00137   tag_list_t*
00138   getVolatileTags();
00139 
00144   tag_list_t*
00145   getStateTags();
00146 
00151   tag_list_t*
00152   getAllTags();
00153 
00154 private:
00155   char*
00156   readLine(FILE* file);
00157 
00158   short
00159   parseTagSection(FILE* file, const char* sectionName, tag_list_t* taglist);
00160 
00161   void
00162   appendToList(tag_list_t* list, tag_list_t* appendlist);
00163 
00164   char* filename;
00165   bool alreadyParsed;
00166 
00167   unsigned int tracelevel;
00168   unsigned int port;
00169   char* startSuffix;
00170   char* stopSuffix;
00171   tag_list_t* dynamicTags;
00172   tag_list_t* staticTags;
00173   tag_list_t* uniqueTags;
00174   tag_list_t* volatileTags;
00175 };
00176 
00177 #endif
00178 
 All Classes Functions Variables