1 /*=========================================================================
4 Module: $RCSfile: bbtkConfigurationFile.h,v $
6 Date: $Date: 2008/01/22 15:02:00 $
7 Version: $Revision: 1.1 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See doc/license.txt or
11 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
20 *\brief Class bbtk::ConfigurationFile
23 *\class bbtk::ConfigurationFile
28 #ifndef __bbtkConfigurationFile_h__
29 #define __bbtkConfigurationFile_h__
31 #include "bbtkSystem.h"
36 #define _CRT_SECURE_NO_DEPRECATE
40 #include "xmlParser.h"
49 //==========================================================================
50 class BBTK_EXPORT ConfigurationException
53 ConfigurationException(const std::string& message) : mMessage(message) {}
59 //==========================================================================
60 class BBTK_EXPORT ConfigurationFile
64 static ConfigurationFile const &GetInstance()
66 static ConfigurationFile f;
77 inline const std::string& Get_description() const
78 { return mDescription;}
79 inline const std::string& Get_url() const
81 inline const std::string& Get_data_path() const
83 inline const std::string& Get_file_separator() const
84 { return mFile_separator;}
85 inline const std::string& Get_install_path() const
86 { return mInstall_path;}
87 inline const std::vector<std::string>& Get_bbs_paths() const
89 inline const std::vector<std::string>& Get_package_paths() const
90 { return mPackage_paths;}
91 inline const std::string& Get_config_xml_full_path() const
92 { return mConfig_xml_full_path;}
93 inline const std::string& Get_default_doc_tmp() const
94 { return mDefault_doc_tmp;}
97 void Read(const std::string& fileName);
98 void GetTextOrClear(const XMLNode& node, std::string& var);
99 char *GetExecutablePath();
100 bool FileExists(std::string strFilename);
101 void CreateConfigXML( char *rootDirectory );
105 std::string mDescription;
106 /// Where is the file bbtk_config.xml
107 std::string mConfig_xml_full_path;
110 std::string mInstall_path;
111 std::string mData_path;
112 /// / or \, depending on the OS
113 std::string mFile_separator;
115 std::vector<std::string> mBbs_paths;
117 std::vector<std::string> mPackage_paths;
118 /// If Packages link against extern dlls
119 std::vector<std::string> mExt_dll_paths;
120 /// Default directory for generating Graph
121 std::string mDefault_doc_tmp;