bbtkConfigurationFile.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkConfigurationFile.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:13 $
00006   Version:   $Revision: 1.10 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00041 #ifndef __bbtkConfigurationFile_h__
00042 #define __bbtkConfigurationFile_h__
00043 
00044 #include "bbtkSystem.h"
00045 #include <string>
00046 
00047 
00048 #ifdef WIN32
00049 #define _CRT_SECURE_NO_DEPRECATE
00050 #endif
00051 
00052 #include <stdio.h>
00053 #include <iostream>
00054 #include <fstream>
00055 #include <sstream>
00056 #include <vector>
00057 
00058 
00059 
00060 namespace bbtk
00061 {
00062   //==========================================================================
00063   class BBTK_EXPORT  ConfigurationException
00064   {
00065   public:
00066     ConfigurationException(const std::string& message) : mMessage(message) {}
00067     
00068     std::string mMessage;
00069   };
00070   //==========================================================================
00071   
00072   //==========================================================================
00073   class BBTK_EXPORT ConfigurationFile
00074   {
00075   public:
00076     
00077     static ConfigurationFile& GetInstance()
00078     {
00079       static ConfigurationFile f;
00080       return f;
00081     }
00082     
00083     ~ConfigurationFile();
00084     
00085   private:
00086     ConfigurationFile();
00087     void InstallPath ();
00088     
00089   public:
00090     void GetHelp(int level) const;
00091 
00092     inline const std::string& Get_description() const
00093     { return mDescription;}
00094     //    inline const std::string& Get_url() const
00095     //    { return mUrl;}
00096     inline const std::string& Get_data_path() const
00097     { return mData_path;}  
00098     inline const std::string& Get_file_separator() const
00099         { return mFile_separator;}
00100     
00101     inline const std::string& Get_bin_path() const
00102     { return mBin_path;}
00103     inline const std::string& Get_install_path() const
00104     { return mInstall_path;}
00105     inline const std::string& Get_doc_path() const
00106     { return mDoc_path;}
00107     inline const std::string& Get_rsc_path() const
00108     { return mRsc_path;}
00109     
00110     inline const std::string& Get_root_bbs_path() const
00111     { return mBbs_path;}
00112     inline const std::vector<std::string>& Get_bbs_paths() const
00113     { return mBbs_paths;}
00114     inline const std::vector<std::string>& Get_package_paths() const
00115     { return mPackage_paths;}
00116     inline const std::string& Get_config_xml_full_path() const
00117     { return mConfig_xml_full_path;}
00118     inline const std::string& Get_default_temp_dir() const
00119     { return mDefault_temp_dir;}
00120 
00121     bool AddPackagePathsAndWrite( const std::string& package_root_path );
00122     
00123   private:
00124     void Read(const std::string& fileName);
00125      std::string GetExecutablePath();
00126      void CreateConfigXML( char *rootDirectory );
00127     
00128     // Attributes :
00129   private :
00130     std::string mDescription; 
00132     std::string mConfig_xml_full_path;  
00133     
00136     std::string mBin_path;
00138     std::string mInstall_path;
00140     std::string mDoc_rel_path;
00142     std::string mDoc_path;
00144     std::string mBbs_rel_path;
00146     std::string mBbs_path;
00148     std::string mRsc_rel_path;
00150     std::string mRsc_path;
00154     std::string mData_path;
00155     
00157     std::string mFile_separator;
00158     
00161     std::string mUrl;
00163     std::vector<std::string> mBbs_paths; 
00165     std::vector<std::string> mPackage_paths;
00167     std::vector<std::string> mExt_dll_paths;
00169     std::string mDefault_temp_dir;       
00170   };
00171   
00172   
00173 }// namespace bbtk
00174 
00175 
00176 
00177 #endif
00178 

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6