From 6d4e94616d0fee72875d0a738c529dddc4ea0762 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 18 Jul 2010 10:00:38 +0000 Subject: [PATCH] * ./crlcore: - New: In Utilities, automatic setting of STRATUS_MAPPING_NAME. It's put back into the environment from the configuration. This suppress the need for the last environment variable under cgt. --- crlcore/etc/tools.configuration.xml | 6 +++++ crlcore/src/ccore/Utilities.cpp | 42 +++++++++++++++++++---------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/crlcore/etc/tools.configuration.xml b/crlcore/etc/tools.configuration.xml index 69657484..fc279eb7 100644 --- a/crlcore/etc/tools.configuration.xml +++ b/crlcore/etc/tools.configuration.xml @@ -81,6 +81,8 @@ + + @@ -140,5 +142,9 @@ + + + + diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index 1aef5391..be114231 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -86,9 +86,20 @@ namespace { } + void stratus1MappingNameChanged ( Cfg::Parameter* p ) + { + bfs::path stratusMappingName = p->asString(); + if ( not stratusMappingName.has_root_directory() ) { + stratusMappingName = System::getPath("etc") / stratusMappingName; + } + setenv ( "STRATUS_MAPPING_NAME", stratusMappingName.string().c_str(), 1 ); + } + + std::string environmentMapper ( std::string environmentName ) { - if ( environmentName == "CORIOLIS_TOP" ) return "coriolis_top"; + if ( environmentName == "CORIOLIS_TOP" ) return "coriolis_top"; + else if ( environmentName == "STRATUS_MAPPING_NAME" ) return "stratus_mapping_name"; return ""; } @@ -224,8 +235,10 @@ namespace CRL { // Environment variables reading. boptions::options_description options ("Environment Variables"); options.add_options() - ( "coriolis_top", boptions::value()->default_value(CORIOLIS_TOP) - , "The root directory of the Coriolis installation tree." ); + ( "coriolis_top" , boptions::value()->default_value(CORIOLIS_TOP) + , "The root directory of the Coriolis installation tree." ) + ( "stratus_mapping_name", boptions::value() + , "Stratus virtual cells mapping." ); boptions::variables_map arguments; boptions::store ( boptions::parse_environment(options,environmentMapper), arguments ); @@ -266,12 +279,13 @@ namespace CRL { // Default configuration loading. Cfg::Configuration* conf = Cfg::Configuration::get (); - Cfg::getParamBool("misc.catchCore" ,true )->registerCb ( catchCoreChanged ); - Cfg::getParamBool("misc.verboseLevel1",true )->registerCb ( verboseLevel1Changed ); - Cfg::getParamBool("misc.verboseLevel2",true )->registerCb ( verboseLevel2Changed ); - Cfg::getParamBool("misc.info" ,false)->registerCb ( infoChanged ); - Cfg::getParamBool("misc.logMode" ,true )->registerCb ( logModeChanged ); - Cfg::getParamInt ("misc.traceLevel" ,1000 )->registerCb ( traceLevelChanged ); + Cfg::getParamBool ("misc.catchCore" ,true )->registerCb ( catchCoreChanged ); + Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( verboseLevel1Changed ); + Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( verboseLevel2Changed ); + Cfg::getParamBool ("misc.info" ,false)->registerCb ( infoChanged ); + Cfg::getParamBool ("misc.logMode" ,true )->registerCb ( logModeChanged ); + Cfg::getParamInt ("misc.traceLevel" ,1000 )->registerCb ( traceLevelChanged ); + Cfg::getParamString("stratus1.mappingName","./stratus2sxlib.xml")->registerCb ( stratus1MappingNameChanged ); // Immediate update from the configuration. catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) ); @@ -281,6 +295,11 @@ namespace CRL { logModeChanged ( Cfg::getParamBool("misc.logMode" ) ); traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) ); + bfs::path stratusMappingName; + if ( arguments.count("stratus_mapping_name") ) { + Cfg::getParamString( "stratus1.mappingName")->setString ( arguments["stratus_mapping_name"].as() ); + } + bool systemConfFound = false; bfs::path systemConfFile = sysConfDir / "tools.configuration.xml"; if ( bfs::exists(systemConfFile) ) { @@ -387,14 +406,9 @@ namespace CRL { { static bfs::path nullPath ("no_path"); - cerr << "Looking up: " << key << endl; - map::const_iterator ipath = _pathes.find ( key ); if ( ipath == _pathes.end() ) return nullPath; - cerr << "Successfull lookup: "; cerr.flush(); - cerr << (*ipath).second.string() << endl; - return (*ipath).second; }