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: 2010/11/22 16:44:27 $
00006   Version:   $Revision: 1.12 $
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   #if __VISUALC__ < 1400
00050         #define _CRT_SECURE_NO_DEPRECATE
00051   #endif
00052 #endif
00053 
00054 #include <stdio.h>
00055 #include <iostream>
00056 #include <fstream>
00057 #include <sstream>
00058 #include <vector>
00059 
00060 
00061 
00062 namespace bbtk
00063 {
00064   //==========================================================================
00065   class BBTK_EXPORT  ConfigurationException
00066   {
00067   public:
00068     ConfigurationException(const std::string& message) : mMessage(message) {}
00069     
00070     std::string mMessage;
00071   };
00072   //==========================================================================
00073   
00074   //==========================================================================
00075   class BBTK_EXPORT ConfigurationFile
00076   {
00077   public:
00078     
00079     static ConfigurationFile& GetInstance()
00080     {
00081       static ConfigurationFile f;
00082       return f;
00083     }
00084     
00085     ~ConfigurationFile();
00086     
00087     void GetHelp(int level) const;
00088 
00090     inline bool DotBbtkIsNew() { return mDot_bbtk_is_new; }
00091 
00092     inline const std::string& Get_description() const
00093     { return mDescription;}
00094 
00095     inline const std::string& Get_data_path() const
00096     { return mData_path;}  
00097     inline const std::string& Get_file_separator() const
00098         { return mFile_separator;}
00099     
00100     inline const std::string& Get_dot_bbtk_path() const
00101     { return mDot_bbtk_path;}
00102     inline const std::string& Get_bin_path() const
00103     { return mBin_path;}
00104     inline const std::string& Get_install_path() const
00105     { return mInstall_path;}
00106     inline const std::string& Get_doc_path() const
00107     { return mDoc_path;}
00108       
00109     inline const std::string& Get_root_bbs_path() const
00110     { return mBbs_path;}
00111     inline const std::vector<std::string>& Get_bbs_paths() const
00112     { return mBbs_paths;}
00113     inline const std::vector<std::string>& Get_package_paths() const
00114     { return mPackage_paths;}
00115     inline const std::string& Get_config_xml_full_path() const
00116     { return mConfig_xml_full_path;}
00117     inline const std::string& Get_default_temp_dir() const
00118     { return mTemp_path;}
00119 
00120     bool AddPackagePathsAndWrite( const std::string& package_root_path );
00121     
00122   private:
00123     ConfigurationFile();
00124     void InstallPath ();
00125     void Read(const std::string& fileName);
00126     void CreateConfigXML( char *rootDirectory );
00127     void InitializeDotBbtkStructure();
00128     // Attributes :
00129   private :
00130     std::string mDescription; 
00132     std::string mConfig_xml_full_path;  
00133     
00136     std::string mBin_path;
00138     std::string mDot_bbtk_path;
00140     std::string mInstall_path;
00142     std::string mDoc_path;
00144     std::string mTemp_path;      
00146     std::string mBbs_rel_path;
00148     std::string mBbs_path;
00152     std::string mData_path;
00153     
00155     std::string mFile_separator;
00156     
00159     std::string mUrl;
00161     std::vector<std::string> mBbs_paths; 
00163     std::vector<std::string> mPackage_paths;
00165     std::vector<std::string> mExt_dll_paths;
00166 
00167 
00170     bool mDot_bbtk_is_new;
00171    };
00172   
00173   
00174 }// namespace bbtk
00175 
00176 
00177 
00178 #endif
00179 

Generated on Thu May 31 14:12:03 2012 for BBTK by  doxygen 1.5.7.1