Пример #1
0
	void ParameterGroup::insert(const std::string& name,
				    const std::tr1::shared_ptr<ParameterMapItem>& data)
        {
	    std::pair<std::string, std::string> name_path = split(name);
	    map_type::const_iterator it = map_.find(name_path.first);
	    assert(name_path.second == "");
	    if (it == map_.end()) {
		map_[name] = data;
	    } else {
		if ( (map_[name]->getTag() == data->getTag())  &&
                     (data->getTag() == ID_xmltag__param_grp) ) {
		    ParameterGroup& alpha = dynamic_cast<ParameterGroup&>(*(*it).second);
		    ParameterGroup& beta  = dynamic_cast<ParameterGroup&>(*data);
		    for (map_type::const_iterator
                             item = beta.map_.begin(); item != beta.map_.end(); ++item) {
			alpha.insert((*item).first, (*item).second);
		    }
		} else {
		    std::cout << "WARNING : The '"
			      << map_[name]->getTag()
			      << "' element '"
			      << name
			      << "' already exist in group '"
			      << this->path()
			      << "'. The element will be replaced by a '"
			      << data->getTag()
			      << "' element.\n";
		    map_[name] = data;
		}
	    }
	}